From 8ad45503d05cce7bdc0d9354de3d8daac45ffc2b Mon Sep 17 00:00:00 2001 From: Lily-129 <68935009+Lily-129@users.noreply.github.com> Date: Thu, 21 Apr 2022 11:25:53 -0400 Subject: [PATCH] A mod that lets you adjust pixelSize by putting the pixelSize parameter in the query string. > The "pixelSize" query parameter sets the size of the pixels; this is inversely proportional to the pixel "resolution", so bigger numbers mean less pixels fit on the screen and smaller numbers mean that more pixels will fit. > Depending on your screen's size, the default pixelSize is either 5 or 6 (6 on larger screens). > Making the pixels twice as big will decrease the pixel capacity by *slightly over* 4, and the reverse is also true. (I don't know why that is.) --- mods/adjustablepixelsize.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 mods/adjustablepixelsize.js diff --git a/mods/adjustablepixelsize.js b/mods/adjustablepixelsize.js new file mode 100644 index 00000000..68bcb163 --- /dev/null +++ b/mods/adjustablepixelsize.js @@ -0,0 +1,26 @@ +//The "pixelSize" query parameter sets the size of the pixels; this is inversely proportional to the pixel "resolution", so bigger numbers mean less pixels fit on the screen and smaller numbers mean that more pixels will fit. +//Depending on your screen's size, the default pixelSize is either 5 or 6 (6 on larger screens). +//Making the pixels twice as big will decrease the pixel capacity by *slightly over* 4, and the reverse is also true. (I don't know why that is.) + +urlParams = new URLSearchParams(window.location.search); + +if(urlParams.get('pixelSize') != null) { //null check + pixelSize = urlParams.get('pixelSize') + if(isNaN(pixelSize) || pixelSize === "" || pixelSize === null) { //NaN check + // Vanilla code: If the screen size is under 768px, set pixelSize to 5, otherwise 6 + if (window.innerWidth < 700) { + pixelSize = 5; + } else { + pixelSize = 6; + } + } + pixelSize = parseFloat(pixelSize) + pixelSize = Math.min(300,Math.max(pixelSize,0.00001)) +} else { + // Vanilla code: If the screen size is under 768px, set pixelSize to 5, otherwise 6 + if (window.innerWidth < 700) { + pixelSize = 5; + } else { + pixelSize = 6; + } +} \ No newline at end of file