// ==UserScript== // @name Highlight Much-Favourited Metafilter Comments // @namespace http://rephrase.net/box/user-js/ // @include http://metafilter.com/* // @include http://www.metafilter.com/* // ==/UserScript== (function(){ // Highlight comments favourited more than this many times: var threshold = 9; var exp = '//div[@class="comments"]//a[contains(@href, "/favorited/")]'; var a = document.evaluate(exp, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var match; for(var elm = null, i = 0; (elm = a.snapshotItem(i)); i++) { if (match = elm.firstChild.nodeValue.match(/(\d+) favorites?/)) { if (parseInt(match[1], 10) > threshold) { elm.parentNode.parentNode.style.marginLeft = "65px"; elm.parentNode.parentNode.style.padding = "10px"; elm.parentNode.parentNode.style.backgroundColor = "#1177AA"; } } } }());