User:JPhil2.0/global.js

/* =========================================================================    JS for monobook and oasis applied to all wikia wikis. @author JPhil2.0 ========================================================================== */

window.ajaxPages = ["Special:RecentChanges","Special:Watchlist","Special:Log","Special:Contributions"]; var qtUserPageTemplate = ""; var qtEnableUserPageOverwrite = true; importArticles({   type: "script",    articles: [        "u:dev:WHAM/code.js",        "u:cpw:MediaWiki:Gadget-HotCat.js",        "u:dev:DisplayClock/code.js",        "u:dev:CapsFirst/code.js",        "u:dev:PortableCSSPad/code.js",        "u:dev:QuickCreateUserPage/code.js",        "u:dev:HeaderLinks/code.js",        "u:dev:AjaxRC/code.js",        "u:dev:AjaxUndo/code.js",    ] });

importScriptPage('View_Source/code.js', 'dev'); importScriptPage('User:Monchoman45/ChatHacks.js', 'c');

/* Anon highlight (By Lil' Miss Rarity) */ function highlightAnons { //IP regular expression var ip =/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; //Check if user is anon and highlight $(".mw-userlink").each(function {       var text = $(this).text;        if (text.match(ip)) {            //Highlight            $(this).css("color", "#848484");        }    }); } $(document).ready(function {   highlightAnons; });

/* Custom Account Navigation */ $(function { $('Sysops').insertBefore('.AccountNavigation .subnav li:first'); }); $(function { $('User blog').insertBefore('.AccountNavigation .subnav li:first'); }); $(function { $('Chat').insertBefore('.AccountNavigation .subnav li:first'); }); $(function { $('Contributions').insertBefore('.AccountNavigation .subnav li:first'); }); $(function { $('<a href="http://community.wikia.com/wiki/User:JPhil2.0/global.css">Global.css</a></li>').insertBefore('.AccountNavigation .subnav li:first'); }); $(function { $('<a href="http://community.wikia.com/wiki/User:JPhil2.0/global.js">Global.js</a></li>').insertBefore('.AccountNavigation .subnav li:first'); });

/* Skin Switch Button from Monobook to Oasis */

$( function {	if ( !document.getElementById( 'ca-skins' ) ) {		if ( skin === 'oasis' || skin === 'wikia' ) {			$( '<a href="/index.php?title=' + encodeURIComponent( wgPageName ) + '&useskin=monobook">MB</a></li>' ).appendTo( '#AccountNavigation' ); $( '<a href="/index.php?title=' + encodeURIComponent( wgPageName ) + '&useskin=wikiamobile">WM</a></li>' ).appendTo( '#AccountNavigation' );		} else {			$( '<a href="/index.php?title=' + encodeURIComponent( wgPageName ) + '&useskin=wikia">Oasis</a></li>' ).appendTo( '#p-cactions > .pBody > ul' ); $( '<a href="/index.php?title=' + encodeURIComponent( wgPageName ) + '&useskin=wikiamobile">Mobile</a></li>' ).appendTo( '#p-cactions > .pBody > ul' );		} 	} } );

/* Wiki Activity to Recent Changes */

if (mw.config.get('skin') === 'oasis') { $(function {       $("a[data-canonical='wikiactivity']").attr('href', '/wiki/Special:RecentChanges').text('Recent Changes');        if (mw.config.get('wgCityId') == 177) {            $("a[data-canonical='chat']").click(function (event) { event.preventDefault; });       }    }); }