Add TheVerge paywall remover user script
This commit is contained in:
60
script/theverge-paywall-remover.user.js
Normal file
60
script/theverge-paywall-remover.user.js
Normal file
@@ -0,0 +1,60 @@
|
||||
// ==UserScript==
|
||||
// @name TheVerge Unlimited Reading
|
||||
// @namespace https://github.com/arg0WAK
|
||||
// @version 2026-04-23
|
||||
// @description Kills paywall overlays and gives you your scroll back on The Verge.
|
||||
// @author github.com/arg0WAK
|
||||
// @match https://www.theverge.com/*
|
||||
// @icon https://www.google.com/s2/favicons?sz=64&domain=theverge.com
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
const forbiddenSelectors = [
|
||||
'.zephr-zone-footer',
|
||||
'.zephr-footer-container',
|
||||
'.zephr-overlay',
|
||||
'#zephr-zone-footer',
|
||||
'#zephr-footer-container',
|
||||
'#zephr-overlay'
|
||||
];
|
||||
|
||||
const isRoot = el =>
|
||||
el === document.body || el === document.documentElement;
|
||||
|
||||
const fixStyles = el => {
|
||||
if (!isRoot(el)) return;
|
||||
|
||||
const s = getComputedStyle(el);
|
||||
|
||||
if (s.overflow === 'hidden') {
|
||||
el.style.setProperty('overflow', 'unset', 'important');
|
||||
}
|
||||
|
||||
if (s.position === 'fixed') {
|
||||
el.style.cssText += `
|
||||
position:unset !important;
|
||||
padding:0 !important;
|
||||
top:unset !important;
|
||||
`;
|
||||
}
|
||||
};
|
||||
|
||||
const clean = () =>
|
||||
forbiddenSelectors.forEach(sel =>
|
||||
document.querySelectorAll(sel).forEach(el => el.remove())
|
||||
);
|
||||
|
||||
new MutationObserver(muts => {
|
||||
muts.forEach(m => {
|
||||
if (m.type === 'attributes') fixStyles(m.target);
|
||||
if (m.type === 'childList') clean();
|
||||
});
|
||||
}).observe(document, {
|
||||
subtree: true,
|
||||
childList: true,
|
||||
attributes: true,
|
||||
attributeFilter: ['style']
|
||||
});
|
||||
|
||||
[document.body, document.documentElement].forEach(fixStyles);
|
||||
clean();
|
||||
Reference in New Issue
Block a user