// ==UserScript== // @name Nofollow display // @description Styles nofollow links with a pink background // @include * // ==/UserScript== (function () { var re = /nofollow/i; var candidates = document.getElementsByTagName("a"); for (var cand = null, i = 0; (cand = candidates[i]); i++) { if (re.test(cand.getAttribute("rel"))) { theStyle = cand.getAttribute("style"); if(theStyle == null) { theStyle = ""; } theStyle += ";font-weight:normal; background-color: pink; color: #000; border: 0; text-decoration: underline;"; cand.setAttribute("style",theStyle); var imgs = cand.getElementsByTagName("img") if (imgs.length > 0) { for (var j = 0; j < imgs.length; j++) { imgStyle = imgs[j].getAttribute("style"); if(imgStyle == null) { imgStyle = ""; } imgStyle += ";border-color: pink; border-style: solid; border-width: 0 0 2px 0;"; imgs[j].setAttribute("style",imgStyle); } } } } })();