make a tampermonkey script to spoof the canvas size.
- User
make a tampermonkey script to spoof the canvas size.
- Assistant
Certainly! Here's an example of a Tampermonkey script that spoofs the canvas size:
// ==UserScript== // @name Canvas Size Spoofing // @namespace http://tampermonkey.net/ // @version 1.0 // @description Spoofs the canvas size for webpages // @author Your Name // @match http://*/* // @match https://*/* // @grant none // ==/UserScript== (function() { 'use strict'; // Set the desired canvas size const canvasWidth = 800; const canvasHeight = 600; // Get the canvas elements on the page const canvases = document.getElementsByTagName('canvas'); // Spoof the size of each canvas for (let i = 0; i < canvases.length; i++) { const canvas = canvases[i]; canvas.width = canvasWidth; canvas.height = canvasHeight; } })();In this script, we define the desired canvas size using the
canvasWidthandcanvasHeightvariables. The script then finds all<canvas>elements on the page and updates theirwidthandheightattributes to match the desired size.To use this script, you need to install the Tampermonkey extension in your browser. Once installed, create a new script and paste the above code into it. Save the script, and it will automatically run on any webpage you visit, spoofing the canvas size to your specified values.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.