NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Bitcointalk Highlighter
// @version 0.1
// @description Highlight new threads
// @author Ideo
// @match https://bitcointalk.org/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant none
// @copyright 2018+, Ideo
// @license MIT
// ==/UserScript==
(function () {
'use strict';
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) {
return;
}
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css.replace(/;/g, ' !important;');
head.appendChild(style);
}
addGlobalStyle('#old {background-color:#131313;color:#aaa;}');
var $eles = $('[id^="pages"]');
var DOMeles = $eles.get();
for (var i = 0; i < DOMeles.length; i++) {
try {
var links = DOMeles[i].getElementsByTagName("a");
if (links !== null) {
for (var j = 0; j < links.length; j++) {
if (links[j].text > 10) {
links[j].parentElement.parentElement.setAttribute("id", "old");
break;
}
}
}
}
catch (e) {
alert(i + " - " + e);
}
}
function setCssTextStyle(el, style, value) {
var result = el.style.cssText.match(new RegExp("(?:[;\\s]|^)(" +
style.replace("-", "\\-") + "\\s*:(.*?)(;|$))")),
idx;
if (result) {
idx = result.index + result[0].indexOf(result[1]);
el.style.cssText = el.style.cssText.substring(0, idx) +
style + ": " + value + ";" +
el.style.cssText.substring(idx + result[1].length);
}
else {
el.style.cssText += " " + style + ": " + value + ";";
}
}
})();