// ==UserScript==
// @name SiteNewAnswersKillzor
// @namespace ilx
// @description Bocks / Enables boards from ILX Site New Answers page
// @include http://www.ilxor.com/ILX/SiteNewAnswersControllerServlet
// ==/UserScript==
// OK, TO MODIFY WHICH BOARDS ARE DISPLAYED *EITHER*
// define DO_NOT_WANT with a list of boards to remove
// OR
// define WANT with a list of boards you want to see
// ONE OR THE OTHER, NOT BOTH
// Examples
// var WANT = ["40", "55"]; - view ILE and ILB *only*
// OR
// var DO_NOT_WANT = ["41", "53"]; - see everything *except* ILM and ILBaseball
// 53 = baseball, 60 = noize
var DO_NOT_WANT = ["53", "60"];
//var WANT = ["40"];
var answers;
//
// get all answers
answers = document.evaluate("//div[@class='thread']/li",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
var re = /boardid=(\d+)/;
//alert("Posts: " + answers.snapshotLength); // acd DEBUG
if (answers.snapshotLength != 0) {
//alert("Posts: " + answers.snapshotLength); // acd DEBUG
for (var i = 0; i < answers.snapshotLength ; i++) {
var thisLink = answers.snapshotItem(i).firstChild;
//alert("ThisLink: " + thisLink); // acd DEBUG
//alert("NodeName: " + thisLink.nodeName); // acd DEBUG
// handle NOTWORKSAFE - extra span inside div li
// beware this code is fragile
var url;
if(thisLink.nodeName == "SPAN" && thisLink.className == "notworksafe") {
//alert("SPAN NodeName: " + thisLink.nodeName); // acd DEBUG
url = thisLink.childNodes[1].search;
} else {
//alert("A NodeName: " + thisLink.nodeName); // acd DEBUG
url = thisLink.search;
}
//alert("Href: " + url); // acd DEBUG
if (typeof url != "undefined") {
matches = url.match(re);
if (matches) {
boardid = matches[1];
//alert(boardid);
if ((typeof WANT != "undefined" && WANT.indexOf(boardid) == -1) || (typeof DO_NOT_WANT != "undefined" && DO_NOT_WANT.indexOf(boardid) != -1)) {
//alert("Blocking " + boardid);
// make board invisible
div = thisLink.parentNode.parentNode;
div.setAttribute('style','display:none');
}
}
}
}
}