User:Beep21/global.js

// COPIERS: If you wish to copy any of the scripts found here, copy the entire text between the empty lines. Do not forget to have the script run. To do this add a newline with the name of the function from the first line between "$(" and ")" after the rest of the script. For example, if the first line is the following, // function bpHello // then you should add the following at the end. // $(bpHello)

// check "Watch this page" when necessary // by Wikia user "Beep21" function bpWatchifnecessary { if (wgAction == "edit") {   if (wgNamespaceNumber == 110) {     bpWatch }    else if (wgNamespaceNumber / 2 == Math.floor(wgNamespaceNumber / 2) && wgCurRevisionId == false) {      bpWatch }    else if (wgNamespaceNumber / 2 != Math.floor(wgNamespaceNumber / 2)) {      bpWatch }  }  if (wgPageName == "Special:Upload") {   bpWatch } } function bpWatch { $("#wpWatchthis").attr("checked","checked") } function bpWatchifunanswered(bpData) { if(!$(bpData).find("error").length && !$(bpData).find("api query pages page categories").length) {   $(bpWatch) } } if(skin == "answers" && wgAction == "edit") { $.ajax({data:"action=query&pageids=" + encodeURIComponent(wgArticleId) + "&prop=categories&clcategories=Category:" + encodeURIComponent(wgAnsweredCategory) + "&format=xml&maxlag=5",success:bpWatchifunanswered,timeout:20000,url:wgServer + "/api.php"}) }

// change the "More" link in the "Latest activity" widget to go to the Recent changes // by Wikia user "Beep21" function bpLatestactmorechange { if(skin == "monaco") {   $("#community-widget-action-button").attr("href",wgServer + "/wiki/Special:RecentChanges") } }

// make the sidebar smaller by removing Wiki page in Widgets that do not have pages // by Wikia user "Beep21" // based on a script by Wikia users "Najevi" and "Uberfuzzy" found at  used with permission function bpSmsidebar { $('.WidgetWikiPage .widget-error-wikipage-missing').closest('dd').parent('dl').hide }

//

//run the above functions on DOM ready function bpOnload { bpWatchifnecessary bpSmsidebar bpLatestactmorechange } $(bpOnload)