MediaWiki:Test.js: различия между версиями

Страница интерфейса MediaWiki
(Отмена правки 18773, сделанной Dantes (обсуждение))
Метка: отмена
Нет описания правки
Строка 21: Строка 21:
   });
   });
});
});
// Добавляем выходной продукт в data-атрибут
(function() {
  var recipes = document.querySelectorAll('.recipe-card');
 
  for (var i = 0; i < recipes.length; i++) {
    var lastItem = recipes[i].querySelector('.recipe-list li:last-child');
    if (lastItem) {
      var outputName = lastItem.textContent.replace(/\s*\[\d+\]$/, '');
      recipes[i].setAttribute('data-output', outputName);
    }
  }
})();

Версия от 19:51, 3 мая 2025

$(document).ready(function () {
  // Анимация раскрытия контента
  $('.collapsible-header').click(function () {
    var content = $(this).next('.collapsible-content');
    content.slideToggle(300, function() {
      // Анимация появления элементов после раскрытия
      $(this).find('li').each(function (index) {
        $(this).css('animation-delay', (index * 0.1) + 's');
        $(this).addClass('visible');
      });
    });
    $(this).toggleClass('open');
  });

  // Устанавливаем цвет границы из data-атрибута
  $('.recipe-card').each(function () {
    var borderColor = $(this).attr('data-border');
    if (borderColor) {
      $(this).css('border-color', borderColor);
    }
  });
});
// Добавляем выходной продукт в data-атрибут
(function() {
  var recipes = document.querySelectorAll('.recipe-card');
  
  for (var i = 0; i < recipes.length; i++) {
    var lastItem = recipes[i].querySelector('.recipe-list li:last-child');
    if (lastItem) {
      var outputName = lastItem.textContent.replace(/\s*\[\d+\]$/, '');
      recipes[i].setAttribute('data-output', outputName);
    }
  }
})();