1var VALID_CLASSNAME=/^[_a-zA-Z\- ]*$/ 2var constructCssPath=el=>{if(!(el instanceof Element))return 3let path=[] 4while(el.nodeType===Node.ELEMENT_NODE){let selector=el.nodeName.toLowerCase() 5if(el.id){selector+=`#${el.id}` 6path.unshift(selector) 7break}else if(el.className&&VALID_CLASSNAME.test(el.className)){selector+=`.${(el.className.trim()).replace(/\s+/g, '.')}`}else{let sib=el,nth=1 8while((sib=sib.previousElementSibling)){if(sib.nodeName.toLowerCase()==selector)nth++} 9if(nth!=1)selector+=':nth-of-type('+nth+')'} 10path.unshift(selector) 11el=el.parentNode} 12return path.join(' > ')} 13var defaultProps={root:'body',outlineStyle:'5px solid rgba(204, 146, 62, 0.3)',onClick:el=>console.log('Element was clicked:',constructCssPath(el))} 14var Inspector=((props={})=>{const{root,excluded,outlineStyle}={...defaultProps,...props} 15let onClick=props.onClick||defaultProps.onClick 16let selected,excludedElements 17const removeHighlight=el=>{if(el)el.style.outline='none'} 18const highlight=el=>{el.style.outline=outlineStyle 19el.style.outlineOffset=`-${el.style.outlineWidth}`} 20const shouldBeExcluded=ev=>{if(excludedElements&&excludedElements.length&&excludedElements.some(parent=>(parent===ev.target||parent.contains(ev.target)))){return!0}} 21const handleMouseOver=ev=>{if(shouldBeExcluded(ev)){return} 22selected=ev.target 23highlight(selected)} 24const handleMouseOut=ev=>{if(shouldBeExcluded(ev)){return} 25removeHighlight(ev.target)} 26const handleClick=ev=>{if(shouldBeExcluded(ev)){return} 27ev.preventDefault() 28ev.stopPropagation() 29onClick(ev.target) 30return!1} 31const prepareExcluded=(rootEl)=>{if(!excluded.length){return[]} 32const excludedNested=excluded.flatMap(element=>{if(typeof element==='string'||element instanceof String){return Array.from(rootEl.querySelectorAll(element))}else if(element instanceof Element){return[element]}else if(element.length>0&&element[0]instanceof Element){return Array.from(element)}}) 33return Array.from(excludedNested).flat()} 34const enable=onClickCallback=>{const rootEl=document.querySelector(root) 35if(!rootEl) 36return 37if(excluded){excludedElements=prepareExcluded(rootEl)} 38rootEl.addEventListener('mouseover',handleMouseOver,!0) 39rootEl.addEventListener('mouseout',handleMouseOut,!0) 40rootEl.addEventListener('click',handleClick,!0) 41if(onClickCallback){onClick=onClickCallback}} 42const cancel=()=>{const rootEl=document.querySelector(root) 43if(!rootEl) 44return 45rootEl.removeEventListener('mouseover',handleMouseOver,!0) 46rootEl.removeEventListener('mouseout',handleMouseOut,!0) 47rootEl.removeEventListener('click',handleClick,!0) 48removeHighlight(selected)} 49return{enable,cancel}}) 50window.classStack=[] 51function processStack(){classStack.forEach(element=>{document.head.removeChild(element)});classStack.forEach(element=>{document.head.appendChild(element)})} 52var inspector=Inspector({onClick:(el)=>{console.log(el) 53const styleElement=document.createElement('style');var css="."+Array.from(el.classList).join(".")+"{display:none!important}" 54styleElement.textContent=css;window.classStack.push(styleElement) 55document.head.appendChild(styleElement) 56window.parent.postMessage("removed")}}) 57window.inspector=inspector 58;
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.