Jump to content

User:TheCatalyst31/vector.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
importScript('User:Ale_jrb/Scripts/csdhelper.js');  //[[User:Ale_jrb/Scripts]]
importScript('User:TheCatalyst31/AddCommonsCatLinks.js');
importScript('User:Magicpiano/NRBot/NRHPstats.js');
importScript('User:Magicpiano/NRBot/UpdateNRHPProgress.js');
importScript('User:Magicpiano/NRBot/ReorderNRHPlist.js');
importScript('User:Magicpiano/NRBot/NRHPmap.js');

var WatchListHiddenUsers=[]

function WatchlistHideUsers() {
    if (mw.config.get('wgPageName')!="Special:Watchlist") return;
    if (Object.prototype.toString.call(WatchListHiddenUsers)!=='[object Array]') return;
    var edits=document.getElementsByClassName("mw-userlink")
    if (edits==null) return;

    var hiddenCount=0
    for (var i=0; i<WatchListHiddenUsers.length; i++) {
        for (var j=0; j<edits.length; j++) {
            if (edits[j].href.search(WatchListHiddenUsers[i])!=-1) {
                if (edits[j].parentNode.style.display!="none") {
                    edits[j].parentNode.style.display="none"
                    hiddenCount++
                } else {
                    edits[j].parentNode.style.display=""
                }
            }
        }
    }

    var title=document.getElementById("firstHeading")
    if (hiddenCount>0) {
        title.innerHTML+=" <small>("+hiddenCount+" edits hidden; <a onclick='WatchlistHideUsers()'>Show them</a>)</small>"
    } else {
        title.innerHTML=title.innerHTML.replace(/ <small>.*?<\/small>/g,"")
    }
}

$(WatchlistHideUsers);