User:Volatile Dweevil/vector.js

window.onload = function { if (!"".indexOf || !"".substring || ![].push) return; if (document.body.className.indexOf("page-Special_RecentChanges") == -1 && document.body.className.indexOf("page-Special_Recentchanges") == -1) return; choice = document.getElementById("namespace").childNodes; nslist = []; for (i in choice) if (choice[i].tagName == "OPTION" && choice[i].value != "") nslist[choice[i].value] = choice[i].innerHTML; loglist = []; enhanced = true; if (document.getElementById("bodyContent").innerHTML.indexOf('Hide grouped recent changes') == -1) enhanced = false; if (enhanced) { h4s = document.getElementsByTagName("h4"); days = []; for (i = 0; i < h4s.length; i++) { days[i] = h4s[i].nextSibling; while (days[i].tagName != "DIV") days[i] = days[i].nextSibling; }       for (i in days) { if (days[i].tagName != "DIV") continue; items = days[i].childNodes; for (j = 0; j < items.length; j++) { if (items[j].tagName != "TABLE") continue; logname = items[j].getElementsByTagName("a"); if (logname[0].getAttribute("href") == "#") logname = logname[2]; else logname = logname[0]; if (logname.nextSibling) if(logname.nextSibling.nodeValue.substring(0, 1) == ")" && loglist.indexOf(logname.innerHTML) == -1) loglist.push(logname.innerHTML);           }        }    } else {        days = document.getElementsByClassName("special");        for (i in days) {            if (days[i].tagName != "UL") continue;            items = days[i].childNodes;            for (j = 0; j < items.length; j++) {                if (items[j].tagName != "LI") continue;                logname = items[j].getElementsByTagName("a")[0].innerHTML;                if (logname != "diff" && logname != "hist" && loglist.indexOf(logname) == -1) loglist.push(logname);            }        }    }    temp = RCNSTList;    RCNSTList = [];    for (i in nslist) {        if (!include && (temp.indexOf(nslist[i]) != -1)) RCNSTList[i] = false;        else if (include && (temp.indexOf(nslist[i])) == -1) RCNSTList[i] = false; }   for (i in loglist) { if (!include && (temp.indexOf(loglist[i]) != -1)) RCNSTList[loglist[i]] = false; else if (include && (temp.indexOf(loglist[i])) == -1) RCNSTList[loglist[i]] = false; }   s = RCNSTbeforecheckboxes; for (i in nslist) { if (RCNSTList[i] == false) insert = ''; else insert = 'checked="checked"'; s += RCNSTbeforecheckbox + '' + nslist[i] + ' ' + RCNSTaftercheckbox; }   for (i in loglist) { if (RCNSTList[loglist[i]] == false) insert = ''; else insert = 'checked="checked"'; s += RCNSTbeforecheckbox + '' + loglist[i] + ' ' + RCNSTaftercheckbox; }   s += RCNSTbeforecheckbox + '' + RCNSTaftercheckbox; s += RCNSTbeforecheckbox + '' + RCNSTaftercheckbox; s += RCNSTbeforecheckbox + '' + RCNSTaftercheckbox; document.getElementsByClassName("rcoptions")[0].innerHTML += s;   RCNSTupdate; RCNSTListStore = []; for (i in RCNSTList) RCNSTListStore[i] = RCNSTList[i]; } function RCNSTupdate { for (i in nslist) { if (document.getElementsByName("RCNST" + i)[0].checked) RCNSTList[i] = true; else RCNSTList[i] = false; }   for (i in loglist) { if (document.getElementsByName("RCNSTl" + i)[0].checked) RCNSTList[loglist[i]] = true; else RCNSTList[loglist[i]] = false; }   if (enhanced) { h4s = document.getElementsByTagName("h4"); days = []; for (i = 0; i < h4s.length; i++) { days[i] = h4s[i].nextSibling; while (days[i].tagName != "DIV") days[i] = days[i].nextSibling;; }       for (i in days) { needh4 = false; if (days[i].tagName != "DIV") continue; items = days[i].childNodes; for (j = 0; j < items.length; j++) { if (items[j].tagName != "TABLE") continue; page = items[j].getElementsByTagName("a"); if (page[0].getAttribute("href") == "#") page = page[2]; else page = page[0]; if (page.nextSibling) if(page.nextSibling.nodeValue.substring(0, 1) == ")") visible = RCNSTList[page.innerHTML];               else {                    if (RCNSTPageListInclude.indexOf(page.innerHTML) != -1) visible = true;                    else if (RCNSTPageListExclude.indexOf(page.innerHTML) != -1) visible = false;                    else {                        page = page.innerHTML;                        page = page.substring(0, page.indexOf(":")).replace("_", " ").replace("_", " ");                        page = nslist.indexOf(page);                        if (page == -1) page = 0;                        visible = RCNSTList[page];                    }                }                div = items[j].nextSibling;                if (!div.tagName) div = div.nextSibling;                if (visible) {                    if (items[j].className.indexOf(" rcnsthidden") != -1) items[j].className = items[j].className.substring(0, items[j].className.indexOf(" rcnsthidden")); if (div) if (div.tagName == "DIV") if (div.className.indexOf(" rcnsthidden") != -1) div.className = div.className.substring(0, div.className.indexOf(" rcnsthidden")); needh4 = true; } else { if (items[j].className.indexOf(" rcnsthidden") == -1) items[j].className += " rcnsthidden"; if (div) if (div.tagName == "DIV") if (div.className.indexOf(" rcnsthidden") == -1) div.className += " rcnsthidden"; }           }            h4 = days[i].previousSibling; while (h4.tagName != "H4") h4 = h4.previousSibling; if (needh4) h4.removeAttribute("class"); else h4.className = "rcnsthidden"; }   } else { days = document.getElementsByClassName("special"); for (i in days) { needh4 = false; if (days[i].tagName != "UL") continue; items = days[i].childNodes; for (j = 0; j < items.length; j++) { if (items[j].tagName != "LI") continue; page = items[j].getElementsByTagName("a"); if (page[0].innerHTML == "diff") n = 2; else if (page[0].innerHTML == "hist") n = 1; if (page[0].innerHTML == "diff" || page[0].innerHTML == "hist") { if (RCNSTPageListInclude.indexOf(page[n].innerHTML) != -1) visible = true; else if (RCNSTPageListExclude.indexOf(page[n].innerHTML) != -1) visible = false; else { page = page[0].href; page = page.substring(page.indexOf("?title=") + 7); page = page.substring(0, page.indexOf("&curid=")); page = page.substring(0, page.indexOf(":")).replace("_", " ").replace("_", " "); page = nslist.indexOf(page); if (page == -1) page = 0; visible = RCNSTList[page]; }               } else visible = RCNSTList[page[0].innerHTML]; if (visible) { if (items[j].className.indexOf(" rcnsthidden") != -1) items[j].className = items[j].className.substring(0, items[j].className.indexOf(" rcnsthidden")); needh4 = true; } else if (items[j].className.indexOf(" rcnsthidden") == -1) items[j].className += " rcnsthidden"; }           h4 = days[i].previousSibling; while (h4.tagName != "H4") h4 = h4.previousSibling; if (needh4) h4.removeAttribute("class"); else h4.className = "rcnsthidden"; }   } } function RCNSTall  { on = false; for (i in RCNSTList) if (!RCNSTList[i]) on = true; for (i in nslist) RCNSTList[i] = on; for (i in loglist) RCNSTList[loglist[i]] = on; RCNSTsetboxes; RCNSTupdate; } function RCNSTinvert { for (i in RCNSTList) { if (RCNSTList[i]) RCNSTList[i] = false; else RCNSTList[i] = true; }   RCNSTsetboxes; RCNSTupdate; } function RCNSTrestore { for (i in RCNSTListStore) RCNSTList[i] = RCNSTListStore[i]; RCNSTsetboxes; RCNSTupdate; } function RCNSTsetboxes { for (i in nslist) document.getElementsByName("RCNST" + i)[0].checked = RCNSTList[i]; for (i in loglist) document.getElementsByName("RCNSTl" + i)[0].checked = RCNSTList[loglist[i]]; } /* Add Customedit Buttons */ if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/central/images/f/fc/Button_user_talk.png", "speedTip": "Insert My Word Bubble", "tagOpen": "", "sampleText": ""}; }