Created
April 1, 2024 16:00
-
-
Save PhilippeVay/d73ad273aac1a8a7eeed0b1720c268fe to your computer and use it in GitHub Desktop.
Readable code of "Isolate images" bookmarklet (from A11y Tools, author Lloydi)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bookmarklet "Isolate images" (unescaped and beautified code below) | |
// It's part of many other (stellar) bookmarklets "A11y Tools" | |
// Author: Lloydi | |
// Source: https://a11y-tools.com/bookmarklets/#isolateimages | |
(function () { | |
'use strict' | |
function isolateImages() { | |
const els = document.querySelectorAll('*'); | |
const page = document.querySelector('body'); | |
console.log("els.length", els.length); | |
Array.from(els).forEach(function (el) { | |
el.style.color = "transparent"; | |
el.style.background = "transparent"; | |
el.style.borderColor = "transparent"; | |
el.style.outline = "transparent"; | |
el.style.fontSize = "1px"; | |
}); | |
page.style.zoom = "50%"; | |
const imgs = document.querySelectorAll('img,[role=img]'); | |
Array.from(imgs).forEach(function (img) { | |
img.style.outline = "10px solid black"; | |
img.style.outlineOffset = "-10px"; | |
}); | |
} | |
isolateImages(); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment