From ceec0f936746c28385d48e8a188fc023e1a1d2a9 Mon Sep 17 00:00:00 2001 From: Darren Date: Wed, 20 Jul 2011 15:16:12 +0100 Subject: [PATCH] Optional Node HTTP file serving, hotkey fixes --- css/default.css | 16 ++++++++++++++-- index.php | 18 ++++++++++++++++-- js/front.js | 24 ++++++++++++++++++------ node/client/index.html | 0 node/config.json | 5 +++-- node/kiwi.js | 11 ++++++++--- 6 files changed, 59 insertions(+), 15 deletions(-) create mode 100644 node/client/index.html diff --git a/css/default.css b/css/default.css index 7ba60a4..541c68d 100644 --- a/css/default.css +++ b/css/default.css @@ -102,14 +102,26 @@ body, html { font-family:Verdana, Geneva, sans-serif; font-size:.85em; line-height:18px; vertical-align:middle; - height:18px; + /*height:18px;*/ text-align:center; - white-space: nowrap; overflow: hidden; + /*white-space: nowrap;*/ overflow: hidden; padding: 3px 5px; border-bottom:3px solid #1B1B1B; } + +#kiwi_menu { + display:none; + position:absolute; + right:0px; + background: gray; + border: 1px solid dark-gray; +} +.cur_topic .edit:hover #kiwi_menu { display:inline; } + + + #kiwi .windows { position: absolute; top:92px; left:0px; diff --git a/index.php b/index.php index 6e09f2f..a2a6507 100644 --- a/index.php +++ b/index.php @@ -32,7 +32,7 @@ $node_server = $_SERVER['HTTP_HOST']; ?> - + @@ -183,7 +183,21 @@ -
+
+ +
+
diff --git a/js/front.js b/js/front.js index 36e3929..5ea42a0 100644 --- a/js/front.js +++ b/js/front.js @@ -58,7 +58,8 @@ var front = { front.registerKeys(); - + $('#kiwi .cur_topic').resize(front.doLayoutSize); + $('#kiwi .formconnectwindow').submit(function () { var netsel = $('#kiwi .formconnectwindow .network'); var nick = $('#kiwi .formconnectwindow .nick'); @@ -233,6 +234,12 @@ var front = { this.onNotice({}, {nick:gateway.nick, channel:dest, msg:msg}); break; + case '/win': + if (parts[1] !== undefined) { + front.windowsShow(parseInt(parts[1])); + } + break; + case '/quit': gateway.quit(msg.split(" ",2)[1]); break; @@ -474,8 +481,10 @@ var front = { return false; break; case e.which === 37: // left - if(e.altKey) front.windowsPrevious(); - return false; + if(e.altKey){ + front.windowsPrevious(); + return false; + } break; case e.which === 38: // up if (front.buffer_pos > 0) { @@ -484,8 +493,10 @@ var front = { } break; case e.which === 39: // right - if(e.altKey) front.windowsNext(); - return false; + if(e.altKey){ + front.windowsNext(); + return false; + } break; case e.which === 40: // down if (front.buffer_pos < front.buffer.length) { @@ -747,7 +758,8 @@ var front = { setTopicText: function (new_topic) { - $('#kiwi .cur_topic').text(new_topic); + $('#kiwi .cur_topic .topic').text(new_topic); + front.doLayoutSize(); }, diff --git a/node/client/index.html b/node/client/index.html new file mode 100644 index 0000000..e69de29 diff --git a/node/config.json b/node/config.json index a80939f..c31bf5c 100644 --- a/node/config.json +++ b/node/config.json @@ -6,5 +6,6 @@ "ssl_cert": "cert.pem", "quit_message": "KiwiIRC", "cap_options": [], - "handle_http": true -} + "handle_http": true, + "public_http": "./../" +} \ No newline at end of file diff --git a/node/kiwi.js b/node/kiwi.js index 6b90043..9beb306 100644 --- a/node/kiwi.js +++ b/node/kiwi.js @@ -6,14 +6,17 @@ var tls = require('tls'), https = require('https'), fs = require('fs'), url = require('url'), - static_server = require('node-static'), ws = require('socket.io'), - jade = require('jade'), _ = require('./lib/underscore.min.js'), starttls = require('./lib/starttls.js'); var config = JSON.parse(fs.readFileSync(__dirname + '/config.json', 'ascii')); +if (config.handle_http) { + var static_server = require('node-static'), + jade = require('jade'); +} + var ircNumerics = { RPL_WELCOME: '001', RPL_ISUPPORT: '005', @@ -276,7 +279,9 @@ var ircSocketDataHandler = function (data, websocket, ircSocket) { } }; -var fileServer = new (static_server.Server)(__dirname + '/client'); +if (config.handle_http) { + var fileServer = new (static_server.Server)(__dirname + config.public_http); +} var httpHandler = function (request, response) { var uri, subs, useragent, agent, server_set, server, nick, debug, touchscreen; -- 2.25.1