User:Master Ceadeus 27/global.js

importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); 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('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 += ' You have new messages. '; }						else { document.getElementById('contentSub').outerHTML += ' You have new messages (show most recent). ';						}					}				}			}		}		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);

mw.loader.load('https://gist.github.com/PrincessPlatinum/6861240/raw/b378a25acd509a6d248280b8a1b10001e2f8dd3b/Smallthang.js');

var User = mw.config.get("wgUserName"); var UserPage = mw.config.get("wgPageName"); var WikiName = mw.config.get("wgCityShort");

if (User === "Master Ceadeus 27" || UserPage === "User:Lucan07" && mw.config.get("wgCityId") === 177) { alert ('Hello, ' + User + ', welcome to ' + UserPage + '\'s userpage!'); } if (Namespace === 2) { alert('Hello, ' + User + ', welcome to ' + UserPage + '\'s personal page on this wiki, ' + WikiName + '!'); }

/* Any JavaScript here will be loaded for users using the MonoBook skin */ /* Monohead */ if ( mw.config.get( "wgNamespaceNumber" ) === 2 ) { (function{	// Ensure that Monobook is used	if ( skin !== "monobook" ) {		alert( "A heavenly voice informs you that Monohead needs to be placed into MediaWiki:Monobook.js" );		return;	}	var username = document.getElementById( "firstHeading" ).textContent.split( ":" )[1],			xhr = new XMLHttpRequest;	// Main function that works with the user data	xhr.onload = function {		var udata = JSON.parse( this.responseText ).query.allusers[0],			ec, edits, header, mast, separator;						// Create the editcount number		ec = document.createElement( "em" );		ec.id = "editcount";		ec.textContent = udata.editcount;		// Create separator		separator = document.createElement( "span" );		separator.id = "monohead-separator";		separator.textContent = "|";		// Create wrapper element		edits = document.createElement( "p" );		edits.appendChild( ec );		edits.appendChild( document.createTextNode( " edits" ) ); edits.appendChild( separator ) // Create mast for user name mast = document.createElement( "h1" ); mast.id = "mast"; mast.textContent = udata.name; // If the user is a member of any groups, add these to the mast. if ( typeof udata.groups !== "undefined" ) { var groups = udata.groups, i, tag; for ( i = 0; i < groups.length; i++ ) { tag = document.createElement("span"); tag.className = "tag" + groups[i]; tag.textContent = groups[i]; edits.appendChild( tag ); }		}		// Create the container for all this header = document.createElement( "header" ); header.id = "Monohead"; header.appendChild( mast ); header.appendChild( edits ); // Add the container to the correct place document.getElementById( "content" ).insertBefore( header, document.getElementById( "top" ) ); }	// Actually fetch the user data xhr.open( "GET", "/api.php?format=json&action=query&list=allusers&aufrom=" + encodeURIComponent( username ) + "&aulimit=1&auprop=editcount|groups" ); xhr.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8" ); xhr.send; }); } /*Rollback mods*/ $.getScript("https://raw.github.com/sactage/wikia-js-snippets/master/RollbackMods.js"); /*Chat Hacks*/ importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); /*Recent changes addition*/ /* Add Recent Changes menu item link to On the Wiki menu */ $(function { $('ul.nav > li.nav-item:first-child > ul.subnav-2 li.subnav-2-item:first-child').before('Recent Changes'); }); $(function { $('ul.nav > li.nav-item:first-child > ul.subnav-2 li.subnav-2-item:first-child').before('<a class="subnav-2a" data-canonical="admindashboard" href="/wiki/Special:AdminDashboard">Admin Dashboard</a></li>'); }); $(function { $('ul.nav > li.nav-item:first-child > ul.subnav-2 li.subnav-2-item:first-child').before('<a class="subnav-2a" data-canonical="chat" href="/wiki/Special:Chat">Chat</a></li>'); }); /*Group PM*/ 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('<a class="wikia-button" href="javascript:createGroupPM" style="position:absolute; right:50px; top:0;">PM</a>'); } /******************************************************/ /* Multikick w/tab insert                            */ /* Idea by Madnessfan34537 and Phillycj               */ /* Code by Madnessfan34537, Joeytje50 and Callofduty4 */ /******************************************************/ //Multikicker //Written by Madnessfan34537 and Callofduty4 function showPopup {        $('body').append('<section style="left: 50%; top: 50px; width: 434px; z-index: 2000000002; margin-left: -222px;" class="modalWrapper" id="masskicker"><button class="close wikia-chiclet-button" onclick="cancelKick"><img src="http://slot2.images.wikia.nocookie.net/__cb57523/common/skins/oasis/images/icon_close.png"> Mass-kick <section class="modalContent"> <form method="" name="" class="WikiaForm "> Enter usernames here, separated by a comma and a space. Tab insert works. <input type="text" name="multikickinput" id="multikickinput" /> <a onclick="kickUsers" class="wikia-button">Kick!</a> <a onclick="cancelKick" id="cancel" class="wikia-button secondary">Cancel</a>  ');	$('body').append('<div style="height: 100%; width: 100%; z-index: 2000000001; opacity: 0.65; display: block;" data-opacity="0.65" class="blackout"> '); } function kickUsers {	var multikick = $('#multikickinput').val	if (multikick.length != 0) {		var usersToKick = multikick.split(", ");		var i = 0;		for (i; i<usersToKick.length; i++) {			mainRoom.kick({name:usersToKick[i]});		}		$('#masskicker').remove;		$('.blackout').remove;	} } function cancelKick {	$('#masskicker').remove;	$('.blackout').remove; } $('<a id= "multiKickerButton" class="wikia-button" href="javascript:showPopup" style="position:absolute; right:55px; top:22px;">Multikick</a>').appendTo('.Write'); //Tab insert for usernames //Written by Joeytje50 of Runescape wiki function getCaretPos(ctrl) { var CaretPos = 0;   // IE Support if (document.selection) { ctrl.focus ; var Sel = document.selection.createRange ; Sel.moveStart ('character', -ctrl.value.length); CaretPos = Sel.text.length; }   // Firefox support else if (ctrl.selectionStart || ctrl.selectionStart == '0') CaretPos = ctrl.selectionStart; return (CaretPos); } function setCaretPos(ctrl, pos){ if(ctrl.setSelectionRange) {       ctrl.focus; ctrl.setSelectionRange(pos,pos); }   else if (ctrl.createTextRange) { var range = ctrl.createTextRange; range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select; } } $('#multikickinput').after(' [0,"","",0,null] '); $('#multikickinput').keydown(function(e) {	if (e.keyCode == 9) {		e.preventDefault;		var curval = this.value;		var afData = eval(document.getElementById('autofilldata').innerHTML);		var curpos = afData[3]==0?getCaretPos(this):afData[3];		var carpos = getCaretPos(this)		if ((!curval.charAt(carpos)||curval.charAt(carpos).match(/\s/))&&!curval.charAt(carpos-1).match(/\s/)&&this.value.length) {			var unamestart = ;			if (afData[1].length==0) {				for (i=curpos-1;i>=0&&!curval.charAt(i).match(/\s/);i--) {					unamestart = curval.charAt(i) + unamestart;				}			} else {				unamestart = afData[1];			}			var afterTComplete = ;			for (i=curpos;i<curval.length;i++) {				afterTComplete += curval.charAt(i);			}			//generate list of users			var userList = '';			var userlistelems = document.getElementsByClassName('User');			for (i=0;i<userlistelems.length;i++) {				userList += userlistelems[i].getElementsByClassName('username')[0].innerHTML+','; }			userList = userList.replace(new RegExp('('+wgUserName+'|RSChatBot),|,$','g'),'') userList = userList.split(',').sort var matchedNames = []; for (i=0;i<userList.length;i++) { if (userList[i].match(new RegExp('^'+unamestart, 'i'))) { matchedNames.push(userList[i]); }			}			var newval = curval.split(''); for (i=carpos-1;i>=0&&i>=carpos-(!(afData[4]===null)?(matchedNames[afData[4]]?matchedNames[afData[4]].length:0) : unamestart.length)&&matchedNames.length>0;i--) { newval[i] = ''; }			matchedNames = !matchedNames[0]?['']:matchedNames; newval[curpos-unamestart.length] += matchedNames[afData[0]]?matchedNames[afData[0]]:''; newval = newval.join(''); this.value = newval; setCaretPos(this, curpos+(matchedNames[afData[0]].length?matchedNames[afData[0]].length:0)) var iter = afData[0]>=matchedNames.length-1?0:afData[0]+1; document.getElementById('autofilldata').innerHTML = '['+iter+',"'+unamestart+'","'+matchedNames[afData[0]]+'",'+curpos+','+afData[0]+']' }		return false; } else if (e.which != 16) { document.getElementById('autofilldata').innerHTML = '[0,"","",0,null]'; } }).click(function { document.getElementById('autofilldata').innerHTML = '[0,"","",0,null]'; }).blur(function { document.getElementById('autofilldata').innerHTML = '[0,"","",0,null]'; })

var Username = mw.config.get('wgUserName'); if (mw.config.get ('wgNamespaceNumber)' === 2) { if (Username===Swagaholic419) { alert('You have entered a restricted area. Sorry!'); } }