Skip to content

Instantly share code, notes, and snippets.

@padi
Last active November 11, 2025 06:45
Show Gist options
  • Select an option

  • Save padi/f19be00b5854397df8baaf8b7dd30dfa to your computer and use it in GitHub Desktop.

Select an option

Save padi/f19be00b5854397df8baaf8b7dd30dfa to your computer and use it in GitHub Desktop.
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
}
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