User:JPhil2.0/global.js

importScriptPage('AjaxRC/code.js', 'dev'); importScriptPage('MediaWiki:B3.js', 'monchbox'); importScriptPage('MediaWiki:WhamAPI.js', 'monchbox'); importScriptPage('User:Callofduty4/ChatHacks.js', 'c'); importScriptPage('User:Joeyaa/wham.js','vstf'); importScriptPage('ListAdmins/code.js', 'dev'); importScriptURI('http://markvanalphen.wikia.com/index.php?title=MediaWiki:CUP.js&action=raw&ctype=text/javascript'); importArticles({   type: 'script',    articles: [        'u:dev:Message/code.js'    ] });

function appendScript(url) { var scriptElem = document.createElement('script'); scriptElem.setAttribute('src',url); scriptElem.setAttribute('type','text/javascript'); document.getElementsByTagName('head')[0].appendChild(scriptElem); } appendScript('http://www.wikia.com/index.php?title=User:Splarka/contribtools.js&action=raw&ctype=text/javascript&dontcountme=s') appendScript('http://www.wikia.com/index.php?title=User:Splarka/stripsource.js&action=raw&ctype=text/javascript&dontcountme=s') appendScript('http://www.wikia.com/index.php?title=User:Splarka/fastdelete.js&action=raw&ctype=text/javascript&dontcountme=s') appendScript('http://www.wikia.com/index.php?title=User:Splarka/interwikitools.js&action=raw&ctype=text/javascript&dontcountme=s') appendScript('http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js&action=raw&ctype=text/javascript&dontcountme=s')

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

// Account Navigation $(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'); }); $(function { $('<a href="/wiki/Special:SpecialPages">SpecialPages</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'); }); $(function { $('<a href="/wiki/Special:Contributions/JPhil2.0">Contributions</a></li>').insertBefore('.AccountNavigation .subnav li:first'); });

var qtUserPageTemplate = '', qtEnableUserPageOverwrite = true; importScriptPage('QuickCreateUserPage/code.js', 'dev');

//etc. 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;"><li><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)}