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:QuickModTools/loader.js",        "u:dev:ChatBlockButton/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'); importScriptPage('AjaxEmoticons/code.js', 'dev');

/* 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; });       }    }); }

/* No image popups */ window.wgEnableImageLightboxExt = false; function changeimagelinks { $('#WikiaArticle, .LatestPhotosModule, #article-comments').unbind('click.lightbox'); var a = document.getElementsByTagName('a'); for(var t = 0; t < a.length; ++t) { var a2 = a[t]; var img = a2.getElementsByTagName('img'); if(img[0] != null) { if (a2.href.indexOf('images.wikia.com') != -1) { var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1); a2.setAttribute('href',link); }		}	} } addOnloadHook(changeimagelinks);