User:JustWastingTime/sandbox.js

if(wgCanonicalSpecialPageName == 'Chat') { window.autoreplies = { '': 'Yes?', 'shutdown': 'Access denied.', 'help': 'Hello, this is TestBot v1.03, what would you like help with?', //--- 12 cm naval gun --- '12 cm naval gun': '12_cm_Naval_Gun FirePower +1 Anti-air +1 Short Range Light Main Gun', '12cm naval gun': '12_cm_Naval_Gun FirePower +1 Anti-air +1 Short Range Light Main Gun', '12 cm red gun': '12_cm_Naval_Gun FirePower +1 Anti-air +1 Short Range Light Main Gun', '12cm red gun': '12_cm_Naval_Gun FirePower +1 Anti-air +1 Short Range Light Main Gun', '12cm gun': '12_cm_Naval_Gun FirePower +1 Anti-air +1 Short Range Light Main Gun', '12 cm gun': '12_cm_Naval_Gun FirePower +1 Anti-air +1 Short Range Light Main Gun', //--- 12.7 cm twin gun --- '127 cm twin gun mount': '12.7cm_Twin_Gun_Mount FirePower +2 Anti-air +2 Short Range Light Main Gun', '127cm twin gun mount': '12.7cm_Twin_Gun_Mount FirePower +2 Anti-air +2 Short Range Light Main Gun', '127 cm twin gun': '12.7cm_Twin_Gun_Mount FirePower +2 Anti-air +2 Short Range Light Main Gun', '127cm twin gun': '12.7cm_Twin_Gun_Mount FirePower +2 Anti-air +2 Short Range Light Main Gun', //--- 10 cm twin high angle --- '10 cm twin high angle mount': '10cm_Twin_High-angle_Mount FirePower +2 Anti-air +7 Short Range Light Main/AA Gun', '10cm twin high angle mount': '10cm_Twin_High-angle_Mount FirePower +2 Anti-air +7 Short Range Light Main/AA Gun', '10 cm twin high angle': '10cm_Twin_High-angle_Mount FirePower +2 Anti-air +7 Short Range Light Main/AA Gun', '10cm twin high angle': '10cm_Twin_High-angle_Mount FirePower +2 Anti-air +7 Short Range Light Main/AA Gun', //--- 14 cm naval gun --- '14 cm naval gun': '14_cm_Naval_Gun FirePower +2 Accuracy +1 Medium Range Medium Main Gun', '14cm naval gun': '14_cm_Naval_Gun FirePower +2 Accuracy+1 Medium Range Medium Main Gun', '14 cm red gun': '14_cm_Naval_Gun FirePower +2 Anti-air +1 Medium Range Medium Main Gun', '14cm red gun': '14_cm_Naval_Gun FirePower +2 Anti-air +1 Medium Range Medium Main Gun', '14cm gun': '14_cm_Naval_Gun FirePower +2 Anti-air +1 Medium Range Medium Main Gun', '14 cm gun': '14_cm_Naval_Gun FirePower +2 Anti-air +1 Medium Range Medium Main Gun', //--- 15.5 cm triple gun mount main --- '155 cm triple gun mount main': '15.5cm_Triple_Gun_Mount_(Main) FirePower +7 Anti-air +4 Accuracy +1 Medium Range Medium Main Gun', '155cm triple gun mount main': '15.5cm_Triple_Gun_Mount_(Main) FirePower +7 Anti-air +4 Accuracy +1 Medium Range Medium Main Gun', '155 cm triple gun': '15.5cm_Triple_Gun_Mount_(Main) FirePower +7 Anti-air +4 Accuracy +1 Medium Range Medium Main Gun', '155cm triple gun': '15.5cm_Triple_Gun_Mount_(Main) FirePower +7 Anti-air +4 Accuracy +1 Medium Range Medium Main Gun', '155 cm red triple gun': '15.5cm_Triple_Gun_Mount_(Main) FirePower +7 Anti-air +4 Accuracy +1 Medium Range Medium Main Gun', '155cm red triple gun': '15.5cm_Triple_Gun_Mount_(Main) FirePower +7 Anti-air +4 Accuracy +1 Medium Range Medium Main Gun', '155 cm red gun': '15.5cm_Triple_Gun_Mount_(Main) FirePower +7 Anti-air +4 Accuracy +1 Medium Range Medium Main Gun', '155cm red gun': '15.5cm_Triple_Gun_Mount_(Main) FirePower +7 Anti-air +4 Accuracy +1 Medium Range Medium Main Gun', //--- 20.3 cm twin gun --- '203 cm twin gun mount': '20.3cm_Twin_Gun_Mount FirePower +8 Anti-air +3 Medium Range Medium Main Gun', '203cm twin gun mount': '20.3cm_Twin_Gun_Mount FirePower +8 Anti-air +3 Medium Range Medium Main Gun', '203 cm twin gun': '20.3cm_Twin_Gun_Mount FirePower +8 Anti-air +3 Medium Range Medium Main Gun', '203cm twin gun': '20.3cm_Twin_Gun_Mount FirePower +8 Anti-air +3 Medium Range Medium Main Gun', //--- 35.6 cm twin gun --- '356 cm twin gun mount': '35.6cm_Twin_Gun_Mount FirePower +15 Anti-air +4 Long Range Heavy Main Gun', '356cm mount': '35.6cm_Twin_Gun_Mount FirePower +15 Anti-air +4 Long Range Heavy Main Gun', '356 cm twin gun': '35.6cm_Twin_Gun_Mount FirePower +15 Anti-air +4 Long Range Heavy Main Gun', '356cm twin gun': '35.6cm_Twin_Gun_Mount FirePower +15 Anti-air +4 Long Range Heavy Main Gun', //--- 41 cm twin gun --- '41 cm twin gun mount': '41cm_Twin_Gun_Mount FirePower +20 Anti-air +4 Long Range Heavy Main Gun', '41cm twin gun mount': '41cm_Twin_Gun_Mount FirePower +20 Anti-air +4 Long Range Heavy Main Gun', '41 cm twin gun': '41cm_Twin_Gun_Mount FirePower +20 Anti-air +4 Long Range Heavy Main Gun', '41cm twin gun': '41cm_Twin_Gun_Mount FirePower +20 Anti-air +4 Long Range Heavy Main Gun', //--- 46 cm twin gun --- '46 cm triple gun mount': '46cm_Triple_Gun_Mount FirePower +26 Anti-air +5 Very Long Range Heavy Main Gun', '46cm triple gun mount': '46cm_Triple_Gun_Mount FirePower +26 Anti-air +5 Very Long Range Heavy Main Gun', '46 cm triple gun': '46cm_Triple_Gun_Mount FirePower +26 Anti-air +5 Very Long Range Heavy Main Gun', '46cm triple gun': '46cm_Triple_Gun_Mount FirePower +26 Anti-air +5 Very Long Range Heavy Main Gun', //--- 12.7 cm twin high angle --- '127 cm twin high angle mount': '12.7cm_Twin_High-angle_Mount FirePower +2 Anti-air +4 Accuracy +1 Short Range Secondary/AA Gun', '127cm twin high angle mount': '12.7cm_Twin_High-angle_Mount FirePower +2 Anti-air +4 Accuracy +1 Short Range Secondary/AA Gun', '127 cm twin high angle': '12.7cm_Twin_High-angle_Mount FirePower +2 Anti-air +4 Accuracy +1 Short Range Secondary/AA Gun', '127cm twin high angle': '12.7cm_Twin_High-angle_Mount FirePower +2 Anti-air +4 Accuracy +1 Short Range Secondary/AA Gun', //--- 15.5 cm triple gun mount secondary --- '155 cm triple gun mount secondary': '15.5cm_Triple_Gun_Mount_(Secondary) FirePower +7 Anti-air +3 Accuracy +2 Medium Range Secondary Gun', '155cm triple gun mount secondary': '15.5cm_Triple_Gun_Mount_(Secondary) FirePower +7 Anti-air +3 Accuracy +2 Medium Range Secondary Gun', '155 cm triple gun secondary':'15.5cm_Triple_Gun_Mount_(Secondary) FirePower +7 Anti-air +3 Accuracy +2 Medium Range Secondary Gun', '155cm triple gun secondary': '15.5cm_Triple_Gun_Mount_(Secondary) FirePower +7 Anti-air +3 Accuracy +2 Medium Range Secondary Gun', '155 cm triple yellow gun': '15.5cm_Triple_Gun_Mount_(Secondary) FirePower +7 Anti-air +3 Accuracy +2 Medium Range Secondary Gun', '155cm triple yellow gun': '15.5cm_Triple_Gun_Mount_(Secondary) FirePower +7 Anti-air +3 Accuracy +2 Medium Range Secondary Gun', //--- 15.2 cm naval gun --- '152 cm naval gun': '15.2cm_Naval_Gun FirePower +2 Accuracy +1 Medium Range Secondary Gun', '152cm naval gun': '15.2cm_Naval_Gun FirePower +2 Accuracy +1 Medium Range Secondary Gun', '152 cm yellow gun': '15.2cm_Naval_Gun FirePower +2 Accuracy +1 Medium Range Secondary Gun', '152cm yellow gun': '15.2cm_Naval_Gun FirePower +2 Accuracy +1 Medium Range Secondary Gun', //--- 15.2 cm naval gun --- '152 cm naval gun': '15.2cm_Naval_Gun FirePower +2 Accuracy +1 Medium Range Secondary Gun', '152cm naval gun': '15.2cm_Naval_Gun FirePower +2 Accuracy +1 Medium Range Secondary Gun', '152 cm yellow gun': '15.2cm_Naval_Gun FirePower +2 Accuracy +1 Medium Range Secondary Gun', '152cm yellow gun': '15.2cm_Naval_Gun FirePower +2 Accuracy +1 Medium Range Secondary Gun', //--- 61 cm triple torpedo mount --- '61 cm triple torpedo mount': '61cm_Triple_Torpedo_Mount Torpedo +5 Short Range Torpedo', '61cm triple torpedo mount': '61cm_Triple_Torpedo_Mount Torpedo +5 Short Range Torpedo', '61 cm triple torpedo': '61cm_Triple_Torpedo_Mount Torpedo +5 Short Range Torpedo', '61cm triple torpedo': '61cm_Triple_Torpedo_Mount Torpedo +5 Short Range Torpedo', //--- 61 cm quad torpedo mount --- '61 cm quad torpedo mount': '61cm_Quad_Torpedo_Mount Torpedo +7 Short Range Torpedo', '61cm quad torpedo mount': '61cm_Quad_Torpedo_Mount Torpedo +7 Short Range Torpedo', '61 cm quad torpedo': '61cm_Quad_Torpedo_Mount Torpedo +7 Short Range Torpedo', '61cm quad torpedo': '61cm_Quad_Torpedo_Mount Torpedo +7 Short Range Torpedo', //--- 61 cm quad O2 torpedo mount --- '61 cm quad o2 torpedo mount': '61cm_Quad_O2_Torpedo_Mount Torpedo +10 Short Range Torpedo', '61cm quad o2 torpedo mount': '61cm_Quad_O2_Torpedo_Mount Torpedo +10 Short Range Torpedo', '61 cm quad o2 torpedo': '61cm_Quad_O2_Torpedo_Mount Torpedo +10 Short Range Torpedo', '61cm quad o2 torpedo': '61cm_Quad_O2_Torpedo_Mount Torpedo +10 Short Range Torpedo', '61 cm quad oxygen torpedo mount': '61cm_Quad_O2_Torpedo_Mount Torpedo +10 Short Range Torpedo', '61cm quad oxygen torpedo mount': '61cm_Quad_O2_Torpedo_Mount Torpedo +10 Short Range Torpedo', '61 cm quad oxygen torpedo': '61cm_Quad_O2_Torpedo_Mount Torpedo +10 Short Range Torpedo', '61cm quad oxygen torpedo': '61cm_Quad_O2_Torpedo_Mount Torpedo +10 Short Range Torpedo', 'reppu':'Reppu', 'type 3 shell': 'Type_3_Shell', 'who is your waifu': function(input, name, isAdmin) { var shiplist = ["Mutsuki", "Kisaragi", "Yayoi", "Uzuki", "Satsuki", "Fumizuki", "Nagatsuki", "Kikuzuki", "Mikazuki", "Mochizuki", "Fubuki", "Shirayuki", "Hatsuyuki", "Miyuki", "Murakumo", "Isonami", "Ayanami", "Shikinami", "Oboro", "Akebono", "Sazanami", "Ushio", "Akatsuki", "Hibiki/Верный", "Ikazuchi", "Inazuma", "Hatsuharu", "Nenohi", "Wakaba", "Hatsushimo", "Shiratsuyu", "Shigure", "Murasame", "Yuudachi", "Harusame", "Samidare", "Suzukaze", "Asashio", "Ooshio", "Michishio", "Arashio", "Yamagumo", "Asagumo", "Arare", "Kasumi", "Kagerou", "Shiranui", "Kuroshio", "Hatsukaze", "Yukikaze", "Amatsukaze", "Tokitsukaze", "Urakaze", "Isokaze", "Hamakaze", "Tanikaze", "Nowaki", "Maikaze", "Akigumo", "Yuugumo", "Makigumo", "Naganami", "Takanami", "Asashimo", "Hayashimo", "Kiyoshimo", "Akizuki", "Shimakaze", "Z1", "Z3", "Tenryuu", "Tatsuta", "Kuma", "Tama", "Kitakami", "Ooi", "Kiso", "Nagara", "Isuzu", "Yura", "Natori", "Kinu", "Abukuma", "Yuubari", "Sendai", "Jintsuu", "Naka", "Agano", "Noshiro", "Yahagi", "Sakawa", "Ooyodo", "Furutaka", "Kako", "Aoba", "Kinugasa", "Myoukou", "Nachi", "Ashigara", "Haguro", "Takao", "Atago", "Maya", "Choukai", "Prinz Eugen", "Mogami", "Mikuma", "Suzuya", "Tone", "Kongou", "Hiei", "Haruna", "Kirishima", "Nagato", "Mutsu", "Yamato", "Musashi", "Bismarck", "Littorio/Italia", "Roma", "Fusou", "Yamashiro", "Ise", "Houshou", "Ryuujou", "Ryuuhou", "Hiyou", "Jun'you", "Shouhou", "Zuihou", "Akagi", "Kaga", "Souryuu", "Hiryuu", "Shoukaku", "Zuikaku", "Taihou", "Unryuu", "Amagi", "Katsuragi", "I-168", "I-8", "I-19", "I-58", "I-401", "Maruyu", "U-511/Ro-500", "Chitose", "Chiyoda", "Akitsushima", "Taigei", "Akashi", "Katori", "Akitsu Maru"]; var rand = Math.floor(Math.random * shiplist.length); var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: shiplist[rand] + "."}); mainRoom.socket.send(chatEntry.xport); },       'pick': function(input, name, isAdmin) { var choices = input.split(' or '); var rand = Math.floor(Math.random * choices.length); Speak(choices[rand] + '.'); },       'sink': 'kick', 'terminate': 'kick', 'exterminate': 'kick', 'kick': function(input, name, isAdmin) { if(!isAdmin) return true; var short = {'JWT': 'JustWastingTime', 'TS': 'TScript'}; if(short[input]) input = short[input]; Speak('Get rekt!'); var kickCommand = new models.KickCommand({userToKick: input}); mainRoom.socket.send(kickCommand.xport); },       'im kuso': 'kick me', 'kill me': 'kick me', 'kick me': function(input, name, isAdmin) { var kickCommand = new models.KickCommand({userToKick: name}); mainRoom.socket.send(kickCommand.xport); },       'reset': function(input, name, isAdmin) { if(isAdmin) { window.personal_cooldowns[input] = []; var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: 'Cooldowns reset for ' + input + '!'}); mainRoom.socket.send(chatEntry.xport); }       },        'reset all': function(input, name, isAdmin) { if(isAdmin) { window.personal_cooldowns = []; var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: 'All cooldowns reset!'}); mainRoom.socket.send(chatEntry.xport); }       },        'silence': function(input, name, isAdmin) { if(isAdmin) { window.silence = new Date.getTime + (parseInt(input) * 60000); }       },        'silence left': function(input, name, isAdmin) { if(name == 'Nanamin') { Speak(parseInt((window.silence - new Date.getTime) / 60000) + ' minutes remaining.'); }       },        'i wanna play': function(input, name, isAdmin) { if(!isAdmin) { if(window.players.indexOf(name) != -1) { var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: 'You already registered, ' + name}); } else { if(window.players === undefined) window.players = []; window.players.push(name); var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: name + ' has registered to play!'}); }           } else if(window.players.indexOf(name) != -1) { var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: name + ', you already registered.'}); } else { var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: name + ', you cannot play. Mods and admins are exempt from participating.'}); }                       mainRoom.socket.send(chatEntry.xport); },       'i quit': function(input, name, isAdmin) { var index = window.players.indexOf(name); if(index != -1) { window.players.splice(index, 1); var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: name + ' has quit!'}); } else { var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: name + ', you were never playing!'}); }           mainRoom.socket.send(chatEntry.xport); },       'russian roulette': function(input, name, isAdmin) { if(window.players.length < 2) { var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: 'We need at least two people.'}); } else { while(window.players.length > 1) { var rand = Math.floor(Math.random * window.players.length); var kickCommand = new models.KickCommand({userToKick: window.players[rand]}); mainRoom.socket.send(kickCommand.xport); window.players.splice(rand, 1); }               var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: window.players.pop + ' is the winner!'}); }           mainRoom.socket.send(chatEntry.xport); },       'whos playing': function(input, name, isAdmin) { if(window.players.length > 0) { var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: 'Players: ' + window.players.join(', ')}); } else { var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: 'Nobody is playing at the moment.'}); }           mainRoom.socket.send(chatEntry.xport); },       'register': function(input, name, isAdmin) { if(window.players === undefined) window.players = []; if(isAdmin) window.players.push(input); },       };        window.randomreplies = [ 'Page Not Found' ];       window.suicides = { 'TScript': 'suicide', 'Epicureanpancake': 'suicide', 'JustWastingTime': 'sudoku', 'McDerp': 'riot', 'Shizen144': 'futa', 'Sylcion': 'fukou', }       window.cooldown_time = new Date.getTime; window.personal_cooldowns = []; window.players = []; window.silence = 0; NodeChatDiscussion.prototype.respondToChat = function(chat) { // If silence is activated, just return here if(!window.silence) window.silence = 0; if(new Date.getTime < window.silence && chat.attributes.name != 'Nanamin') return true; // If somebody logs in, it's an inline alert if(chat.attributes.isInlineAlert && chat.attributes.text.indexOf('has joined the chat.') != -1) { /*               var name = chat.attributes.text.replace(' has joined the chat.', ''); var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: 'Hello, ' + name + '!'}); mainRoom.socket.send(chatEntry.xport); */           }            // All regular chats go here if(mainRoom.isInitialized && chat.attributes.name != wgUserName && !chat.attributes.isInlineAlert) { var text = chat.attributes.text; var name = chat.attributes.name; // Check if they're a mod or admin and put the stars 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);} // Remove any personal cooldowns that are past 10 minutes old if(window.personal_cooldowns[name] === undefined) window.personal_cooldowns[name] = []; for(var i = 0; i < window.personal_cooldowns[chat.attributes.name].length; i++) { if(new Date.getTime - window.personal_cooldowns[name][i] > 600000000000000) window.personal_cooldowns[name].shift; else break; }                       // Pull the text apart into its pieces var original_text = text.removePunctuation.removeTrailing(' ').substr(8); text = text.removePunctuation.removeTrailing(' ').toLowerCase; // Suicide checks if(window.suicides[name] && text.indexOf(window.suicides[name]) != -1) { var kickCommand = new models.KickCommand({userToKick: name}); mainRoom.socket.send(kickCommand.xport); }                       // Can only activate every 5 seconds and 3 times per 10 minutes UNLESS the user is a mod/admin if((new Date.getTime - window.cooldown_time > 5000 && window.personal_cooldowns[name].length < 3) || icon) { if(text.indexOf('jarvis') === 0) { text = text.substr(7); var command = original_text.split(' ')[0]; var input = original_text.split(' '); input.shift; if(window.autoreplies[text]) command = text; if(window.autoreplies[command.toLowerCase]) { while(typeof window.autoreplies[command.toLowerCase] != 'function') { // If the end point is a string, we won't be finding a function and it'll turn undefined. if(typeof window.autoreplies[command.toLowerCase] == 'undefined') { var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: command}); mainRoom.socket.send(chatEntry.xport); return true; }                                           command = window.autoreplies[command.toLowerCase]; }                                       return window.autoreplies[command].call(this, input.join(' '), chat.attributes.name, icon); } else { var rand = Math.floor(Math.random * window.randomreplies.length); var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: window.randomreplies[rand]}); mainRoom.socket.send(chatEntry.xport); }                                       window.cooldown_time = new Date.getTime; window.personal_cooldowns[name].push(new Date.getTime); }                       }                }        }        mainRoom.model.chats.bind('afteradd', $.proxy(mainRoom.viewDiscussion.respondToChat, mainRoom.viewDiscussion)); // When somebody else joins the room NodeRoomController.prototype.onJoin = function(message) { var joinedUser = new models.User; joinedUser.mport(message.data); if(joinedUser.get('name') == wgUserName) { this.userMain = joinedUser; }       if(this.partTimeOuts[joinedUser.get('name')]) { clearTimeout(this.partTimeOuts[joinedUser.get('name')]); this.partTimeOuts[joinedUser.get('name')] = null; }       var connectedUser = this.model.users.findByName(joinedUser.get('name')); if(typeof connectedUser == "undefined") { this.model.users.add(joinedUser); this.fire('afterJoin', joinedUser); if(this.isMain) { if(joinedUser.get('name') != wgUserName) { var newChatEntry = new models.InlineAlert({text:$.msg('chat-user-joined',[this.sanitizeHtml(joinedUser.get('name'))])}); this.model.chats.add(newChatEntry); var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: "Hello, " + this.sanitizeHtml(joinedUser.get('name')) + "!"}); mainRoom.socket.send(chatEntry.xport); }           }            this.disableRoom(joinedUser,false); } else { this.model.users.remove(connectedUser); this.model.users.add(joinedUser); }   }        NodeChatController.prototype.inlineAlert = function(text) { for(var i in text.split('\n')) { this.viewDiscussion.chatUL.append('' + text.split('\n')[i] + ''); }               this.viewDiscussion.scrollToBottom; }       function toggleAway { if($('#ChatHeader .User').hasClass('away') == true) { var setStatusCommand = new models.SetStatusCommand({statusState: STATUS_STATE_PRESENT, statusMessage: ''}); this.inlineAlert('You are no longer Away.'); this.socket.send(setStatusCommand.xport); } else { var setStatusCommand = new models.SetStatusCommand({statusState: STATUS_STATE_AWAY, statusMessage: ''}); this.inlineAlert('You are now Away.'); this.socket.send(setStatusCommand.xport); }       }        NodeChatController.prototype.clearWindow = function { this.viewDiscussion.chatUL.html(''); this.inlineAlert(i18n['cleared']); }       function active { //Returns the NodeChatController for the active window if(mainRoom.activeRoom && mainRoom.activeRoom != 'main') {return mainRoom.chats.privates[mainRoom.activeRoom];} else {return mainRoom;} }       String.prototype.removeTrailing = function(char) { //Remove extraneous characters var str = this; while(str.charAt(0) == char) {str = str.substring(1, str.length);} while(str.charAt(str.length - 1) == char) {str = str.substring(0, str.length - 1);} return str; }       String.prototype.removePunctuation = function { var str = this; str = str.replace(/[^a-zA-Z0-9ぁ-ゟ\s\-]/g, ""); str = str.replace(/\bbot-chan\b/gi, 'botchan'); return str; }       function Speak(text) { var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: text}); mainRoom.socket.send(chatEntry.xport); }       $(function  {                if(!importScriptURI) {function importScriptURI(a){var b=document.createElement("script");b.setAttribute("src",a);b.setAttribute("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(b);return b}}        $('#Write').append('' + i18n['afk'] + '' + i18n['clear'] + '');                $('head').append('\n.stafficon {\n\tmargin-bottom:-4px;\n\twidth:14px;\n\theight:14px;\n}\n.modicon {\n\tmargin-bottom:-3px;\n\twidth:14px;\n\theight:14px;\n}\n.UserStatsMenu {\n\tcolor:#000;\n}\n.Write [name="message"] {\n\twidth:93%;\n}\n.inline-alert span {\n\tcolor:#006CB0;\n\tcursor:pointer;\n}\n.inline-alert span:hover {\n\ttext-decoration:underline;\n}\n#pingspan {\n\tposition:absolute;\n\tz-index:5;\n\ttop:23px;\n\tmargin-left:15px;\n\tfont-size:15px;\n\tfont-weight:normal;\n\tline-height:15px;\n}\n#pings {\n\tresize:none;\n\tmargin-left:0;\n\tfont-size:12px;\n\theight:100px;\n\tdisplay:block;\n}\n#pingspan div span {\n\tfont-size:55%;\n}\n#ChatHeader {\n\tz-index:9999;\n}\n#ChatHeader {\n\tz-index:9999;\n}\n.message.ping {\n\tcolor:red;\n}\n '); $(window).unbind('mousemove').unbind('focus').unbind('keypress'); }); } else {       $(function { var a = document.getElementsByTagName('a'); for(var i = 0; i < a.length; i++) { if(a[i].href && a[i].href.indexOf('/wiki/Special:Chat') != -1) { a[i].addEventListener('click', function(event) {event.preventDefault; OpenChatWindow;}); a[i].removeAttribute('data-canonical'); }               }                if(document.body.className.indexOf('skin-oasis') != -1) {window.chatcheck = setInterval('ChatCheck', 200);} });       function ChatCheck {                if($('.chat-join button').length != 0) {                        $('.chat-join button').replaceWith('' + $('.chat-join button').html + '');                        clearInterval(window.chatcheck);                }        }        function OpenChatWindow {                window.chatwindow = window.open('/wiki/Special:Chat?useskin=wikia', 'chat');                window.chatwindow.onload = function  {                        window.chatwindow.importScriptPage('User:' + wgUserName + '/global.js', 'c');                        window.chatwindow.importScript('User:' + wgUserName + '/wikia.js');                }        } }