PageSourceSearch

https://www.arbetarbladet.se/assets/rev/js/slideshow-module-AYV66GYA.js

js arbetarbladet.se collected 2026-10-02 05:17:28 UTC 7,123 bytes, 2 lines download raw bytes

1import{b as n,c as h}from"./chunk-KLSLXA54.js";import"./chunk-6KHOHYTW.js";var l=class{constructor(t){this.element=t,this.visibleSlides=new Set,this.visibleDots=new Set,this.dotTranslation=0,this._init()}_init(){let t=this.element.querySelectorAll("template");if(!t)throw new Error("No template found");if(t.forEach(s=>this.element.appendChild(s.content.cloneNode(!0))),this.prevButton=this.element.querySelector(".icon-button.left"),this.nextButton=this.element.querySelector(".icon-button.right"),(n||h)&&(this.prevButton.style.display="none",this.prevButton.style.visibility="hidden",this.nextButton.style.display="none",this.nextButton.style.visibility="hidden"),this.navigationDotsContainer=this.element.querySelector(".slideshow__pagination"),this.navigationDotsList=this.element.querySelector(".slideshow__pagination--list"),this.navigationDots=Array.from(this.element.querySelectorAll(".slideshow__dot")),this.lastDotIndex=this.navigationDots.length-1,this.firstDotIndex=0,this._initNavigationDots(),"IntersectionObserver"in window){let s=new IntersectionObserver(this._handleDotVisibility.bind(this),{root:this.navigationDotsContainer,threshold:.1});this.navigationDots.forEach(i=>s.observe(i))}if(this.slidesContainer=this.element.querySelector(".slideshow__items"),this.slidesContainer.setAttribute("tabindex","-1"),!this.slidesContainer)throw new Error("No slides container found");if(this.slides=this.slidesContainer.querySelectorAll(".slideshow__item"),"IntersectionObserver"in window){let s=new IntersectionObserver(this._handleSlideVisibility.bind(this),{root:this.slidesContainer,threshold:[.49,.51]});this.slides.forEach(i=>s.observe(i))}this.element.addEventListener("click",this._handleClick.bind(this)),this.element.classList.add("slideshow--active"),this._addLiveRegion(),this.liveRegionText=((window.lclClientConfig||{}).language||{}).slideshow_sr_item}_prevSlide(){this.slidesContainer&&(this.slidesContainer.scrollLeft-=this.slidesContainer.offsetWidth)}_nextSlide(){this.slidesContainer&&(this.slidesContainer.scrollLeft+=this.slidesContainer.offsetWidth)}_addLiveRegion(){let t=document.createElement("div");t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("class","sr-only"),this.element.appendChild(t),this.liveRegion=t}_setLiveRegionText(t){this.liveRegion&&(this.liveRegion.textContent=this.liveRegionText.replace("%{index}",t+1).replace("%{total}",this.slides.length))}_handleDotVisibility(t){t.forEach(s=>{let{target:i,isIntersecting:o}=s;o?(this.visibleDots.add(i),i instanceof HTMLElement&&(i.style.visibility="visible")):(this.visibleDots.delete(i),i instanceof HTMLElement&&(i.style.visibility="hidden"))})}_handleSlideVisibility(t){t.forEach(s=>{let{target:i,isIntersecting:o,intersectionRatio:a}=s,r=a>0&&a<1;if(a===0){i.querySelector("a").setAttribute("tabindex","-1"),i.querySelector("a").setAttribute("aria-hidden","true");return}if(o){this.visibleSlides.add(i),i.classList.add("slideshow__item--visible"),i.querySelector("a").setAttribute("tabindex","0"),i.querySelector("a").setAttribute("aria-hidden","false");let e=Array.from(this.slides).indexOf(i);r&&this._setLiveRegionText(e),this._updateActiveDot(e,!0)}else{this.visibleSlides.delete(i),i.classList.remove("slideshow__item--visible"),i.querySelector("a").setAttribute("tabindex","-1"),i.querySelector("a").setAttribute("aria-hidden","true");let e=Array.from(this.slides).indexOf(i);this._updateActiveDot(e,!1)}this._updateButtonStates()})}_updateButtonStates(){if(!(this.slidesContainer&&this.slides&&this.slides.length>0))return;let t=this.slides[0];this.prevButton&&(this.prevButton.setAttribute("aria-disabled",this.visibleSlides.has(t)?"true":"false"),this.prevButton.setAttribute("tabindex",this.visibleSlides.has(t)?"-1":"0"));let s=Array.from(this.slides).at(-1);this.nextButton&&(this.nextButton.setAttribute("aria-disabled",this.visibleSlides.has(s)?"true":"false"),this.nextButton.setAttribute("tabindex",this.visibleSlides.has(s)?"-1":"0"))}_handleClick(t){if(t.type!=="click"||!(t.target instanceof Element))return;let{target:s}=t,i=s&&s.closest(".icon-button");i&&(i.matches(".icon-button.right")?this._nextSlide():i.matches(".icon-button.left")?this._prevSlide():i.matches(".icon-button.maximize")&&this._openLightbox())}_initNavigationDots(){this._updateNavigationDotsLocation(),addEventListener("resize",this._updateNavigationDotsLocation.bind(this)),this.navigationDots.length>5&&(this.navigationDots[4].classList.add("slideshow__dot--small"),this.navigationDots[5].closest(".slideshow__pagination--item").
1classList.add("slideshow__pagination--item--right"))}_updateNavigationDotsLocation(){let t=this.element.querySelector(".slideshow__item img");this.navigationDotsContainer.style.top=`${t.offsetHeight-(window.innerWidth<=768?12:24)}px`,this.prevButton.style.top=`${t.offsetHeight/2}px`,this.nextButton.style.top=`${t.offsetHeight/2}px`}_updateActiveDot(t,s){s?(this.navigationDots[t]&&this._dotClassUpdate(t,!0,"active"),t!==this.lastDotIndex&&this.navigationDots[t].classList.contains("slideshow__dot--small")&&this.navigationDots[t+1].closest(".slideshow__pagination--item").classList.contains("slideshow__pagination--item--right")?(this._dotClassUpdate(t,!1,"small"),this._dotClassUpdate(t+1,!1,"right"),this._dotClassUpdate(t+1,!1,"left"),t+1!==this.lastDotIndex&&this._dotClassUpdate(t+1,!0,"small"),this.navigationDots[t+2]&&this._dotClassUpdate(t+2,!0,"right"),this._shiftDotsContainer("right"),t-3!==this.firstDotIndex&&(this._dotClassUpdate(t-3,!0,"small"),this.navigationDots[t-4]!==this.firstDotIndex&&(this._dotClassUpdate(t-4,!0,"left"),this._dotClassUpdate(t-4,!1,"right")))):t!==this.firstDotIndex&&this.navigationDots[t].classList.contains("slideshow__dot--small")&&this.navigationDots[t-1].closest(".slideshow__pagination--item").classList.contains("slideshow__pagination--item--left")&&(this._dotClassUpdate(t,!1,"small"),this._dotClassUpdate(t-1,!1,"right"),this._dotClassUpdate(t-1,!1,"left"),t-1!==this.firstDotIndex&&this._dotClassUpdate(t-1,!0,"small"),this.navigationDots[t-2]&&this._dotClassUpdate(t-2,!1,"right"),this._shiftDotsContainer("left"),t+3!==this.lastDotIndex&&(this._dotClassUpdate(t+3,!0,"small"),this.navigationDots[t+4]&&(this._dotClassUpdate(t+4,!0,"right"),this._dotClassUpdate(t+4,!1,"left"))))):this.navigationDots[t]&&this.navigationDots[t].classList.remove("slideshow__dot--active")}_dotClassUpdate(t,s,i){switch(i){case"active":this.navigationDots[t].classList.toggle("slideshow__dot--active",s);break;case"small":this.navigationDots[t].classList.toggle("slideshow__dot--small",s);break;case"left":case"right":this.navigationDots[t].closest(".slideshow__pagination--item").classList.toggle(`slideshow__pagination--item--${i}`,s);break;default:break}}_shiftDotsContainer(t){t==="left"?this.dotTranslation+=15:this.dotTranslation-=15,this.navigationDotsList.style.transform=`translateX(${this.dotTranslation}px)`}_openLightbox(){let t=this.element.querySelector(".slideshow__item--visible > .article__figure--slideshow > a");t&&t.click()}};export{l as default};
2//# sourceMappingURL=slideshow-module-AYV66GYA.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.