1(() => { 2 const hideReasons = new Set(); 3 let styleElement = null; 4 5 const updateHideCSS = () => { 6 if (hideReasons.size > 0) { 7 if (!styleElement) { 8 styleElement = document.createElement('style'); 9 document.head.appendChild(styleElement); 10 } 11 styleElement.textContent = 'div[class*="-vip"] { visibility: hidden !important; }'; 12 } else if (styleElement) { 13 styleElement.remove(); 14 styleElement = null; 15 } 16 }; 17 18 const addHideSHReason = (reason) => { 19 if (!hideReasons.has(reason)) { 20 hideReasons.add(reason); 21 updateHideCSS(); 22 } 23 }; 24 25 const removeHideSHReason = (reason) => { 26 if (hideReasons.delete(reason)) { 27 updateHideCSS(); 28 } 29 }; 30 31 window.addHideSHReason = addHideSHReason; 32 window.removeHideSHReason = removeHideSHReason; 33 window.debugHideSHReasons = () => { 34 console.log('Hide reasons:', Array.from(hideReasons)); 35 } 36 37 let hasUserScrolled = false; 38 let scrollInterval = null; 39 40 const onFirstUserScroll = () => { 41 hasUserScrolled = true; 42 if (scrollInterval !== null) { 43 clearInterval(scrollInterval); 44 scrollInterval = null; 45 } 46 window.removeEventListener('scroll', onFirstUserScroll); 47 }; 48 49 // document.addEventListener('DOMContentLoaded', () => { 50 // document.addEventListener('scroll', checkSHScrollVisibility); 51 // scrollInterval = setInterval(() => { 52 // if (!hasUserScrolled) { 53 // checkSHScrollVisibility(); 54 // } 55 // }, 50); 56 57 // window.addEventListener('scroll', onFirstUserScroll, { once: true }); 58 // }); 59})(); 60 61const checkSHScrollVisibility = () => { 62 const mainContent = document.querySelector('.sh-content-box'); 63 const playerElement = document.querySelector('div[id^="vr-"][id$="-wrapper"]'); 64 65 if (playerElement) { 66 const playerRect = playerElement.getBoundingClientRect(); 67 if (playerRect.top < 0) { 68 removeHideSHReason('above-player'); 69 } else { 70 addHideSHReason('above-player'); 71 } 72 } 73 74 if (!mainContent) { 75 return; 76 } 77 78 const contentRect = mainContent.getBoundingClientRect(); 79 80 if (mainContent) { 81 if (contentRect.top < 0) { 82 removeHideSHReason('above-content'); 83 } else { 84 addHideSHReason('above-content'); 85 } 86 } 87 88 if (mainContent) { 89 if (contentRect.bottom - window.innerHeight < 0) { 90 addHideSHReason('below-content'); 91 } else { 92 removeHideSHReason('below-content'); 93 } 94 } 95}
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.