Last active 3 months ago

For the Tampermonkey browser extension: applies `image-rendering: pixelated` CSS to images whose width and height are 88 and 31 respectively.

tampermonkey-pixelate-88x31s.js Raw
1// ==UserScript==
2// @name Pixelate 88x31s
3// @version 1.0.0
4// @namespace https://chrisburnell.com/
5// @author Chris Burnell
6// @match *://*/*
7// @run-at document-idle
8// @grant none
9// ==/UserScript==
10
11[...document.querySelectorAll("img")].forEach((img) => {
12 const apply = () => {
13 if (img.naturalWidth === 88 && img.naturalHeight === 31) {
14 img.style.imageRendering = "pixelated";
15 }
16 };
17 img.complete ? apply() : img.addEventListener("load", apply);
18});