Created
December 25, 2023 18:20
-
-
Save achrafl0/079ed803d83c6c1736481ce5364073fb to your computer and use it in GitHub Desktop.
Intrusive javascript blocker example ( TamperMonkey )
This file contains 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
// ==UserScript== | |
// @name intrusive blocker | |
// @namespace http://tampermonkey.net/ | |
// @version 2023-12-25 | |
// @description block intrusive javascript | |
// @author Achraf | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=0.1 | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
window.screenX = 0; | |
window.screenY = 0; | |
const overridenProperties = { | |
availHeight: 0, | |
availWidth: 0, | |
pixelDepth: 10, | |
}; | |
const screenProxy = new Proxy(window.screen, { | |
get(screen, propertyName) { | |
return overridenProperties[propertyName] ?? screen[propertyName]; | |
}, | |
}); | |
window.screen = screenProxy; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment