Created
January 8, 2025 01:12
-
-
Save arthuredelstein/0f26551a178fdc1205b7e6c9c31e6beb to your computer and use it in GitHub Desktop.
spoofing screen sizes user script
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 screen | |
// @namespace http://tampermonkey.net/ | |
// @version 2025-01-03 | |
// @description try to take over the world! | |
// @author Arthur Edelstein, Brave | |
// @match *://*/* | |
// @grant none | |
// @run-at document-start | |
// ==/UserScript== | |
const n = 16; | |
// mostly from https://gs.statcounter.com/screen-resolution-stats/desktop/worldwide | |
const resolutions = [ | |
[ 360, 800 ], // no | |
[ 768, 1024 ], // no | |
[ 800, 600 ], // yes | |
[ 810, 1080 ], // no | |
[ 820, 1180 ], // no | |
[ 1024, 768 ], // yes | |
[ 1024, 1366 ], // no | |
[ 1280, 720 ], // no | |
[ 1280, 800 ], // yes | |
[ 1280, 1024 ], // yes | |
[ 1280, 960 ], // no | |
[ 1360, 768 ], // no | |
[ 1366, 768 ], // yes | |
[ 1440, 900 ], // yes | |
[ 1536, 864 ], // yes | |
[ 1600, 900 ], // yes | |
[ 1680, 1050 ], // yes | |
[ 1920, 1080 ], // yes | |
[ 1920, 1200 ], // yes | |
[ 2560, 1440 ], // yes | |
[ 3840, 2160], // no | |
[ 3840, 2400], // no | |
[ 5120, 2880], // no | |
]; | |
(function() { | |
'use strict'; | |
console.log("document.readyState:", document.readyState) | |
const [w, h] = resolutions[n]; | |
Object.defineProperties(Screen.prototype, { | |
width: { | |
value: w | |
}, | |
height: { | |
value: h | |
}, | |
availWidth: { | |
value: w | |
}, | |
availHeight: { | |
value: h | |
} | |
}) | |
console.log(`res ${n}: ${screen.width}x${screen.height}`) | |
document.addEventListener("DOMContentLoaded", () => { | |
const div = document.createElement('div') | |
div.style.position = 'fixed' | |
div.style.bottom = 0; | |
div.style.left = 0; | |
div.style.zIndex = 100; | |
div.style.border = "1px black solid"; | |
div.style.padding = "4px"; | |
div.style.margin = "4px"; | |
div.style.borderRadius = "4px"; | |
div.style.backgroundColor = "white"; | |
div.innerHTML = `${screen.width}x${screen.height}` | |
div.style.width = "initial"; | |
document.body.appendChild(div) | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment