Like 0

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

chrisburnell revised this gist 4 months ago · bab05f8

1 file changed, 18 insertions

tampermonkey-pixelate-88x31s.js (file created)
@@ -0,0 +1,18 @@
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 + });