User:Tsurumaru Kuninaga/TsuruBot.js

if(wgCanonicalSpecialPageName == 'Chat') { window.autoreplies = { '^$': 'Yup?', '^o$': 'o7', '^o7$': 'o/', '^\^5.?$': 'ヽ(. ワ ﾟ )ノヽ( ﾟ ワ . )ノ', '^beep.?$': 'Boop.', '^boop.?$': 'Beep.', '^beep boop.?$': 'Boop beep.', '^boop beep.?$': 'Beep boop.', '\\bhelp\\b': 'stupid question', '^stupidquestion': '(newsflash) READ THE FOCKIN\' WIKI!', '^hi': 'Hello.', '^hello': 'Hi.', '^ohayou?': '^おはよう', '^おはよう': 'おはようございます！', '^goodnight': 'Good night!',} mainRoom.model.chats.bind('afteradd', $.proxy(mainRoom.viewDiscussion.respondToChat, mainRoom.viewDiscussion)); NodeChatController.prototype.onOpenPrivateRoom = function(message) { var room = new models.OpenPrivateRoom; room.mport(message.data); var users = room.get('users'); for(var i = 0; i < users.length; i++) { if(users[i] != wgUserName) { var blockedUser = this.model.blockedUsers.findByName(users[i]); if(typeof(blockedUser) != 'undefined' && blockedUser.get('name') == users[i]) { return; }   		}    	}    	if(typeof(this.chats.privates[room.get('roomId')]) == 'undefined') { this.baseOpenPrivateRoom(room, false); }   	this.chats.privates[room.get('roomId')].init; this.chats.privates.model.chats.bind('afteradd', $.proxy(this.chats.privates[room.get('roomId')].viewDiscussion.respondToChat, this.chats.privates[room.get('roomId')].viewDiscussion)); }	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: ''}); mainRoom.inlineAlert('You are no longer Away.'); mainRoom.socket.send(setStatusCommand.xport); } else { var setStatusCommand = new models.SetStatusCommand({statusState: STATUS_STATE_AWAY, statusMessage: ''}); mainRoom.inlineAlert('You are now Away.'); mainRoom.socket.send(setStatusCommand.xport); }	}	NodeChatController.prototype.clearWindow = function { this.viewDiscussion.chatUL.html(''); this.inlineAlert('The window has been 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; }	function Speak(text) { var chatEntry = new models.ChatEntry({roomId: mainRoom.roomId, name: wgUserName, text: text}); mainRoom.socket.send(chatEntry.xport); }	function Kick(name) { if(mainRoom.model.users.findByName(name) === undefined && name.split('').pop == '.') { name = name.split(''); name.pop; name = name.join(''); }	   var kickCommand = new models.KickCommand({userToKick: name}); mainRoom.socket.send(kickCommand.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('Toggle Away StatusClear window');		$('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');		}	} }