User:Phillycj/global.js

/* change wiki activity to recent changes */ function WikiActivity2RecentChanges { $('.wikia-button[data-id$="wikiactivity"]').replaceWith('Recent Changes'); } addOnloadHook(WikiActivity2RecentChanges);

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

importScriptPage('User:Joeytje50/tabinsert.js','rs') if(wgCanonicalSpecialPageName == 'Chat') { function createGroupPM { var users = prompt('Enter comma seperated list of users to start a PM with',''); var users = users.split(','); mainRoom.openPrivateChat(users); } $('form#Write').append('PM'); } /* Extra rollback links */ function CustomRollbacks { var Buttons = [{ text: 'spam', title: 'Revert spam', summary: 'Reverted spam', loadtalk: false }, {		text: 'vandalism', title: 'Revert vandalism', summary: 'Reverted vandalism', loadtalk: false }, {		text: 'null', title: 'Revert with no summary', summary: ' &bot=1', //This one has no summary, and flags it as a bot edit loadtalk: false }];	var list = document.getElementsByTagName('span'); for(var i in list) { if(list[i].className == 'mw-rollback-link') { var link = list[i]; var rollback = link.innerHTML; for(j in Buttons) { var customlink = document.createElement('span'); customlink.innerHTML = rollback; customlink.className = 'customrollback'; //we do this to avoid an infinite loop, because when we insert a into the DOM, the list variable includes it				customlink.getElementsByTagName('a')[0].title = Buttons[j].title; customlink.getElementsByTagName('a')[0].href += '&summary=' + Buttons[j].summary; customlink.getElementsByTagName('a')[0].innerHTML = Buttons[j].text; if(Buttons[j].loadtalk == true) {customlink.getElementsByTagName('a')[0].className = 'loadtalk';} if(urlQuery('action') == 'history') { link.parentNode.insertBefore(customlink, link.nextSibling); customlink.outerHTML = ' | ' + customlink.outerHTML; }				else { link.parentNode.appendChild(customlink); customlink.outerHTML = ' ' + customlink.outerHTML; }			}		}	}	for(var i in list) { //why another one of these? we're fixing the class that we set to avoid an infinite loop if(list[i].className == 'customrollback') { list[i].className = 'mw-rollback-link'; }	}	/* Grunny's function for opening up a user's talkpage when rollbacking (http://community.wikia.com/wiki/User:Grunny) */ $( '.mw-rollback-link .loadtalk' ).click( function (e) {		e.preventDefault;		var $rblink = $( this );		$.ajax( { url: $rblink.attr( 'href' ), success: function { var    user = $rblink.attr( 'href' ).replace( /.*[&?]from=([^&]*).*/, '$1' ).replace( /\+/g, '_' ), newurl = wgServer + wgArticlePath.replace( '$1', 'User_talk:' + user + '?action=edit&section=new' ); location.href = newurl; },			error: function { $rblink.text( function ( i, val ) {					return val + ' [failed]';				} ); }		} );	} ); } if(readCookie('globalJS') == 'true') {addOnloadHook(CustomRollbacks);}

//Custom shiny edit buttons if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/__cb20100502153339/callofduty/images/1/17/Button_Ssig.jpg", "speedTip": "Signature", "tagOpen": " ~"+""+"", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/__cb20100304205745/callofduty/images/0/03/Al-Asad.jpg", "speedTip": "Speedy delete: spam", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/__cb20100304205745/callofduty/images/0/03/Al-Asad.jpg", "speedTip": "Speedy delete: unnecessary", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/__cb20100304205745/callofduty/images/0/03/Al-Asad.jpg", "speedTip": "Speedy delete: other reason", "tagOpen": "{{Sdelete|", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images4.wikia.nocookie.net/callofduty/images/4/47/T_button.jpg", "speedTip": "Trolling", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/callofduty/images/b/b3/V_button.jpg", "speedTip": "Vandalism", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/p0q2A.png", "speedTip": "Needs Images", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/E1B5s.png", "speedTip": "Better Images", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/0M41t.png", "speedTip": "Leaked Info", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/RXGP7.png", "speedTip": "IRL", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/EXEK6.png", "speedTip": "Bad Edit", "tagOpen": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/JWF5u.png", "speedTip": "Bad Page", "tagOpen": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/8fWam.png", "speedTip": "Dont Delete discussions", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/SzOzG.png", "speedTip": "Chat Ban", "tagOpen": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/aeMxa.png", "speedTip": "Lag Ban", "tagOpen": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/I0ez2.png", "speedTip": "Unbanned", "tagOpen": "", "tagClose": "", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/WgtIw.png", "speedTip": "Licensing Images", "tagOpen": "", "tagClose": "", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/kNhOT.png", "speedTip": "Bad Image Title", "tagOpen": "", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://i.imgur.com/3EIiM.png", "speedTip": "Global Page", "tagOpen": "", "tagClose": "", "sampleText": ""};

}

//End custom shiny edit buttons

//chat sech bar// $('#ChatHeader').append('  ')

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