-
-
Save TechPriest/53a112775ac7f4a521b7863d41f3c13a to your computer and use it in GitHub Desktop.
~ Spoof the reported window.screen as the most common one so that it can't be used to fingerprint browser.
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
| // ==UserScript== | |
| // @name Spoof screen resolution & color depth | |
| // @namespace https://skyzohlabs.be | |
| // @version 1.0.5 | |
| // @description Spoof the reported window.screen to fix GFN on ultrawide monitor | |
| // @author SkyzohKey | |
| // @include https://play.geforcenow.com/* | |
| // @run-at document-end | |
| // @grant none | |
| // @downloadURL https://gist.github.com/TechPriest/53a112775ac7f4a521b7863d41f3c13a/raw/screen-spoofer.user.js | |
| // @updateURL https://gist.github.com/TechPriest/53a112775ac7f4a521b7863d41f3c13a/raw/screen-spoofer.user.js | |
| // ==/UserScript== | |
| (function() { | |
| "use strict"; | |
| /** | |
| * Define property on an object. | |
| */ | |
| var defineProp = function(obj, prop, val) { | |
| Object.defineProperty(obj, prop, { | |
| enumerable: true, | |
| configurable: true, | |
| value: val | |
| }); | |
| }; | |
| /** | |
| * Return screen attributes based on the most commons ones. | |
| */ | |
| var getScreenAttrs = function() { | |
| return { | |
| width: 1440, | |
| height: 900, | |
| colorDepth: 24, | |
| pixelDepth: 24 | |
| }; | |
| }; | |
| /** | |
| * Spoof screen resolution. | |
| */ | |
| var spoofScreenResolution = function() { | |
| var screen = getScreenAttrs(); | |
| defineProp(window.screen, "width", screen.width); | |
| defineProp(window.screen, "height", screen.height); | |
| defineProp(window.screen, "availWidth", screen.width); | |
| defineProp(window.screen, "availHeight", screen.height); | |
| defineProp(window.screen, "top", 0); | |
| defineProp(window.screen, "left", 0); | |
| defineProp(window.screen, "availTop", 0); | |
| defineProp(window.screen, "availLeft", 0); | |
| defineProp(window.screen, "colorDepth", screen.colorDepth); | |
| defineProp(window.screen, "pixelDepth", screen.pixelDepth); | |
| /** | |
| * @todo Implement window.innerHeight, window.innerWidth, etc... | |
| * @see https://developer.mozilla.org/en-US/docs/Web/API/Screen | |
| */ | |
| }; | |
| /** | |
| * Initialize script | |
| */ | |
| var init = function() { | |
| // LET SPOOF THAT FUCKIN' RES/COLOR DEPTH | |
| spoofScreenResolution(); | |
| }; | |
| init(); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment