Difference between revisions of "User:JeevesMkII/monobook.js"
Jump to navigation
Jump to search
JeevesMkII (talk | contribs) m (this time?) |
JeevesMkII (talk | contribs) (fix code to away crappy wigos in the new format, each vote with its own table for some bizarre reason) |
||
Line 14: | Line 14: | ||
function awayCrappyWigos() { | function awayCrappyWigos() { | ||
− | var divs = document.getElementsByTagName(" | + | var divs = document.getElementsByTagName("span"); |
for (var i = 0; i < divs.length; ++i) { | for (var i = 0; i < divs.length; ++i) { | ||
if (divs[i].id.substring(0, 4) == "wigo") { | if (divs[i].id.substring(0, 4) == "wigo") { | ||
var voteCount = parseInt(divs[i].innerHTML); | var voteCount = parseInt(divs[i].innerHTML); | ||
− | // traverse up the tree | + | // traverse up the tree four times, and check we've hit the table |
− | var row = divs[i].parentNode.parentNode.parentNode; | + | var row = divs[i].parentNode.parentNode.parentNode.parentNode; |
− | if (row.tagName == " | + | if (row.tagName == "TABLE" && voteCount <= wigoThreshold) { |
row.style.display = "none"; | row.style.display = "none"; | ||
} | } |
Revision as of 10:27, 28 April 2009
/*function awayPeskyFloatingBox() {
var divs = document.getElementsByTagName("div");
for (var i = 0; i < divs.length; ++i) {
if (hasClass(divs[i], "plainlinks")) {
divs[i].style.display = "none";
}
}
}
addOnloadHook(awayPeskyFloatingBox);
*/
var wigoThreshold = -5;
function awayCrappyWigos() {
var divs = document.getElementsByTagName("span");
for (var i = 0; i < divs.length; ++i) {
if (divs[i].id.substring(0, 4) == "wigo") {
var voteCount = parseInt(divs[i].innerHTML);
// traverse up the tree four times, and check we've hit the table
var row = divs[i].parentNode.parentNode.parentNode.parentNode;
if (row.tagName == "TABLE" && voteCount <= wigoThreshold) {
row.style.display = "none";
}
}
}
}
addOnloadHook(awayCrappyWigos);