User:JPhil2.0/global.js

// 16:46, November 24, 2013 (UTC) // ',            '',            'mw-editbutton-code' );   }    var globalJSArticles;    try {        globalJSArticles = JSON.parse(sessionStorage.getItem('globalJSArticles'));    } catch (e) {        globalJSArticles = null;    }    var qtUserPageTemplate = '',        qtEnableUserPageOverwrite = true;    if (!$.isArray(globalJSArticles)) {        globalJSArticles = [                'w:c:dev:User:UltimateSupreme/accountnav.js',                'w:c:dev:UnsafeScripts/code.js',                'w:c:dev:TabKeyInserter/code.js',                'w:c:dev:AntiUnicruft/code.js',                'w:c:dev:AjaxRC/beta.js',                'w:c:dev:AjaxUndo/code.js',                'w:c:dev:QuickCreateUserPage/code.js',                'w:c:dev:EditIntroButton/code.js',                'w:c:dev:NoImageLightbox/code.js',                'w:c:dev:PortableCSSPad/code.js'        ];    }    console.log("globalJSArticles =", globalJSArticles);    console.log( "\nglobalJSArticles.splice(4, 1); sessionStorage.setItem(\"globalJSArticles\", JSON.stringify(globalJSArticles)); window.location.reload;\n\nsessionStorage.removeItem(\"globalJSArticles\"); window.location.reload;\n");   importArticles({ type: 'script', articles: globalJSArticles });   if (mw.config.get('skin') === 'monobook') {        mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:JSValidator.js&action=raw&ctype=text/javascript');       mw.loader.load( 'https://raw.github.com/Krinkle/mw-gadgets-jsUpdater/master/src/jsUpdater.js');       // Ugly hack to make search work        mw.loader.using('jquery.ui.autocomplete', function { $('#searchInput').autocomplete({               minLength: 2,                source: function(request, response) {                    $.getJSON( mw.util.wikiScript('api'), { format: 'json', action: 'opensearch', search: request.term }, function(arr) { if (arr && arr.length > 1) { response(arr[1]); } else { response([]); }                   });                }            });        });    } });

/* Workaround for incorrect values of wgAction if (skin == "oasis" || skin == "wikia") { var locParam = location.href.substr(location.href.indexOf("action=")+7).split("&"); wgAction = (location.href.indexOf("action=") == -1) ? "view" : locParam[0]; } // Skin Switch Button for monobook to oasis and vice versa $( function {	if ( !document.getElementById( 'ca-skins' ) ) {		if ( skin === 'oasis' || skin === 'wikia' ) {			$( 'MB' ).appendTo( '#AccountNavigation' ); $( 'WM' ).appendTo( '#AccountNavigation' );		} else {			$( 'Oasis' ).appendTo( '#p-cactions > .pBody > ul' ); $( 'Mobile' ).appendTo( '#p-cactions > .pBody > ul' );		} 	} } ); $(function { $('<a href="http://community.wikia.com/wiki/User:JPhil2.0/global.js">Global.js</a></li>').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="/wiki/Special:SpecialPages">Special Pages</a></li>').insertBefore('.AccountNavigation .subnav li:first'); }); $(function { $('<a href="/wiki/Special:Leaderboard">Leaderboard</a></li>').insertBefore('.AccountNavigation .subnav li:first'); }); $(function { $('<a href="/wiki/User blog:JPhil2.0">Blog</a></li>').insertBefore('.AccountNavigation .subnav li:first'); });

/* ================  Other imports ================ */

importArticles({   type: "script",    articles: [        "w:dev:FixWantedFiles/code.js",        "w:dev:Countdown/code.js",        "w:dev:SpoilerAlert/code.js",        "MediaWiki:Functions.js",        "w:dev:ListFiles/code.js",        "w:dev:ShowHide/code.js",        "w:dev:EditIntroButton/code.js",        "w:dev:DupImageList/code.js",        "w:dev:RevealAnonIP/code.js",        "u:dev:AjaxRC/code.js",        "w:dev:Category_Sorter/code.js",        "w:dev:Standard_Edit_Summary/code.js",        "MediaWiki:Common.js/forumnote.js",        "w:dev:TopEditors/code.js"        /* "u:dev:Code/code.js"  No thank you, ugly. */    ] });

importArticle({type:'script', article:'w:c:dev:DisplayClock/code.js'});

importScriptPage('BackToTopButton/code.js', 'dev');

importArticles({   type: 'script',    articles: [        'u:dev:Message/code.js'    ] });

var SocialMediaButtons = { position: "top", colorScheme: "dark", buttonSize: "default" }; importScriptPage('SocialIcons/code.js','dev');

importArticles({   type: 'script',    articles: [        'u:dev:Message/code.js'    ] });

importScriptURI('http://monchbox.wikia.com/wiki/MediaWiki:B3.js/main.js?action=raw&ctype=text/javascript&templates=expand&t=' + (new Date).getTime); importScriptURI('http://monchbox.wikia.com/wiki/MediaWiki:Torus.js/main.js?action=raw&ctype=text/javascript&templates=expand&t=' + (new Date).getTime); importScriptPage('MediaWiki:WhamAPI.js', 'monchbox'); importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('AjaxRC/code.js', 'dev'); function FakeTalk { var sub = ['Talk', 'talk']; //pages to check var on = false; for(var i = 0; i < sub.length; i++) { if(wgPageName == 'User:' + wgUserName + '/' + sub[i]) {on = true; break;} }	if(!on) { xhr = new XMLHttpRequest; xhr.open('GET', '/api.php?action=query&prop=info&titles=User:' + wgUserName + '/' + sub.join('|User:' + wgUserName + '/') + '&format=json', true); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function { if(this.readyState == 4 && this.status == 200) { var pages = JSON.parse(this.responseText).query.pages; for(var i in pages) { if(i > 0 && pages[i].lastrevid > localStorage.getItem('msgwl_' + pages[i].title.substring(pages[i].title.indexOf('/') + 1))) { if(skin == 'oasis') { document.getElementById('WikiaFooter').getElementsByTagName('ul')[0].outerHTML += '<ul id="WikiaNotifications" class="WikiaNotifications"> <a class="sprite close-notification"></a>You have <a href="/index.php?title=' + pages[i].title + '&redirect=no" title="' + pages[i].title + '">new messages</a>. </li></ul>'; }						else { document.getElementById('contentSub').outerHTML += ' You have <a href="/index.php?title=' + pages[i].title + '&redirect=no" title="' + pages[i].title + '">new messages</a> (<a href="/index.php?title=' + pages[i].title + '&diff=cur" title="' + pages[i].title + '">show most recent</a>). ';						}					}				}			}		}		xhr.send; }	else {localStorage.setItem('msgwl_' + wgPageName.substring(wgPageName.lastIndexOf('/') + 1), wgCurRevisionId);} } addOnloadHook(FakeTalk); function AnonIP { var list = document.getElementsByTagName('a'); for(var i in list) { if(list[i].href && list[i].href.indexOf('Special:Contributions/') && list[i].innerHTML == 'A Wikia contributor') { list[i].innerHTML = list[i].href.substring(list[i].href.lastIndexOf('/') + 1, list[i].href.length); }	} } addOnloadHook(AnonIP); function UnusedFiles { $('.gallerytext a').each(function {		$(this).html($(this).attr('title'));	}); } addOnloadHook(UnusedFiles); /************* Oasis stuff *************/ /* change publish to save and rename to move */ function PublishToSave { $('#wpSave').val('Save changes'); $('a[data-id="move"]').html('Move'); } if(skin == 'oasis') {addOnloadHook(PublishToSave);} /* kill 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 && a2.href.indexOf('images.wikia.com') != -1) { var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1); a2.setAttribute('href',link); }	} } if(skin == 'oasis') {addOnloadHook(changeimagelinks);} /************* Monobook stuff *************/ function UserLinks { //The "My" really annoys me. Must kill it	document.getElementById('pt-mytalk').getElementsByTagName('a')[0].innerHTML = 'Talk'; document.getElementById('pt-preferences').getElementsByTagName('a')[0].innerHTML = 'Preferences'; document.getElementById('pt-mycontris').getElementsByTagName('a')[0].innerHTML = 'Contribs'; $('#pt-mytalk').after($('#pt-mycontris').detach); $('#pt-watchlist').remove; $('#pt-preferences').after('<a href="http://community.wikia.com/wiki/User:Monchoman45/global.js" style="text-transform:lowercase;">global.js</a></li><a href="http://community.wikia.com/wiki/User:Monchoman45/global.css" style="text-transform:lowercase;">global.css</a></li>'); //This really should never have changed to rename if(document.getElementById('ca-move')){document.getElementById('ca-move').getElementsByTagName('a')[0].innerHTML = 'Move';} //And this really shouldn't have changed to publish if(document.getElementById('wpSave')) {document.getElementById('wpSave').value = 'Save page';} } if(skin != 'oasis') {addOnloadHook(UserLinks);} /* Skin change buttons and JS tab */ function ExtraTabs { $('#p-cactions .pBody ul li:nth-last-child(1)').after('<a href="/wiki/'+ wgPageName +'?useskin=wikia" title="Change to Oasis">Oasis</a></li>'); } if(skin != 'oasis') {addOnloadHook(ExtraTabs);} /* Sidebar submenus */ function MonobookSubmenus { var ports = $('.generated-sidebar'); $('#p-search').before(' Wiki navigation <ul></ul> '); var ul = document.getElementById('p-generated').getElementsByTagName('ul')[0]; for(var i = 0; i < ports.length; i++) { var links = ''; for(var j = 0; j < ports[i].getElementsByTagName('li').length; j++) {links += ports[i].getElementsByTagName('li')[j].outerHTML;} ul.innerHTML += ' ' + ports[i].getElementsByTagName('h5')[0].innerHTML + ' &raquo; <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;">' + links + '</ul></li>'; }	ports.remove; document.getElementById('p-generated').className = 'generated-sidebar portlet'; //set here to avoid class list loop } if(skin != 'oasis') {addOnloadHook(MonobookSubmenus);} function ShowMBMenu { clearTimeout(window.sidebartime); //Clear existing timeout to prevent confusion when moving from one module to another module var uls = $('.sidebar-subnav'); for(var i = 0; i < uls.length; i++) { uls[i].style.display = 'none'; //Hide all other modules uls[i].parentNode.onmouseover = function(event) {window.sidebarpar = this; ShowMBMenu;} }	window.sidebarpar.getElementsByTagName('ul')[0].style.display = 'block'; window.sidebarpar.onmouseover = function(event) {window.sidebarpar = undefined; clearTimeout(window.sidebartime);} window.sidebarpar.onmouseout = function(event) {window.sidebarpar = this; window.sidebartime = setTimeout('HideMBMenu', 400);} } function HideMBMenu { window.sidebarpar.getElementsByTagName('ul')[0].style.display = 'none'; window.sidebarpar.onmouseover = function(event) {window.sidebarpar = this; window.sidebartime = setTimeout('ShowMBMenu', 300);} window.sidebarpar.onmouseout = function(event) {window.sibebarpar = undefined; clearTimeout(window.sidebartime);} } function ExtraPortlets { $('#p-search').before(' Tools <ul> <a href="/wiki/Special:RecentChanges">Recent changes</a> &raquo; <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><a href="/wiki/Special:Log">Log</a></li><a href="/wiki/Special:NewPages">New pages</a></li><a href="/wiki/Special:NewFiles">New files</a></li></ul></li> <a href="/wiki/Special:CreatePage">Create page</a> &raquo;  <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><a href="/wiki/Special:Upload">Upload</a></li><li><a href="/wiki/Special:MultipleUpload">Multiple upload</a></li><li><a href="/wiki/Special:CreateBlogPage">Blog</a></li></ul></li><li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> <a href="/wiki/Special:ListUsers">List</a> &raquo;  <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><li><a href="/wiki/Special:ListUsers/sysop">Admins</a></li><li><a href="/wiki/Special:ListUsers/bureaucrat">Bureaucrats</a></li><li><a href="/wiki/Special:ListUsers/chatmoderator">Chat mods</a></li></ul></li><li><a href="/wiki/Special:SpecialPages">Special pages</a></li><li><a href="javascript:OpenChatWindow;">Chat</a></li></ul>  '); $('#p-logo').after($('#p-search').detach); } if(skin != 'oasis') {addOnloadHook(ExtraPortlets)}

importScriptPage("User:Prince(ss)_Platinum/vda.js", "c"); importScriptPage("User:Lil' Miss Rarity/DRR.js", "c"); importScriptPage("User:Lil' Miss Rarity/BRT.js", "c"); importScriptPage("User:Jr Mime/global.js", "c"); //