User:MadGenius/global.js

// /* Creates edit buttons. By User:Thailog Gotten from User:TechFilmer /* if (wgSiteName != "My Wiki Name") { rest of the code } */ /* not on Avatar Wiki */ if ( mw.config.get( "wgSiteName" ) != "Avatar Wiki" ) { if ((wgAction == 'submit' || wgAction == 'edit') && mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images4.wikia.nocookie.net/avatar/images/4/4d/Support_Button.png", "speedTip": "Support", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/avatar/images/9/9f/Oppose_Button.png", "speedTip": "Oppose", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images4.wikia.nocookie.net/avatar/images/7/7e/Neutral_Button.png", "speedTip": "Neutral", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/avatar/images/a/a5/Keep_Button.png", "speedTip": "Vote to keep", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/avatar/images/3/3c/Delete_Button.png", "speedTip": "Vote to delete", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/avatar/images/4/4d/Merge_Button.png", "speedTip": "Vote to merge", "tagOpen": " ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/avatar/images/b/b3/Done_Button.png", "speedTip": "Done", "tagOpen": "✅ ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/avatar/images/f/fd/Not_Done_Button.png", "speedTip": "Not done", "tagOpen": "❌ ", "tagClose": "", "sampleText": ""}; } /* everywhere */ if ((wgAction == 'submit' || wgAction == 'edit') && mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/sk001306/images/thumb/8/82/Gavel1.jpg/25px-Gavel1.jpg", "speedTip": "Close Discussion", "tagOpen": "", "sampleText": "result of discussion"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/OCR-A_char_Number_Sign.svg/20px-OCR-A_char_Number_Sign.svg.png", "speedTip": "Number Sign", "tagOpen": "# ", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/c/c8/Button_redirect.png?1", "speedTip": "Redirect", "tagOpen": "#REDIRECT ",		"tagClose": "", "sampleText": "Redirect link"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/8/8c/Button_RedX.png?1", "speedTip": "Delete", "tagOpen": "", "sampleText": "Delete"}; } } /* Chat hacks */ /* * ChatHacks.js, by Monchoman45. * Version 7.0 * * Features: *  Ability to clear your chat window *  A host of slash commands *  Ability to create multi user private chats *  Inline alerts every time your away status changes *  Icons next to messages by staff and chat mods in the room *  Pings when someone mentions your name or any other specified phrases */ if(wgCanonicalSpecialPageName == 'Chat') { window.hasFocus = true; window.dinged = false; window.ding = 0; window.titleorig = document.title; function Unding { //for fixing the title after you've been dinged document.getElementsByTagName('title')[0].innerHTML = window.titleorig; clearInterval(window.ding); window.dinged = false; }	$(window).bind('focus', Unding); $(window).bind('focus', function {window.hasFocus = true;}); $(window).bind('blur', function {window.hasFocus = false;}); //Function for adding messages to the window NodeChatDiscussion.prototype.iconPing = function (chat) { var icon = ''; for(var i in this.model.users.models) { if(this.model.users.models[i].attributes.name == chat.attributes.name) { if(this.model.users.models[i].attributes.isStaff) { icon = ' '; }				else if(this.model.users.models[i].attributes.isModerator) { icon = ' '; }				break; }		}		if(icon) {this.chatUL.children.last.children('.username').html(this.chatUL.children.last.children('.username').html + icon);} if(mainRoom.isInitialized && chat.attributes.name != wgUserName && !chat.attributes.isInlineAlert) { window.dinged = true; //resolve HTML var text = document.createElement('span'); text.innerHTML = chat.attributes.text; text = text.textContent; var pings = document.getElementById('pings').value.removeTrailing('\n').split('\n'); for(var i = 0; i < pings.length; i++) { if(text.toLowerCase.indexOf(pings[i].toLowerCase) != -1 || this != mainRoom.viewDiscussion) { if(!window.hasFocus) { //Only annoy people if the window isn't focused document.getElementById('sound').innerHTML = ' '; if(!window.dinged) {window.ding = setInterval('FlashTitle', 500);} }					this.scrollToBottom; if(this == mainRoom.viewDiscussion) { var ref = text.toLowerCase.indexOf(pings[i].toLowerCase); var phrase = text.slice(ref, ref + pings[i].length); this.chatUL.children.last.children('.message').html(text.replace(phrase, ' ' + phrase + ' ')); }					break; }			}		}		//Kill emoticons this.chatUL.children.last.children('.message img').each(function {this.outerHTML = '' + this.title + ' ';}); }	mainRoom.model.chats.bind('afteradd', $.proxy(mainRoom.viewDiscussion.iconPing, mainRoom.viewDiscussion)); //Away status functions NodeChatController.prototype.setAway = function (msg){ if(!msg) {var msg = '';} $.log("Attempting to go away with message: " + msg); var setStatusCommand = new models.SetStatusCommand({			statusState: STATUS_STATE_AWAY,			statusMessage: msg		}); this.inlineAlert(i18n['away']); this.socket.send(setStatusCommand.xport); }	NodeChatController.prototype.setBack = function { if( !this.comingBackFromAway ) { // if we have sent this command (but just haven't finished coming back yet), don't keep spamming the server w/this command $.log("Telling the server that I'm back."); this.comingBackFromAway = true; var setStatusCommand = new models.SetStatusCommand({				statusState: STATUS_STATE_PRESENT,				statusMessage: ''			}); this.inlineAlert(i18n['back']); this.socket.send(setStatusCommand.xport); }	}	//Send message function NodeChatController.prototype.sendMessage = function (event) { if(!this.active) { return true; }		if (event.which == 13 && !event.shiftKey) { event.preventDefault; mainRoom.resetActivityTimer; var inputField = this.viewDiscussion.getTextInput; var send = Preparse.call(this, inputField.val); if (inputField.val && send) { var chatEntry = new models.ChatEntry({roomId: this.roomId, name: wgUserName, text: inputField.val}); if( this.isPrivate == true ) { //is prive if( this.afterInitQueue.length < 1 || this.model.users.length < 2 ){ this.mainController.socket.send( this.model.privateRoom.xport ); }					if( !this.isInitialized ) { this.afterInitQueue.push(chatEntry.xport); //temp chat entry in case of slow connection time chatEntry.set({temp : true, avatarSrc: wgAvatarUrl }); this.model.chats.add(chatEntry); } else { this.socket.send(chatEntry.xport); }				} else { this.socket.send(chatEntry.xport); }				event.preventDefault; }			inputField.val(''); $.log('submitting form'); inputField.focus; }	}	mainRoom.viewDiscussion.unbind('sendMessage'); mainRoom.viewDiscussion.bind('sendMessage', $.proxy(mainRoom.sendMessage, mainRoom)); importScriptPage('User:Joeytje50/ChatPMs.js', 'c'); /* Images */ importScriptPage("Callofduty4/OldFilePages.js", "c"); /* Anon IP */ importScriptPage('RevealAnonIP/usercode.js', 'dev'); /* User Page Create */ importArticles({   type: 'script',    articles: [        'w:dev:QuickCreateUserPage/code.js'    ] }); /* Wikimarks */ importArticles({   type: 'script',    articles: [        'u:wikimarks:Client.js'    ] }); /* WA in MBK */ addPortletLink( 'p-navigation', '/wiki/Special:WikiActivity?useskin=wikia', 'Wiki Activity'); /* Rollback mods */ importScriptURI("https://raw.github.com/sactage/wikia-js-snippets/master/RollbackMods.js"); /* Intro Button */ EditIntroButtonText = 'intro'; importScriptPage('EditIntroButton/code.js', 'dev'); /* Ajax Undo */ importScriptPage( 'AjaxUndo/code.js', 'dev' ); /* Purge Button */ PurgeButtonText = 'purge'; importScriptPage('PurgeButton/code.js', 'dev'); /* UTC Time */ importArticle({type:'script', article:'w:c:dev:DisplayClock/code.js'}); /* Switch Skin */ importScriptPage('SkinSwitchButton/code.js', 'dev'); var monoBookText = 'Monobook', oasisText = 'Wikia'; /* Ref popup */ importArticles({   type: 'script',    articles: [        // ...        'w:c:dev:ReferencePopups/code.js',        // ...    ] }); /* Sig Check Code */ importArticles({	type: 'script',	articles: [		// ...		'w:c:dev:SignatureCheck/code.js',		// ...	] }); //