User:JPhil2.0/global.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');

//Chat Message Blocker importScriptPage('MessageBlocker/code.js', 'dev'); // ********** // Fastdelete // ********** importScriptPage('FastDelete/code.js', 'dev'); var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Unnecessary ', 'label': 'Unnec'}; fdButtons[fdButtons.length] = { 'summary': 'Off Topic', 'label': 'Off topic'}; fdButtons[fdButtons.length] = { 'summary': 'Spam', 'label': 'Spam'}; fdButtons[fdButtons.length] = { 'summary': 'Housekeeping', 'label': 'Housekeeping'}; // ************** // End Fastdelete // ************** function importScriptPage (page, server) { var url = '/index.php?title=' + encodeURIComponent(page.replace(/ /g,'_')).replace('%2F','/').replace('%3A',':') + '&action=raw&ctype=text/javascript'; if (typeof server == "string") url = (server.indexOf('://') == -1)?'http://' + server + '.wikia.com' + url:server + url; return importScriptURI(url); } $( function {	$('#my-tools-menu').prepend(' User lookup');	$('#my-tools-menu').prepend(' Title Finder');	$('#my-tools-menu').prepend(' Remove Avatar');	$('#my-tools-menu').prepend(' Phalanx');	$('#my-tools-menu').prepend(' Nuke');	$('#my-tools-menu').prepend(' Multi-delete</a></li>');	$('#my-tools-menu').prepend(' <a href="/wiki/Special:Multilookup" rel="nofollow">IP lookup</a></li>');	$('#my-tools-menu').prepend(' <a href="/wiki/Special:AchievementsCustomize" rel="nofollow">Customize Badges</a></li>'); } );

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

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

//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:JPhil2.0/global.js" style="text-transform:lowercase;">Global.js</a></li><a href="http://community.wikia.com/wiki/User:JPhil2.0/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)}

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