From: Darren Date: Fri, 23 Sep 2011 21:31:58 +0000 (+0100) Subject: Tidying, all.js parsing with uglify-js fix, nickchange event fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=bfdeb8721f7b8b371a2f2eda0e70cad71d19d0bf;p=KiwiIRC.git Tidying, all.js parsing with uglify-js fix, nickchange event fix --- diff --git a/js/front.events.js b/js/front.events.js index 222ef9f..a6aecd6 100644 --- a/js/front.events.js +++ b/js/front.events.js @@ -369,7 +369,7 @@ kiwi.front.events = { onNick: function (e, data) { if (data.nick === kiwi.gateway.nick) { kiwi.gateway.nick = data.newnick; - kiwi.front.doLayout(); + kiwi.front.ui.doLayout(); } _.each(Tabview.getAllTabs(), function (tab) { @@ -473,7 +473,7 @@ kiwi.front.events = { } kiwi.front.doLayout(); - }, + } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/js/front.js b/js/front.js index 09e8aa9..2ed278c 100644 --- a/js/front.js +++ b/js/front.js @@ -7,12 +7,11 @@ kiwi.front = { utilityviews: {}, boxes: {}, - buffer: [], - buffer_pos: 0, + buffer: [], // Command history + buffer_pos: 0, // Current command history position - cache: {}, - - original_topic: '', + // Container for misc data (eg. userlist generation) + cache: {original_topic: '', userlist: {}}, init: function () { /*global Box, touch_scroll:true, Tabview */ @@ -23,8 +22,6 @@ kiwi.front = { // Bind to the gateway events kiwi.front.events.bindAll(); - this.buffer = []; - // Build the about box kiwi.front.boxes.about = new Box("about"); about_info = 'UI adapted for ' + agent; @@ -48,6 +45,10 @@ kiwi.front = { kiwi.front.ui.registerKeys(); + window.onbeforeunload = function() { + return "Are you sure you leave Kiwi IRC?"; + } + $('#kiwi .toolbars').resize(kiwi.front.ui.doLayoutSize); $(window).resize(kiwi.front.ui.doLayoutSize); @@ -141,7 +142,7 @@ kiwi.front = { } else if (e.which === 27) { // escape e.preventDefault(); - $(this).text(kiwi.front.original_topic); + $(this).text(kiwi.front.cache.original_topic); $('#kiwi_msginput').focus(); } }); @@ -154,13 +155,13 @@ kiwi.front = { } else if (e.keyCode === 27) { // escape e.preventDefault(); - $(this).text(kiwi.front.original_topic); + $(this).text(kiwi.front.cache.original_topic); } });*/ $('.cur_topic').live('change', function () { var chan, text; text = $(this).text(); - if (text !== kiwi.front.original_topic) { + if (text !== kiwi.front.cache.original_topic) { chan = Tabview.getCurrentTab().name; kiwi.gateway.setTopic(chan, text); } @@ -373,6 +374,7 @@ kiwi.front = { default: //Tabview.getCurrentTab().addMsg(null, ' ', '--> Invalid command: '+parts[0].substring(1)); kiwi.gateway.raw(msg.substring(1)); + break; } } else { diff --git a/js/front.ui.js b/js/front.ui.js index b522e47..1906d84 100644 --- a/js/front.ui.js +++ b/js/front.ui.js @@ -278,7 +278,7 @@ kiwi.front.ui = { setTopicText: function (new_topic) { - kiwi.front.original_topic = new_topic; + kiwi.front.cache.original_topic = new_topic; $('#kiwi .cur_topic .topic').text(new_topic); kiwi.front.ui.doLayoutSize(); }, @@ -356,6 +356,6 @@ kiwi.front.ui = { barsHide: function () { $('#kiwi .toolbars').slideUp(); $('#kiwi .control').slideUp(); - }, + } -} \ No newline at end of file +}; \ No newline at end of file