Inject CSS style sheet from a given URL into current page
var link = document.createElement("link");
link.href = prompt("Style sheet URI:", "");
link.type = "text/css";
link.rel = "stylesheet";
document.head.appendChild(link);
Check for the current page in the Wayback Machine
window.location = "https://web.archive.org/web/*/" + document.URL
Reveal the unescaped contents of a bookmarklet link (selected by clicking)
window.addEventListener("click", {
handleEvent(event) {
if (event.target instanceof HTMLAnchorElement &&
event.target.href.startsWith("javascript:")) {
event.stopPropagation();
event.preventDefault();
let xi = this.escape(
decodeURIComponent(event.target.href.substr(("javascript:").length))
);
window.history.pushState(null, "unescaped bookmarklet contents");
window.location = (
"javascript:`\x3C!doctype html\x3E\x3Cpre\x3E" + xi + "\x3C/pre\x3E`"
);
}
},
escape(text) {
return encodeURIComponent(
text.replace(new RegExp("[\x3C\x3E\x26\x22]", "g"), function(ch) {
switch (ch) {
case '\x3C': return "\x26lt;";
case '\x3E': return "\x26gt;";
case '\x26': return "\x26amp;";
case '\x22': return "\x26quot;";
}
throw new Error("wat. ch: " + ch);
}).replace(new RegExp("\x5C\x5C", "g"), function() {
return "\\\\";
}).replace(new RegExp("`", "g"), function() {
return "\\`";
})
);
}
}, true);