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

Страница интерфейса MediaWiki
Нет описания правки
Нет описания правки
Строка 1: Строка 1:
mw.loader.using('jquery', function () {
mw.loader.using('jquery', function () {
   $(function () {
   $(function () {
     var headers = document.getElementsByClassName('faction-toggle-box');
     $('.faction-header').each(function () {
    for (var i = 0; i < headers.length; i++) {
       this.style.cursor = 'pointer';
       headers[i].style.cursor = 'pointer';
       $(this).on('click', function () {
       headers[i].onclick = function () {
         var $list = $(this).next('.faction-list');
         var content = this.nextElementSibling;
        $list.slideToggle(150);
         if (content.style.display === 'none') {
 
           content.style.display = 'block';
        var $arrow = $(this).find('.arrow');
         if ($arrow.text() === '') {
           $arrow.text('');
         } else {
         } else {
           content.style.display = 'none';
           $arrow.text('');
         }
         }
       };
       });
     }
     });
   });
   });
});
});

Версия от 15:54, 8 мая 2025

mw.loader.using('jquery', function () {
  $(function () {
    $('.faction-header').each(function () {
      this.style.cursor = 'pointer';
      $(this).on('click', function () {
        var $list = $(this).next('.faction-list');
        $list.slideToggle(150);

        var $arrow = $(this).find('.arrow');
        if ($arrow.text() === '▾') {
          $arrow.text('▴');
        } else {
          $arrow.text('▾');
        }
      });
    });
  });
});