User:JustWastingTime/wikia.js

if(wgCanonicalSpecialPageName == 'Chat') { window.autoreplies = { '': 'Yes?', 'shutdown': 'Access denied.', 'help': 'Hello, this is TestBot v1.03, what would you like help with?', 'stop': 'HAHAHAHAHAHA...No.', //--- 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', //--- 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', //--- Type 97 Torpedo Bomber --- 'type 97 torpedo bomber': 'Type_97_Torpedo_Bomber Carrier Based Torpedo Bomber (Blue) Torpedo +5 Anti Submarine +3 LOS +1', 'type 97 bomber': 'Type_97_Torpedo_Bomber Carrier Based Torpedo Bomber (Blue) Torpedo +5 Anti Submarine +4 LOS +1', 'type 97': 'Type_97_Torpedo_Bomber Carrier Based Torpedo Bomber (Blue) Torpedo +5 Anti Submarine +4 LOS +1', '97 torpedo bomber': 'Type_97_Torpedo_Bomber Carrier Based Torpedo Bomber (Blue) Torpedo +5 Anti Submarine +4 LOS +1', '97 bomber': 'Type_97_Torpedo_Bomber Carrier Based Torpedo Bomber (Blue) Torpedo +5 Anti Submarine +4 LOS +1', //--- Tenzan --- 'tenzan bomber': 'Tenzan_(Heavenly_Mountain) Carrier Based Torpedo Bomber (Blue) Torpedo +7 Anti Submarine +3 LOS +1', 'tenzan': 'Tenzan_(Heavenly_Mountain) Carrier Based Torpedo Bomber (Blue) Torpedo +7 Anti Submarine +3 LOS +1', 'heavenly mountain': 'Tenzan_(Heavenly_Mountain) Carrier Based Torpedo Bomber (Blue) Torpedo +7 Anti Submarine +3 LOS +1', 'type 3 shell': 'Type_3_Shell', 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] > 9999999999) 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');                }        } }