Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Disable URL Popup On Link Hover (Experimental)
- // @namespace https://greasyfork.org/en/users/85671-jcunews
- // @version 1.0.1
- // @license AGPLv3
- // @author jcunews
- // @description Reference: https://www.reddit.com/r/operabrowser/comments/im6r5d/why_when_i_hover_over_anything_does_it_show_the/
- // @match *://*/*
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- (() => {
- function delHref(e) {
- e.removeAttribute("href");
- }
- function doclick() {
- this.setAttribute("href", this.dataset.orghref);
- setTimeout(delHref, 100, this);
- }
- function patchLink(a, h, s) {
- if (h = a.getAttribute("href")) {
- s = getComputedStyle(a);
- a.style.color = s.color;
- a.style.cursor = s.cursor;
- a.style.textDecoration = s.textDecoration;
- a.dataset.orghref = h;
- a.removeAttribute("href");
- a.addEventListener("click", doclick, true);
- }
- }
- (new MutationObserver(recs => {
- recs.forEach(rec => {
- rec.addedNodes.forEach(node => {
- if (node.nodeType === Node.ELEMENT_NODE) {
- if (node.tagName === "A") patchLink(node);
- node.querySelectorAll("A").forEach(patchLink);
- }
- });
- });
- })).observe(document, {childList: true, subtree: true});
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement