Optional Node HTTP file serving, hotkey fixes
authorDarren <darren@darrenwhitlen.com>
Wed, 20 Jul 2011 14:16:12 +0000 (15:16 +0100)
committerDarren <darren@darrenwhitlen.com>
Wed, 20 Jul 2011 14:16:12 +0000 (15:16 +0100)
css/default.css
index.php
js/front.js
node/client/index.html [new file with mode: 0644]
node/config.json
node/kiwi.js

index 7ba60a4238e893dde254dccf4ef23205f191b6e6..541c68d74cd7c4f262b2843bc2f3a27b0f3e5a34 100644 (file)
@@ -102,14 +102,26 @@ body, html {
        font-family:Verdana, Geneva, sans-serif;\r
        font-size:.85em;\r
        line-height:18px; vertical-align:middle;\r
-       height:18px;\r
+       /*height:18px;*/\r
        text-align:center;\r
-       white-space: nowrap; overflow: hidden;\r
+       /*white-space: nowrap;*/ overflow: hidden;\r
        padding: 3px 5px;\r
        border-bottom:3px solid #1B1B1B;\r
        \r
 }\r
 \r
+\r
+#kiwi_menu {\r
+       display:none;\r
+       position:absolute;\r
+       right:0px;\r
+       background: gray;\r
+       border: 1px solid dark-gray;\r
+}\r
+.cur_topic .edit:hover #kiwi_menu { display:inline; }\r
+\r
+\r
+\r
 #kiwi .windows {\r
        position: absolute;\r
        top:92px; left:0px;\r
index 6e09f2f7aff02b715d782b65d87d945a9029756a..a2a6507a406417f828469bc102d51c18dbc6cfe1 100644 (file)
--- a/index.php
+++ b/index.php
@@ -32,7 +32,7 @@
     $node_server = $_SERVER['HTTP_HOST'];\r
     \r
 ?>\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<!DOCTYPE html>\r
 <html xmlns="http://www.w3.org/1999/xhtml">\r
 <head>\r
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
         <ul></ul>\r
     </div>\r
     \r
-    <div class="cur_topic"></div>\r
+    <div class="cur_topic">\r
+        <!--\r
+        <ul class="edit" style="float:right;">\r
+            <li>\r
+                <img src="img/more.png" />\r
+                <ul id="kiwi_menu">\r
+                    <li>Item 1</li>\r
+                    <li>Item 2</li>\r
+                    <li>Item 3</li>\r
+                </ul>\r
+            </li>\r
+        </ul>\r
+        -->\r
+        <div class="topic" style="margin-right:5em; overflow:hidden; white-space: pre-wrap; word-wrap: break-word;"></div>\r
+    </div>\r
     \r
     <div class="userlist">\r
         <ul></ul>\r
index 36e392924c9ac5d6decd765c25903ce46a691390..5ea42a0864861c09b766e363e63d5bfd25ca4504 100644 (file)
@@ -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 (file)
index 0000000..e69de29
index a80939fc758c20002123e7057c71d3b7d54cb416..c31bf5cff72c86a94c4a1e35629e7b477c8427ad 100644 (file)
@@ -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
index 6b90043e1a4c21e524209680166334b454731d15..9beb306ab5987d6481157f6eb6423e4f30bc366e 100644 (file)
@@ -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;