User:RansomTime/global.js

// queryString by Gruns // hoisted here because I use it a lot in my own scripts function queryString( p ) { var   re = RegExp('[&?]' + p + '=([^&]*)'), matches; if ( matches = re.exec( document.location ) ) { try { return decodeURI(matches[1]); } catch ( e ) { }   }    return null; }

importScriptURI('https://janitor.wikia.com/index.php?title=User:RansomTime/scripts.js&action=raw&ctype=text/javascript'); importArticles({   type: "script",    articles: [        "w:dev:MediaWiki:AjaxRC/code.js",        "w:vstf:User:Joeyaa/wham.js"    ] }); window.ajaxPages = ["Special:RecentChanges","Special:NewPages"]; importScriptPage('MediaWiki:ReplyBottom/code.js', 'dev');

importScriptURI('//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js' + '&action=raw&ctype=text/javascript'); var changeLogoLink = function { $('#p-logo a'); }; addOnloadHook(changeLogoLink);

/*if( wgCanonicalSpecialPageName === 'Contributions' ) { /*  * Ez Userrights * @Author RansomTime *  * Queries the API for the user groups of a user, and places it on their contribs masthead * Monobook only. * I think there's a script that does this for Oasis already and does it with those little * Floaty header things. If not then the API query stuff works - just find an id to put it on and this * script will work for that. */ /* TODO: Rework for oasis? $(function {     var capFirstLtr = function(string) {    return string.charAt(0).toUpperCase + string.slice(1);    };

var user = mw.html.escape( $( 'input[name="target"]' ).val ); var query = {}; query.list = "users"; query.ususers = user; query.usprop = "groups"; var api = new mw.Api; api.get(query).done(function(data) {     var res = "";      console.log(data);      if (data && data.query && data.query.users) {        for (var idx in data.query.users[0].groups) {          right = data.query.users[0].groups[idx];          if (right === "*" || right === "user" || right === "poweruser" || right === "autoconfirmed") { continue; }          if (right === "wikiastars") { right = "star"; }          if (right === "vstf") { right = "VSTF"; }

if (res === "") { res += capFirstLtr(right); } else { res += "/" + capFirstLtr(right); }       }      }      if (res !== "") { $('#firstHeading').html("Special:Contributions/" + user + " (" + res + ")"); } else { $('#firstHeading').html("Special:Contributions/" + user); }   });  }); };*/

addPortletLink( 'p-navigation', 'http://community.wikia.com/wiki/Special:PhalanxStats/wiki/' + wgCityId, 'Wiki Phalanx Stats' ); addPortletLink( 'p-navigation', '/wiki/Special:MultiDelete/', 'MultiDelete' ); if (typeof wgWikiaChatWindowFeatures !== "undefined") { addPortletLink( 'p-navigation', '/wiki/Special:Chat?useskin', 'Chat' ); }

// Changes WikiaContributer to IP in Article Comments // @Author Rappy

$('#WikiaArticleComments .edited-by a[href*="/wiki' + '/Special:Contributions"]').each(function { $(this).html(this.href.substring(this.href.lastIndexOf('/') + 1)); });

// Handles special pages in monobook that that are "available only in Wikia skin" var monobookSpecialPageHandler = function { if (skin === "monobook") { if ((window.location.href.endsWith("Special:Chat")) ||            (window.location.href.endsWith("Special:CSS")) ||             (window.location.href.endsWith("Special:WikiFeatures"))) { window.location.href = window.location.href + "?useskin=Wikia"; }       if (window.location.href.endsWith("Special:WikiActivity")) { window.location.href = "/wiki/Special:RecentChanges"; }   } };

addOnloadHook(monobookSpecialPageHandler); // quick redirect to forked wikis (SEO will be in Wikia's favor for some time I bet) if (window.location.href.search("oldschoolrunescape.") > 0) { window.location.href = window.location.href.replace("oldschoolrunescape.wikia.com","oldschool.runescape.wiki"); } else if (window.location.href.search("runescape.fandom.com") > 0) { window.location.href = window.location.href.replace("runescape.fandom.com","runescape.wiki"); } // I use a lot of browsers - porting around Torus pings are a pain

// WARNING NSFW language

var torusPings = '{"#global":{"enabled":true,"alert":"Activity!","interval":500,"beep":true,"sound":"http://images.wikia.com/monchbox/images/0/01/Beep-sound.ogg","regex":["[A-Z]{10,}"],"literal":["ransomtime","ransom","nigg","fuck","dick","shit","cunt","wanker","vstf","shut up","fag","!awooga","gay","homo","Special:Chat"]},"community":{"enabled":true,"alert":"Activity!","interval":500,"beep":true,"sound":"http://images.wikia.com/monchbox/images/0/01/Beep-sound.ogg","regex":[],"literal":[]}}' window.localStorage.setItem('torus-pings', torusPings);