You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
28 KiB
JavaScript
1 line
28 KiB
JavaScript
7 months ago
|
(()=>{var t={1474:(t,e,r)=>{var o,i;void 0===(i="function"==typeof(o=function(){var t="undefined"!=typeof window?window:this,e=t.Glider=function(e,r){var o=this;if(e._glider)return e._glider;if(o.ele=e,o.ele.classList.add("glider"),o.ele._glider=o,o.opt=Object.assign({},{slidesToScroll:1,slidesToShow:1,resizeLock:!0,duration:.5,easing:function(t,e,r,o,i){return o*(e/=i)*e+r}},r),o.animate_id=o.page=o.slide=0,o.arrows={},o._opt=o.opt,o.opt.skipTrack)o.track=o.ele.children[0];else for(o.track=document.createElement("div"),o.ele.appendChild(o.track);1!==o.ele.children.length;)o.track.appendChild(o.ele.children[0]);o.track.classList.add("glider-track"),o.init(),o.resize=o.init.bind(o,!0),o.event(o.ele,"add",{scroll:o.updateControls.bind(o)}),o.event(t,"add",{resize:o.resize})},r=e.prototype;return r.init=function(t,e){var r=this,o=0,i=0;r.slides=r.track.children,[].forEach.call(r.slides,(function(t,e){t.classList.add("glider-slide"),t.setAttribute("data-gslide",e)})),r.containerWidth=r.ele.clientWidth;var n=r.settingsBreakpoint();if(e||(e=n),"auto"===r.opt.slidesToShow||void 0!==r.opt._autoSlide){var s=r.containerWidth/r.opt.itemWidth;r.opt._autoSlide=r.opt.slidesToShow=r.opt.exactWidth?s:Math.max(1,Math.floor(s))}"auto"===r.opt.slidesToScroll&&(r.opt.slidesToScroll=Math.floor(r.opt.slidesToShow)),r.itemWidth=r.opt.exactWidth?r.opt.itemWidth:r.containerWidth/r.opt.slidesToShow,[].forEach.call(r.slides,(function(t){t.style.height="auto",t.style.width=r.itemWidth+"px",o+=r.itemWidth,i=Math.max(t.offsetHeight,i)})),r.track.style.width=o+"px",r.trackWidth=o,r.isDrag=!1,r.preventClick=!1,r.move=!1,r.opt.resizeLock&&r.scrollTo(r.slide*r.itemWidth,0),(n||e)&&(r.bindArrows(),r.buildDots(),r.bindDrag()),r.updateControls(),r.emit(t?"refresh":"loaded")},r.bindDrag=function(){var t=this;t.mouse=t.mouse||t.handleMouse.bind(t);var e=function(){t.mouseDown=void 0,t.ele.classList.remove("drag"),t.isDrag&&(t.preventClick=!0),t.isDrag=!1};const r=function(){t.move=!0};var o={mouseup:e,mouseleave:e,mousedown:function(e){e.preventDefault(),e.stopPropagation(),t.mouseDown=e.clientX,t.ele.classList.add("drag"),t.move=!1,setTimeout(r,300)},touchstart:function(e){t.ele.classList.add("drag"),t.move=!1,setTimeout(r,300)},mousemove:t.mouse,click:function(e){t.preventClick&&t.move&&(e.preventDefault(),e.stopPropagation()),t.preventClick=!1,t.move=!1}};t.ele.classList.toggle("draggable",!0===t.opt.draggable),t.event(t.ele,"remove",o),t.opt.draggable&&t.event(t.ele,"add",o)},r.buildDots=function(){var t=this;if(t.opt.dots){if("string"==typeof t.opt.dots?t.dots=document.querySelector(t.opt.dots):t.dots=t.opt.dots,t.dots){t.dots.innerHTML="",t.dots.setAttribute("role","tablist"),t.dots.classList.add("glider-dots");for(var e=0;e<Math.ceil(t.slides.length/t.opt.slidesToShow);++e){var r=document.createElement("button");r.dataset.index=e,r.setAttribute("aria-label","Page "+(e+1)),r.setAttribute("role","tab"),r.className="glider-dot "+(e?"":"active"),t.event(r,"add",{click:t.scrollItem.bind(t,e,!0)}),t.dots.appendChild(r)}}}else t.dots&&(t.dots.innerHTML="")},r.bindArrows=function(){var t=this;t.opt.arrows?["prev","next"].forEach((function(e){var r=t.opt.arrows[e];r&&("string"==typeof r&&(r=document.querySelector(r)),r&&(r._func=r._func||t.scrollItem.bind(t,e),t.event(r,"remove",{click:r._func}),t.event(r,"add",{click:r._func}),t.arrows[e]=r))})):Object.keys(t.arrows).forEach((function(e){var r=t.arrows[e];t.event(r,"remove",{click:r._func})}))},r.updateControls=function(t){var e=this;t&&!e.opt.scrollPropagate&&t.stopPropagation();var r=e.containerWidth>=e.trackWidth;e.opt.rewind||(e.arrows.prev&&(e.arrows.prev.classList.toggle("disabled",e.ele.scrollLeft<=0||r),e.arrows.prev.setAttribute("aria-disabled",e.arrows.prev.classList.contains("disabled"))),e.arrows.next&&(e.arrows.next.classList.toggle("disabled",Math.ceil(e.ele.scrollLeft+e.containerWidth)>=Math.floor(e.trackWidth)||r),e.arrows.next.setAttribute("aria-disabled",e.arrows.next.classList.contains("disabled")))),e.slide=Math.round(e.ele.scrollLeft/e.itemWidth),e.page=Math.round(e.ele.scrollLeft/e.conta
|