About: ChatHacks.js   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

/**/ /* * CODE ENTIRELY CODED BY MONCHOMAN45 - THIS VERSION HAS SLIGHT MODIFICATIONS * / /* * ChatHacks.js, by Monchoman45. * Version 5.0.3.stillHasSomeFails * * Features: * Ability to clear your chat window * A host of slash commands (including /me and /afk) * 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 */ importScriptURI('); var connectedUser = this.model.users.findByName(joinedUser.get('name'));

AttributesValues
rdfs:label
  • ChatHacks.js
rdfs:comment
  • /**/ /* * CODE ENTIRELY CODED BY MONCHOMAN45 - THIS VERSION HAS SLIGHT MODIFICATIONS * / /* * ChatHacks.js, by Monchoman45. * Version 5.0.3.stillHasSomeFails * * Features: * Ability to clear your chat window * A host of slash commands (including /me and /afk) * 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 */ importScriptURI('); var connectedUser = this.model.users.findByName(joinedUser.get('name'));
dcterms:subject
abstract
  • /**/ /* * CODE ENTIRELY CODED BY MONCHOMAN45 - THIS VERSION HAS SLIGHT MODIFICATIONS * / /* * ChatHacks.js, by Monchoman45. * Version 5.0.3.stillHasSomeFails * * Features: * Ability to clear your chat window * A host of slash commands (including /me and /afk) * 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;}); importScriptURI('); //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(' ').split(' '); 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 $('#sound').html(''); 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').children('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('You are now 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('You are no longer away.'); 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)); //Functions that have to be changed for interwiki chat NodeChatController.prototype.openPrivateRoom = function(users) { users.push( wgUserName ); $.ajax({ type: 'POST', url: wgScript + '?action=ajax&rs=ChatAjax&method=getPrivateRoomID', data: { users : users.join(',') }, success: $.proxy(function(data) { $().log("Attempting create private room with users " + users.join(',')); var data = new models.OpenPrivateRoom({roomId: data.id, users: users}); this.baseOpenPrivateRoom(data, true); this.showRoom(data.get('roomId') ); this.chats.privates[ data.get('roomId') ].isPrivate = true; this.chats.privates[ data.get('roomId') ].init(); //this.socket.send(data.xport()); }, this) }); this.viewUsers.hideMenu(); } NodeRoomController.prototype.onJoin = function(message) { var joinedUser = new models.User(); joinedUser.mport(message.joinData); var connectedUser = this.model.users.findByName(joinedUser.get('name')); if(typeof connectedUser == "undefined"){ this.model.users.add(joinedUser); this.fire('afterJoin', joinedUser); //TODO: move it to other class if( !this.isPrivate ) { // Create the inline-alert (on client side so that we only display it if the user actually IS new to the room and not just disconnecting/reconnecting). var newChatEntry = new models.InlineAlert({text: $.msg('chat-user-joined', [joinedUser.get('name')] ) }); this.model.chats.add(newChatEntry); } this.disableRoom(joinedUser, false); } else { // The user is already in the room... just update them (in case they have changed). this.model.users.remove(connectedUser); this.model.users.add(joinedUser); } } NodeRoomController.prototype.onPart = function(message) { var partedUser = new models.User(); partedUser.mport(message.data); var connectedUser = this.model.users.findByName(partedUser.get('name')); if(typeof connectedUser != "undefined"){//TODO: move it to other class if( !this.isPrivate ) { var newChatEntry = new models.InlineAlert({text: $.msg('chat-user-parted', [connectedUser.get('name')] ) }); this.model.chats.add(newChatEntry); } this.model.users.remove(connectedUser); this.disableRoom(connectedUser, true); } } NodeRoomController.prototype.disableRoom = function(user, flag) { if( this.isPrivate == false ) { //TODO: fix it for multiuser priv chat var privateUser = this.model.privateUsers.findByName(user.get('name')); if(typeof privateUser != "undefined"){ var roomId = privateUser.get('roomId'); if( typeof( this.chats.privates[roomId] ) != "undefined" ){ this.chats.privates[roomId].model.room.set({ 'blockedMessageInput': flag }); } //try to reconnect if(flag === false && this.chats.privates[roomId].model.chats.length > 0) { this.socket.send( this.chats.privates[roomId].model.privateRoom.xport() ); } } } } NodeChatController.prototype.showRoom = function(roomId) { $().log(roomId); if( this.activeRoom == roomId ) { return false; } this.activeRoom = roomId; if(roomId == 'main') { this.chats.main.setActive(true); } else { this.chats.main.setActive(false); } for(var i in this.chats.privates) { if(i == roomId) { this.chats.privates[i].setActive(true); } else { this.chats.privates[i].setActive(false); } } for(var i in this.chats.opens) { if(i == roomId) { this.chats.opens[i].setActive(true); } else { this.chats.opens[i].setActive(false); } } return true; } NodeChatController.prototype.openPublicRoom = function(roomId) { this.chats.opens[roomId] = new NodeRoomController(roomId); this.chats.opens[roomId].mainController = this; //set main controller for this chat room this.showRoom(roomId); this.chats.opens[roomId].init(); } /*//For interwiki chatting, a merger of NodeRoomController's private management functions, and NodeChatController's public management functions. NodeInterwikiController = $.createClass(NodeRoomController, { constructor: function (roomId) { NodeInterwikiController.superclass.constructor.apply(this,arguments); this.socket.bind('updateUser', $.proxy(this.onUpdateUser, this)); //Check this.bind('afterJoin', $.proxy(this.afterJoin, this)); this.viewUsers = new NodeChatUsers({model: this.model, el: $('body')}); this.viewUsers.bind('showPrivateMessage', $.proxy(this.privateMessage, this) ); this.viewUsers.bind('kickBan', $.proxy(this.kickBan, this) ); this.viewUsers.bind('giveChatMod', $.proxy(this.giveChatMod, this) ); this.viewUsers.bind('blockPrivateMessage', $.proxy(this.blockPrivate, this) ); //Check this.viewUsers.bind('allowPrivateMessage', $.proxy(this.allowPrivate, this) ); //Check this.viewUsers.bind('mainListClick', $.proxy(this.mainListClick, this) ); //Check this.viewUsers.bind('privateListClick', $.proxy(this.privateListClick, this) ); //Check this.viewUsers.bind('clickAnchor', $.proxy(this.clickAnchor, this) ); //Check this.viewUsers.render(); this.viewDiscussion.show(); return this; } });*/ NodeChatController.prototype.inlineAlert = function(text) { this.viewDiscussion.chatUL.append(' ' + text + ''); this.viewDiscussion.scrollToBottom(); } function FlashTitle() { if(document.getElementsByTagName('title')[0].innerHTML == window.titleorig) { document.getElementsByTagName('title')[0].innerHTML = 'Activity - ' + wgSiteName + ' chat'; } else { document.getElementsByTagName('title')[0].innerHTML = window.titleorig; } } function Preparse(input) { //Parse slash commands. var text = input.split(' '); if(text[0]) {text[0] = text[0].toLowerCase();} switch(text[0]) { case '/away': case '/afk': //Toggle away status if($('#ChatHeader .User').hasClass('away') == false) {toggleAway();} //if you're away, hitting enter has already sent you back break; case '/me': //Emote if(text[1] != undefined) {$('#Write [name="message"]').val('* ' + wgUserName + ' ' + build(text, 1));} else {$('#Write [name="message"]').val('* ' + wgUserName);} case ' ': //Emote if(text[1] != undefined) {$('#Write [name="message"]').val(' ' + wgUserName + ' ' + build(text, 1));} else {$('#Write [name="message"]').val(' ');} return true; break; case '/nc': //Nobody cares if(text[1] != undefined) {$('#Write [name="message"]').val('' + build(text, 1) + '');} else {$('#Write [name="message"]').val('Nobody cares');} return true; break; case '/coppa': //Too young if(text[1] != undefined) {$('#Write [name="message"]').val(' ' + build(text, 1));} else {$('#Write [name="message"]').val(' - You must be 13 or older to have an account on Wikia.')} return true; break; case '/kick': case '/ban': case '/kb': case '/kickban': //Kickban a user if(text[1]) { var mod = new models.KickBanCommand({userToBan: build(text, 1)}); this.socket.send(mod.xport()); } else {this.inlineAlert(text[0] + ' error: User must be specified');} break; case '/unban': //Unban a user if(text[1]) { api.newQuery(POST, 'action=userrights&user=' + build(text, 1) + '&remove=bannedfromchat', function(result) { if(result.userrights.removed[0] == 'bannedfromchat') { this.inlineAlert(build(text, 1) + ' was unbanned.'); } else { this.inlineAlert(build(text, 1) + ' is not banned.'); } }); api.send(0, true); } else {this.inlineAlert(text[0] + ' error: User must be specified');} break; case '/mod': //Make a user a mod if(text[1]) { var giveChatModCommand = new models.GiveChatModCommand({userToPromote: build(text, 1)}); this.socket.send(giveChatModCommand.xport()); } else {this.inlineAlert(text[0] + ' error: User must be specified');} break; case '/demod': //Remove a user's mod right if(text[1]) { api.newQuery(POST, 'action=userrights&user=' + build(text, 1) + '&remove=chatmoderator', function(result) { if(result.userrights.removed[0] == 'chatmoderator') { this.inlineAlert(build(text, 1) + ' was demodded.'); } else { this.inlineAlert(build(text, 1) + ' is not a mod.'); } }); api.send(0, true); } else {this.inlineAlert(text[0] + ' error: User must be specified');} break; case '/block': //Block a user from private chatting you if(text[1]) {this.blockPrivate({name: build(text, 1)});} else {this.inlineAlert(text[0] + ' error: User must be specified');} break; case '/unblock': //Unblock a user from private chatting you - should merge this into a toggle if(text[1]) {this.allowPrivate({name: build(text, 1)});} else {this.inlineAlert(text[0] + ' error: User must be specified');} break; case '/chat': case '/room': case '/private': //Invoke a private room if(text[1]) { var array = build(text, 1).split('|'); for(var i in array) {array[i] = array[i].removeTrailing(' ');} mainRoom.openPrivateChat(array); } else {this.inlineAlert(text[0] + ' error: Users must be specified');} break; case '/enter': case '/join': //Now for a command with chutzpah - join any chat on Wikia //Need to fix this so that joined rooms can be selected if(text[1]) { var data = new models.OpenPrivateRoom({roomId: text[1]}); mainRoom.baseOpenPrivateRoom(data, true); $('.private').before('
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software