PageSourceSearch

https://denform.dk/cdn/shop/t/23/assets/card-countdown.js?v=143068501753543855841791397715

js denform.dk collected 2026-10-09 00:47:27 UTC 1,901 bytes, 2 lines download raw bytes

1import{Component}from"@theme/component";class CardCountdown extends Component{static UNITS=["days","hours","minutes","seconds"];static MAX_DAYS=99;#interval=null;#digits=new Map;#endDate=NaN;connectedCallback(){if(super.connectedCallback(),this.#endDate=new Date(this.dataset.endDate??"").getTime(),Number.isNaN(this.#endDate)){console.warn("[card-countdown] unparseable end date",this.dataset.endDate),this.#hide();return}for(const unit of CardCountdown.UNITS){const element=this.refs[unit];if(!element){this.#hide();return}element.replaceChildren(),this.#digits.set(unit,[0,1].map(()=>{const span=document.createElement("span"),text=document.createTextNode("0");return span.appendChild(text),element.appendChild(span),text}))}this.#update()&&(this.#interval=setInterval(()=>this.#update(),1e3))}disconnectedCallback(){super.disconnectedCallback(),this.#stop()}#update(){const distance=this.#endDate-Date.now();if(distance<=0)return this.#stop(),this.#hide(),!1;const totalSeconds=Math.floor(distance/1e3);return this.#write("days",Math.min(Math.floor(totalSeconds/86400),CardCountdown.MAX_DAYS)),this.#write("hours",Math.floor(totalSeconds/3600)%24),this.#write("minutes",Math.floor(totalSeconds/60)%60),this.#write("seconds",totalSeconds%60),!0}#write(unit,value){const nodes=this.#digits.get(unit);if(!nodes)return;const padded=value.toString().padStart(2,"0");for(const[index,node]of nodes.entries()){const digit=padded[index]??"0";node.nodeValue!==digit&&(node.nodeValue=digit)}}#hide(){const target=this.closest(".featured-collections-card__countdown")??this;target instanceof HTMLElement&&(target.style.display="none")}#stop(){this.#interval!=null&&(clearInterval(this.#interval),this.#interval=null)}}customElements.get("card-countdown")||customElements.define("card-countdown",CardCountdown);
2//# sourceMappingURL=/cdn/shop/t/23/assets/card-countdown.js.map?v=143068501753543855841791397715

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.