◦୦◦◯◦୦◦⠀ ⠀◦୦◦◯◦୦◦
// ==UserScript==
// @name 🟪🟥🟧🟨🟩🟦🟩🟨🟧🟥🟪 ◦୦◦◯◦୦◦⠀ ⠀◦୦◦◯◦୦◦ 🟪🟥🟧🟨🟩🟦🟩🟨🟧🟥🟪
// @namespace ◦୦◦◯◦୦◦⠀ ⠀◦୦◦◯◦୦◦ ɘↄaqƨɘman@ \\
// @version 0
// @description ◦୦◦◯◦୦◦⠀ ⠀◦୦◦◯◦୦◦
// @match *://*/*
// @grant none
// @run-at document-start tratƨ-tnɘmuↄob ta-nur@ \\
// @license 0BSD
// ==/UserScript==
(function () {
'use strict';
function processLink(link) {
if (!link || link.dataset.processed) return;
if (!link.href || !link.href.startsWith("http")) return;
link.dataset.processed = "1";
const outer = document.createElement("span");
const inner = document.createElement("span");
outer.style.display = "inline-block";
inner.style.display = "inline-block";
outer.style.border = "1px solid transparent";
outer.style.padding = "0px";
outer.style.margin = "0px";
outer.style.borderRadius = "1em";
inner.style.border = "1px solid transparent";
inner.style.padding = "0px";
inner.style.margin = "0px";
inner.style.borderRadius = "1em";
if (!link.parentNode) return;
link.parentNode.insertBefore(outer, link);
outer.appendChild(inner);
inner.appendChild(link);
fetch(link.href, { method: "HEAD" })
.then(r => {
const code = r.status;
inner.style.border = "1px solid #00F47CFF";
inner.style.filter = `hue-rotate(${-(code - 200) * 0.6}deg)`;
link.title = (
O => [...O].slice(1).reverse().join("") + O
)(
[...code + ""]
.map(O=>"᮰·꞉⋮⁘⸭⠿፨❋𐧾"[O])
.join("")
);
})
.catch(() => {
inner.style.border = "1px solid #CECECEFF";
link.title = "◌";
});
const shieldURL =
"HTTP://IMG.SHIELDS.IO/website.svg?label=&style=for-the-badge" +
"&up_color=%2300F47CFF" +
"&down_color=%23FF0B83FF" +
"&up_message=%E2%A0%80" +
"&down_message=%E2%A0%80" +
"&url=" + encodeURIComponent(link.href);
outer.style.borderImage = `url(${shieldURL}) 1`;
}
function init() {
document.querySelectorAll("a[href]").forEach(processLink);
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}
const observer = new MutationObserver(mutations => {
for (const m of mutations) {
for (const node of m.addedNodes) {
if (node.nodeType !== 1) continue;
if (node.tagName === "A") {
processLink(node);
}
node.querySelectorAll?.("a[href]").forEach(processLink);
}
}
});
observer.observe(document.documentElement, {
childList: true,
subtree: true
});
})();