summaryrefslogtreecommitdiffstats
path: root/webchat/public/client.js
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-12-30 03:10:21 +0100
committermakefu <github@syntax-fehler.de>2013-12-30 03:10:21 +0100
commit7f222f547283b03a6e53ef69b228abf11e46e5c8 (patch)
tree979b46b20d8c7e54ce8f6bea441c6dfd736d8271 /webchat/public/client.js
parent4db3c97ab8a76bd28dc737755c331e89a671d162 (diff)
webchat -> Cancher
Diffstat (limited to 'webchat/public/client.js')
-rw-r--r--webchat/public/client.js70
1 files changed, 0 insertions, 70 deletions
diff --git a/webchat/public/client.js b/webchat/public/client.js
deleted file mode 100644
index 54ccfe34..00000000
--- a/webchat/public/client.js
+++ /dev/null
@@ -1,70 +0,0 @@
-var settings = {}
-settings.sock = new SockJS('/echo');
-settings.waiting_callbacks = {}
-
-var transport = make_sockjs_client_transport(settings.sock)
-settings.rpc = new RPC(transport)
-
-settings.rpc.register('msg', {type: 'string', nick: 'string', msg: 'string'}, function(params, callback) {
- var safe_message = $('<div/>').text(params.msg).html();
- safe_message = replaceURLWithHTMLLinks(safe_message);
- var safe_from = $('<div/>').text(params.nick).html();
- chatboxAppend(safe_from, safe_message, 'web_msg')
- return callback(null)
-})
-settings.rpc.register('nick', {type: 'string', newnick: 'string', oldnick: 'string'}, function(params, callback) {
- var safe_oldnick = $('<div/>').text(params.oldnick).html();
- var safe_newnick = $('<div/>').text(params.newnick).html();
- var safe_type = $('<div/>').text(params.type).html();
- if (safe_oldnick === settings.nick){
- settings.nick = safe_newnick
- $('#nick').html(settings.nick)
- }
- $(getNicklistElement(safe_oldnick,safe_type)).remove();
- $('#nicklist').append('<div class="'+safe_type+'_name">' + safe_newnick + '</div>') ;
- chatboxAppend(safe_oldnick, 'is now known as ' + safe_newnick, 'nick');
- return callback(null)
-})
-settings.rpc.register('your_nick', {nick: 'string'}, function(params, callback) {
- var safe_nick = $('<div/>').text(params.nick).html();
- settings.nick = safe_nick
- $('#nick').html(settings.nick)
- return callback(null)
-})
-settings.rpc.register('join', {type: 'string', nick: 'string'}, function(params, callback) {
- var safe_nick = $('<div/>').text(params.nick).html();
- var safe_type = $('<div/>').text(params.type).html();
- $('#nicklist').append('<div class="'+safe_type+'_name">' + safe_nick + '</div>') ;
- chatboxAppend(safe_nick, 'has joined');
- return callback(null)
-})
-settings.rpc.register('part', {type: 'string', nick: 'string'}, function(params, callback) {
- var safe_nick = $('<div/>').text(params.nick).html();
- var safe_type = $('<div/>').text(params.type).html();
- $(getNicklistElement(safe_nick,safe_type)).remove();
- chatboxAppend(safe_nick, 'has parted');
- return callback(null)
-})
-
-$(function updateTime () {
- $('#time').html(getCurTime());
- setTimeout(updateTime,'1000');
- return true;
-});
-
-
-$(function() {
- $('#input').keydown(function(e) {
- if (e.keyCode === 13) {
- e.preventDefault();
- e.stopPropagation();
- e.stopImmediatePropagation();
- var input = ($('#input').val());
- $('#input').val('')
-
- var command = inputParser(input)
- return (commands[command.method] || commands.badcommand)(settings, command.params)
- }
- });
-
-});