Log client startup errors to console
[KiwiIRC.git] / client / src / app.js
index 9a5189642f612aaf3d3e950e9c918bbdbb28163c..619507cc7e2569c22b6f35c2cf12d77573571142 100644 (file)
@@ -8,6 +8,7 @@ _kiwi.misc = {};
 _kiwi.model = {};\r
 _kiwi.view = {};\r
 _kiwi.applets = {};\r
+_kiwi.utils = {};\r
 \r
 \r
 /**\r
@@ -23,6 +24,7 @@ _kiwi.global = {
     rpc: undefined, // Instance of WebsocketRpc\r
     utils: {}, // References to misc. re-usable helpers / functions\r
 \r
+    // Make public some internal utils for plugins to make use of\r
     initUtils: function() {\r
         this.utils.randomString = randomString;\r
         this.utils.secondsToTime = secondsToTime;\r
@@ -31,6 +33,9 @@ _kiwi.global = {
         this.utils.formatIRCMsg = formatIRCMsg;\r
         this.utils.styleText = styleText;\r
         this.utils.hsl2rgb = hsl2rgb;\r
+\r
+        this.utils.notifications = _kiwi.utils.notifications;\r
+        this.utils.formatDate = _kiwi.utils.formatDate;\r
     },\r
 \r
     addMediaMessageType: function(match, buildHtml) {\r
@@ -114,8 +119,9 @@ _kiwi.global = {
                 kiwi: 'kiwi', raw: 'raw', kick: 'kick', topic: 'topic',\r
                 part: 'part', join: 'join', action: 'action', ctcp: 'ctcp',\r
                 ctcpRequest: 'ctcpRequest', ctcpResponse: 'ctcpResponse',\r
-                notice: 'notice', msg: 'privmsg', changeNick: 'changeNick',\r
-                channelInfo: 'channelInfo', mode: 'mode', quit: 'quit'\r
+                notice: 'notice', msg: 'privmsg', say: 'privmsg',\r
+                changeNick: 'changeNick', channelInfo: 'channelInfo',\r
+                mode: 'mode', quit: 'quit'\r
             };\r
 \r
             _.each(funcs, function(gateway_fn, func_name) {\r
@@ -187,6 +193,9 @@ _kiwi.global = {
                 };\r
             });\r
 \r
+            // Give access to the control input textarea\r
+            obj.input = _kiwi.app.controlbox.$('.inp');\r
+\r
             return obj;\r
         }\r
     },\r
@@ -241,6 +250,9 @@ _kiwi.global = {
             _kiwi.global.plugins = new _kiwi.model.PluginManager();\r
 \r
             callback();\r
+\r
+        }).then(null, function(err) {\r
+            console.error(err.stack);\r
         });\r
     },\r
 \r