Anonymous
×
Create a new article
Write your page title here:
We currently have 452 articles on Gachimuchi Wiki. Type your article name above or click on one of the titles below and start writing!



Gachimuchi Wiki

MediaWiki:Common.js

Revision as of 16:50, 9 October 2021 by Garco (talk | contribs)

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Tutorial-QuickRC.js&action=raw&ctype=text/javascript');
mw.config.set('UMFBypassLicenseCheck',true);
(function () {
    var SlideNow = window.SlideNow || 1;
    var SlideCount = window.SlideCount || 0;
    var SlideInterval = window.SlideInterval || 0;
    var TranslateWidth = window.TranslateWidth || 0;
    var TimerPause = window.TimerPause || !1;
    mw.hook('wikipage.content').add(function() {
      var Slides = 0;
      var HeightSize = 'auto';
      var Data = ($('#SliderData').attr('class') || '').split('|');
      if (Data.length == 3) {
        Slides = Data[0];
        SlideInterval = Data[1];
        HeightSize = Data[2];
      }
      if (SlideInterval < 1000 || SlideInterval === undefined) {
        SlideInterval = 3000;
      }
      $('.Sld').each(function (index) {
        if (index + 1 > Slides) {
          $(this).remove();
        }
      });
      $('.NavBtn').each(function (index) {
        if (index + 1 > Slides) {
          $(this).remove();
        }
      });
      $('#SliderView').css('height', HeightSize);
      SlideCount = $('#SliderWrapper').children().length;
      $('#SliderWrapper').css('width', 100 * SlideCount + '%');
      $('.Sld').css('width', 100 / SlideCount + '%');
      setTimeout(function tick() {
        if (TimerPause === false) {
          NextSlide();
        }
        setTimeout(tick, SlideInterval);
      }, SlideInterval);
      $('#SliderView').mouseenter(function () {
        TimerPause = true;
        $('.nmBottom').css('background', 'linear-gradient(to top,rgba(4,4,16,0.75),rgba(4,4,16,0.75),transparent)');
      });
      $('#SliderView').mouseleave(function () {
        TimerPause = false;
        $('.nmBottom').css('background', '0');
      });
      $('.NavBtn').click(function () {
        SelectSlide($(this));
        var navBtnId = $(this).index();
        if (navBtnId + 1 != SlideNow) {
          TranslateWidth = - $('#SliderView').width() * (navBtnId);
          $('#SliderWrapper').css({
            'transform': 'translate(' + TranslateWidth + 'px, 0)',
            '-webkit-transform': 'translate(' + TranslateWidth + 'px, 0)',
            '-ms-transform': 'translate(' + TranslateWidth + 'px, 0)',
          });
          SlideNow = navBtnId + 1;
        }
      });
      var SSlider = 0;
         $(window).trigger('scroll');// trigger image lazy loader
      if (HeightSize != 'auto') {
        SSlider = $('#SliderView').outerHeight(true);
        $('.Sld').each(function (index, value) {
          var HSlide = $(this).find('img').outerHeight(false);
          var RMath = (SSlider - HSlide) / 2;
          $(this).find('img').css('transform', 'translateY(' + RMath + 'px)');
        });
      }
      var BtnCount = $('.NavBtn').length;
      var SBtn = 0;
      if ($('#NavBtns').hasClass('nmLeft')) {
        SSlider = $('#NavBtns').outerHeight(true);
        SBtn = $('#NavBtns li').outerHeight(true);
        if ($('#NavBtns').hasClass('nmP2')) {
          $('#NavBtns li').css('transform', 'translateY(' + (SSlider - SBtn * BtnCount) / 2 + 'px)');
        } else if ($('#NavBtns').hasClass('nmP3')) {
          $('#NavBtns li').css('transform', 'translateY(' + (SSlider - SBtn * BtnCount) + 'px)');
        }
      } else if ($('#NavBtns').hasClass('nmRight')) {
        SSlider = $('#NavBtns').outerHeight(true);
        SBtn = $('#NavBtns li').outerHeight(true);
        if ($('#NavBtns').hasClass('nmP2')) {
          $('#NavBtns li').css('transform', 'translateY(' + (SSlider - SBtn * BtnCount) / 2 + 'px)');
        } else if ($('#NavBtns').hasClass('nmP3')) {
          $('#NavBtns li').css('transform', 'translateY(' + (SSlider - SBtn * BtnCount) + 'px)');
        }
      } else if ($('#NavBtns').hasClass('nmTop')) {
        SSlider = $('#NavBtns').outerWidth(true);
        SBtn = $('#NavBtns li').outerWidth(true);
        if ($('#NavBtns').hasClass('nmP2')) {
          $('#NavBtns li').css('transform', 'translateX(' + (SSlider - SBtn * BtnCount) / 2 + 'px)');
        } else if ($('#NavBtns').hasClass('nmP3')) {
          $('#NavBtns li').css('transform', 'translateX(' + (SSlider - SBtn * BtnCount) + 'px)');
        }
      } else if ($('#NavBtns').hasClass('nmBottom')) {
        SSlider = $('#NavBtns').outerWidth(true);
        SBtn = $('#NavBtns li').outerWidth(true);
        if ($('#NavBtns').hasClass('nmP2')) {
          $('#NavBtns li').css('transform', 'translateX(' + (SSlider - SBtn * BtnCount) / 2 + 'px)');
        } else if ($('#NavBtns').hasClass('nmP3')) {
          $('#NavBtns li').css('transform', 'translateX(' + (SSlider - SBtn * BtnCount) + 'px)');
        }
      }
    });
    function NextSlide() {
      if (SlideNow == SlideCount || SlideNow <= 0 || SlideNow > SlideCount) {
        $('#SliderWrapper').css('transform', 'translate(0, 0)');
        SlideNow = 1;
      } else {
        TranslateWidth = - $('#SliderView').width() * (SlideNow);
        $('#SliderWrapper').css({
          'transform': 'translate(' + TranslateWidth + 'px, 0)',
          '-webkit-transform': 'translate(' + TranslateWidth + 'px, 0)',
          '-ms-transform': 'translate(' + TranslateWidth + 'px, 0)',
        });
        SlideNow++;
      }
      SelectSlide($('#NavBtns').children().eq(SlideNow - 1));
    }
    function SelectSlide(ActiveBtn) {
        $(window).trigger('scroll');// trigger image lazy loader
      $('.NavBtn').removeClass('nbActiveLeft');
      $('.NavBtn').removeClass('nbActiveRight');
      $('.NavBtn').removeClass('nbActiveTop');
      $('.NavBtn').removeClass('nbActiveBottom');
      if ($('#NavBtns').hasClass('nmRight')) {
        ActiveBtn.addClass('nbActiveRight');
      } else if ($('#NavBtns').hasClass('nmTop')) {
        ActiveBtn.addClass('nbActiveTop');
      } else if ($('#NavBtns').hasClass('nmBottom')) {
        ActiveBtn.addClass('nbActiveBottom');
      } else {
        ActiveBtn.addClass('nbActiveLeft');
      }
    }
}());
Cookies help us deliver our services. By using our services, you agree to our use of cookies.