Skip to content

Instantly share code, notes, and snippets.

@achrafl0
Created December 25, 2023 18:20
Show Gist options
  • Save achrafl0/079ed803d83c6c1736481ce5364073fb to your computer and use it in GitHub Desktop.
Save achrafl0/079ed803d83c6c1736481ce5364073fb to your computer and use it in GitHub Desktop.
Intrusive javascript blocker example ( TamperMonkey )
// ==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