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.)
This commit is contained in:
Lily-129 2022-04-21 11:25:53 -04:00 committed by GitHub
parent 05260d659f
commit 8ad45503d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -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;
}
}