更多操作
删除的内容 添加的内容
imported>Wr 无编辑摘要 |
imported>Wr 小无编辑摘要 |
||
第8行: | 第8行: | ||
})(window, document, "clarity", "script", "aa2p2mnodo"); |
})(window, document, "clarity", "script", "aa2p2mnodo"); |
||
/* CustomSlider.js (From https://dev.fandom.com/wiki/MediaWiki:CustomSlider.js) */ |
|||
/* Slider from Fandom Desktop */ |
|||
(function () { |
|||
/*@nomin*/var exports={};require=window.fandomRequire||require;var index=require("./index-e0f8f548.js"),Slider=function(){function t(t){this.list=null,this.SLIDE_TIMEOUT_MS=7e3,this.sliderWidthPx=670,this.currentImage=0,this.imageCount=0,this.captions={},this.thumbs={},this.slider=t}return t.prototype.lift=function(){return this.list=this.slider.querySelector(".fandom-slider__list"),this.imageCount=this.list?this.list.querySelectorAll(".gallerybox").length:0,this.setSliderWidth(),this.setUpResizeListener(),this.setUpControls(),this.setUpCaptions(),this.setUpThumbsNavigation(),this},t.prototype.andSlide=function(){var t=this;setTimeout((function(){t.scrollToImage(t.getNext()),t.andSlide()}),this.SLIDE_TIMEOUT_MS)},t.prototype.scrollToImage=function(t){this.list&&(this.list.style.margin="0 0 0 -".concat(t*this.sliderWidthPx,"px"),this.setCurrentCaption(t),this.setCurrentThumb(t),this.currentImage=t)},t.prototype.getNext=function(){return this.currentImage===this.imageCount-1?0:this.currentImage+1},t.prototype.getPrev=function(){return 0===this.currentImage?this.imageCount-1:this.currentImage-1},t.prototype.setUpCaptions=function(){var t=this;this.slider.querySelectorAll(".fandom-slider__nav__caption > div").forEach((function(e){var i=e.getAttribute("data-index");i&&(t.captions[i]=e)})),this.setCurrentCaption(this.currentImage)},t.prototype.setCurrentCaption=function(t){this.captions[this.currentImage].style.display="none",this.captions[this.currentImage].style.opacity="0",this.captions[t].style.display="block",this.captions[t].style.opacity="1"},t.prototype.setCurrentThumb=function(t){this.thumbs[this.currentImage].classList.remove("current-thumb"),this.thumbs[t].classList.add("current-thumb")},t.prototype.setUpControls=function(){var t=this,e=this.slider.querySelector(".fandom-slider__controls__next"),i=this.slider.querySelector(".fandom-slider__controls__prev");i&&e&&(e.addEventListener("click",(function(){return t.scrollToImage(t.getNext())})),i.addEventListener("click",(function(){return t.scrollToImage(t.getPrev())})))},t.prototype.setUpThumbsNavigation=function(){var t=this,e=this.slider.querySelectorAll(".fandom-slider__nav__thumbs > div");e&&(e.forEach((function(e){var i=e.getAttribute("data-index");i&&(t.thumbs[i]=e,e.addEventListener("click",(function(){return t.scrollToImage(parseInt(i))})))})),this.setCurrentThumb(this.currentImage))},t.prototype.setUpResizeListener=function(){var t=this;window.addEventListener("resize",index.debounce(600,(function(){return t.setSliderWidth()})))},t.prototype.setSliderWidth=function(){var t,e,i,s=this,r=null===(t=this.list)||void 0===t?void 0:t.querySelectorAll(".gallerybox");if(this.slider.closest("table")){var n=null===(i=null===(e=this.slider.closest("table"))||void 0===e?void 0:e.parentElement)||void 0===i?void 0:i.offsetWidth;if(!n)return;this.slider.style.width=n+"px"}this.list&&r&&this.slider.offsetWidth>0&&(this.sliderWidthPx=this.slider.offsetWidth,this.list.style.width=this.sliderWidthPx*this.imageCount+"px",this.list.style.margin="0 0 0 -".concat(this.currentImage*this.sliderWidthPx,"px"),r.forEach((function(t){t.style.width=s.sliderWidthPx+"px"})))},t}();document.querySelectorAll(".fandom-slider").forEach((function(t){return new Slider(t).lift().andSlide()})),module.exports=exports; |
|||
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; |
|||
}); |
|||
$('#SliderView').mouseleave(function () { |
|||
TimerPause = false; |
|||
}); |
|||
$('.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'); |
|||
} |
|||
} |
|||
}()); |
2022年1月22日 (六) 10:33的版本
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
/* Clarity tracking code for https://sonicpedia.org/ */
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i+"?ref=bwt";
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "aa2p2mnodo");
/* CustomSlider.js (From https://dev.fandom.com/wiki/MediaWiki:CustomSlider.js) */
(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;
});
$('#SliderView').mouseleave(function () {
TimerPause = false;
});
$('.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');
}
}
}());