Last active
November 11, 2025 06:45
-
-
Save padi/f19be00b5854397df8baaf8b7dd30dfa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const websitesWithScrollDisabled = ['shopee.ph'] | |
| if (websitesWithScrollDisabled.includes(window.location.hostname)) { | |
| document.addEventListener('DOMContentLoaded', function() { | |
| console.log('================ reenabling scroll ==========='); | |
| document.querySelector('body').removeAttribute('style'); | |
| }, 1000); // 1000ms = 1 second delay | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const websitesWithScrollDisabled = ['shopee.ph'] | |
| window.asdf = 'asdf'; | |
| console.log('=========================== LOADING =============================================================================================================================================='); | |
| if (websitesWithScrollDisabled.includes(window.location.hostname)) { | |
| function checkAndRemoveStyle() { | |
| const body = document.querySelector('body'); | |
| if (body && (body.style.overflow === 'hidden' || body.getAttribute('style')?.includes('overflow:hidden'))) { | |
| body.removeAttribute('style'); | |
| } | |
| } | |
| // Create observer for style attribute changes | |
| const observer = new MutationObserver(function(mutations) { | |
| mutations.forEach(function(mutation) { | |
| if (mutation.type === 'attributes' && mutation.attributeName === 'style') { | |
| checkAndRemoveStyle(); | |
| } | |
| }); | |
| }); | |
| // Start observing once body is available | |
| if (document.readyState === 'loading') { | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const body = document.querySelector('body'); | |
| if (body) { | |
| observer.observe(body, { | |
| attributes: true, | |
| attributeFilter: ['style'] | |
| }); | |
| checkAndRemoveStyle(); | |
| } | |
| }); | |
| } else { | |
| const body = document.querySelector('body'); | |
| if (body) { | |
| observer.observe(body, { | |
| attributes: true, | |
| attributeFilter: ['style'] | |
| }); | |
| checkAndRemoveStyle(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment