PageSourceSearch

https://silknlove.com/cdn/shop/t/27/assets/dialog.js?v=31488105910410608131762623937

js silknlove.com collected 2026-10-08 17:31:12 UTC 2,744 bytes, 12 lines download raw bytes

1import{Component}from '@theme/component';import{debounce,isClickedOutside,onAnimationEnd}from '@theme/utilities';export class DialogComponent extends Component{requiredRefs=['dialog'];connectedCallback(){super.connectedCallback();if(this.minWidth||this.maxWidth){window.addEventListener('resize',this.#handleResize)}}
2disconnectedCallback(){super.disconnectedCallback();if(this.minWidth||this.maxWidth){window.removeEventListener('resize',this.#handleResize)}}
3#handleResize=debounce(()=>{const{minWidth,maxWidth}=this;if(!minWidth&&!maxWidth)return;const windowWidth=window.innerWidth;if(windowWidth<minWidth||windowWidth>maxWidth){this.closeDialog()}},50);showDialog(){const{dialog}=this.refs;if(dialog.open)return;document.body.style.width='100%';const scrollY=window.scrollY;document.body.style.position='fixed';document.body.style.top=`-${scrollY}px`;dialog.showModal();this.dispatchEvent(new DialogOpenEvent());setTimeout(()=>{this.addEventListener('click',this.#handleClick);this.addEventListener('keydown',this.#handleKeyDown)})}
4closeDialog=async()=>{const{dialog}=this.refs;if(!dialog.open)return;this.removeEventListener('click',this.#handleClick);this.removeEventListener('keydown',this.#handleKeyDown);dialog.classList.add('dialog-closing');await onAnimationEnd(dialog,undefined,{subtree:!1,});document.body.style.width='';const scrollY=document.body.style.top;document.body.style.position='';document.body.style.top='';window.scrollTo({top:parseInt(scrollY)*-1,behavior:'instant'});dialog.close();dialog.classList.remove('dialog-closing');this.dispatchEvent(new DialogCloseEvent())};toggleDialog=()=>{if(this.refs.dialog.open){this.closeDialog()}else{this.showDialog()}};#handleClick(event){const{dialog}=this.refs;if(isClickedOutside(event,dialog)){this.closeDialog()}}
5#handleKeyDown(event){if(event.key!=='Escape')return;event.preventDefault();this.closeDialog()}
6get minWidth(){return Number(this.getAttribute('dialog-active-min-width'))}
7get maxWidth(){return Number(this.getAttribute('dialog-active-max-width'))}}
8if(!customElements.get('dialog-component'))customElements.define('dialog-component',DialogComponent);export class DialogOpenEvent extends CustomEvent{constructor(){super(DialogOpenEvent.eventName)}
9static eventName='dialog:open'}
10export class DialogCloseEvent extends CustomEvent{constructor(){super(DialogCloseEvent.eventName)}
11static eventName='dialog:close'}
12document.addEventListener('toggle',(event)=>{if(event.target instanceof HTMLDialogElement||event.target instanceof HTMLDetailsElement){if(event.target.hasAttribute('scroll-lock')){const{open}=event.target;if(open){document.documentElement.setAttribute('scroll-lock','')}else{document.documentElement.removeAttribute('scroll-lock')}}}},{capture:!0})

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.