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

Страница интерфейса MediaWiki
Нет описания правки
Нет описания правки
Строка 2: Строка 2:
   $(function () {
   $(function () {
     $('.faction-header').each(function () {
     $('.faction-header').each(function () {
       this.style.cursor = 'pointer';
       $(this).css('cursor', 'pointer');
       $(this).on('click', function () {
       $(this).on('click', function () {
         var $list = $(this).next('.faction-list');
         var $list = $(this).next('.faction-list');
Строка 8: Строка 8:


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

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

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

        var $arrow = $(this).find('.arrow');
        $arrow.text($arrow.text() === '▾' ? '▴' : '▾');
      });
    });
  });
});