更多操作
imported>Wr 无编辑摘要 |
imported>Wr 无编辑摘要 |
(没有差异)
|
2022年1月22日 (六) 10:27的版本
/* 这里的任何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");
/* Slider from Fandom Desktop */
/*@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;