WhisperWindow

By skyboy026 Last update Apr 12, 2013 — Installed 736 times.

There are 20 previous versions of this script.

// ==UserScript==
// @name            WhisperWindow
// @namespace       skyboy@kongregate
// @author          skyboy
// @version         1.1.1
// @description     Allows you to have whisper conversations in a separate chat tab, type /pmwnd to open it. Whisper someone as you normally would initially, after that first message, you don't need that any more.
// @include         http://www.kongregate.com/games/*/*
// @homepage        http://userscripts.org/scripts/show/73689
// ==/UserScript==
if (/^\/?games\/[^\/]+\/[^\/?]+(\?.*)?$/.test(window.location.pathname)) {
setTimeout(function() {
	javascript:void((function(){window.location.assign("javascript:void($('gamepage_header').insert('<style>#kong_game_ui ul.main_tabs li#private_tab.stacked a#private.active{background-position:-557px -48px}#kong_game_ui ul.main_tabs li#private_tab.stacked a#private, #kong_game_ui ul.main_tabs li#avatar_tab.stacked a#avatar{background-position:-557px -73px}#kong_game_ui ul.main_tabs li#private_tab a#private.active{background-position:-557px 0}#kong_game_ui ul.main_tabs li#private_tab a#private{background-position:-557px -25px;width:62px}</style>'))");setTimeout(function(){window.location.assign("javascript:void((function(){$('other_tab').insert({before:new Element('li',{'class':'tab closeable', id:'private_tab'}).hide()});$('alert_tab_pane').insert({before:new Element('div',{id:'private_tab_pane','class':'tabpane','style':'height:'+($('alert_tab_pane').style.height||'410px')+';'}).hide()})})())");setTimeout(function(){window.location.assign('javascript:void(document.observe("holodeck:ready",function(){$("private_tab").update(\'<a href="#private_tab_pane" id="private" class=""><span style="float: left">Whisper</span><span class="close_tab_link">Close</span></a>\');$("private_tab_pane").update(\'<div id="private_tab_pane_content"><div class="chat_message_window" style="height:\'+(holodeck._height-91||"401")+\'px"></div><div class="chat_controls"><textarea class="chat_input"></textarea></div><div class="guest_chat_controls" style="display:none;"><a href="#" onclick="holodeck.showSignupTab();return !1">Register</a> or <a href="#" onclick="active_user.activateInlineLogin();return !1">Sign in</a> to <strong>chat now</strong>, earn points, level up and track your progress!</div><div class="silenced_chat_controls" style="display:none;">You have been silenced for <span class="silence_duration"></span>.&nbsp; Click <a href="/pages/silenced" target="_blank">here</a> to read about silences.</div></div>\');var g=holodeck._tabs;g.addTab.bind(g,$("private")).defer();})())');setTimeout(function(){window.location.assign("javascript:void(document.observe('holodeck:ready',function(){var g=ChatWindow.prototype,j=g.insertInActiveChatInput,h=g.sendPrivateMessage,info={u:'nul'},d=$('private_tab_pane'),q=new ChatDialogue(d,0,holodeck,holodeck.chatWindow()); Object.extend(q,{_onInputFunction:function(a){var c=this,b=a.strip().match(/^\\/(?:w|msg)\\s+([a-zA-Z0-9_]+)\\s+([\\s\\S]+)/);if(b){a=b[2];info.u=b=b[1]}else b=info.u;if(/^\\/(?!w|msg)/.test(a)){if(!c._holodeck.processChatCommand(a))return}c._holodeck.filterOutgoingMessage(a.strip(),function(a){c.sendPrivateMessage(b,a)})},sendInput:function(){var a=this._input_node;this._onInputFunction(a.value);a.value=''},scrollToBottom:function(){var T=this._message_window_node;T.scrollTop=T.scrollHeight+20},sendPrivateMessage:function(u,m){this._holodeck.chatWindow().sendPrivateMessage(u,m);q.displayMessage(u,m,{'class':'whisper sent_whisper'},{'private':!0});}});g.sendPrivateMessage=function(u,m){if(u&&m)info.u=u,h.call(this,u,m)};holodeck.addChatCommand('pmwnd',(function(b,d){d=d.match(/^\\/pmwnd\\s*(.*)\\s*/i);this._holodeck._tabs.show('private_tab_pane');(b=this._input_node).focus();if(!b.value)b.value=d[1];return !1}).bind(q));holodeck.registerKonduitCallback(KonduitEvent.PRIVATE_MESSAGE,function(e){q.receivedPrivateMessage(e)});g.insertInActiveChatInput=function(t){if(d.style.display=='none')j.call(this,t);else q.setInput(t)}})())")},100)},100)},100)})());
}, 1250);
}