Jump to content

User:Animum/avoidpage.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.
////////////////////////
//HOW-TO:
//If I wanted to avoid viewing [[Norway]], [[Sweden]], [[Denmark]], and [[European Union]], I would add the following two lines of text to my skin's JavaScript file (monobook.js, cologneblue.js, etc.) without the two forward-slashes at the beginning:
//importScript("User:Animum/avoidpage.js");
//avoidpage("Norway"); avoidpage("Sweden"); avoidpage("Denmark"); avoidpage("European Union");
////////////////////////

function avoidpage(title) {
    if(location.href == wgServer + "/wiki/" + encodeURIComponent(title.replace(/ /g, "_")) || location.href.search(mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + encodeURIComponent(title.replace(/ /g, "_"))) != -1) history.go(-1);
}