Generate bookmarket using this tool.
(function() {
const isNextApp = !!document.getElementById("__next");
function hasUserDefinedCursor(link) {
for (let sheet of document.styleSheets) {
try {
for (let rule of sheet.cssRules) {
if (rule instanceof CSSStyleRule && link.matches(rule.selectorText)) {
if (rule.style.cursor) {
return true;
}
}
}
} catch (e) {
// Catch any potential cross-origin stylesheet access issues
}
}
return false;
}
function processLinks() {
document.querySelectorAll("a[href]").forEach(link => {
const url = link.href;
link.removeAttribute("href");
if (isNextApp) {
link.addEventListener("click", () => window.history.pushState({}, "", url));
} else {
link.addEventListener("click", () => window.location = url);
}
if (!hasUserDefinedCursor(link)) {
link.style.cursor = "pointer";
}
});
}
const observer = new MutationObserver(processLinks);
observer.observe(document.documentElement, { childList: true, subtree: true });
processLinks();
}());