From: Darren Date: Mon, 5 Nov 2012 16:02:31 +0000 (+0000) Subject: Client: Private `kiwi` namespace renamed to `_kiwi` X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=eaaf73b05bc67b56b372cdcd38a5a9b4dc6e733d;p=KiwiIRC.git Client: Private `kiwi` namespace renamed to `_kiwi` --- diff --git a/client/assets/dev/app.js b/client/assets/dev/app.js index c680b41..50a0fc2 100644 --- a/client/assets/dev/app.js +++ b/client/assets/dev/app.js @@ -1,12 +1,12 @@ -// Holds anything kiwi client specific (ie. front, gateway, kiwi.plugs..) +// Holds anything kiwi client specific (ie. front, gateway, _kiwi.plugs..) /** * @namespace */ -var kiwi = {}; +var _kiwi = {}; -kiwi.model = {}; -kiwi.view = {}; -kiwi.applets = {}; +_kiwi.model = {}; +_kiwi.view = {}; +_kiwi.applets = {}; /** @@ -14,7 +14,7 @@ kiwi.applets = {}; * Will be used to access a limited subset of kiwi functionality * and data (think: plugins) */ -kiwi.global = { +_kiwi.global = { utils: undefined, // Re-usable methods gateway: undefined, user: undefined, @@ -28,13 +28,13 @@ kiwi.global = { start: function (opts) { opts = opts || {}; - kiwi.app = new kiwi.model.Application(opts); + _kiwi.app = new _kiwi.model.Application(opts); if (opts.kiwi_server) { - kiwi.app.kiwi_server = opts.kiwi_server; + _kiwi.app.kiwi_server = opts.kiwi_server; } - kiwi.app.start(); + _kiwi.app.start(); return true; } @@ -44,5 +44,8 @@ kiwi.global = { // If within a closure, expose the kiwi globals if (typeof global !== 'undefined') { - global.kiwi = kiwi.global; + global.kiwi = _kiwi.global; +} else { + // Not within a closure so set a var in the current scope + var kiwi = _kiwi.global; } \ No newline at end of file diff --git a/client/assets/dev/applet_chanlist.js b/client/assets/dev/applet_chanlist.js index 2c32e14..629ea09 100644 --- a/client/assets/dev/applet_chanlist.js +++ b/client/assets/dev/applet_chanlist.js @@ -50,7 +50,7 @@ - kiwi.applets.Chanlist = Backbone.Model.extend({ + _kiwi.applets.Chanlist = Backbone.Model.extend({ initialize: function () { this.set('title', 'Channel List'); this.view = new View(); diff --git a/client/assets/dev/applet_nickserv.js b/client/assets/dev/applet_nickserv.js index 0244d1d..4b45a55 100644 --- a/client/assets/dev/applet_nickserv.js +++ b/client/assets/dev/applet_nickserv.js @@ -23,12 +23,12 @@ - kiwi.applets.nickserv = Backbone.Model.extend({ + _kiwi.applets.nickserv = Backbone.Model.extend({ initialize: function () { this.set('title', 'Nickserv Login'); //this.view = new View(); - kiwi.global.control.on('command_login', this.loginCommand, this); + _kiwi.global.control.on('command_login', this.loginCommand, this); }, loginCommand: function (event) { diff --git a/client/assets/dev/applet_settings.js b/client/assets/dev/applet_settings.js index 6b97d0f..9e821f6 100644 --- a/client/assets/dev/applet_settings.js +++ b/client/assets/dev/applet_settings.js @@ -12,17 +12,17 @@ var theme = $('.theme', this.$el).val(); // Clear any current theme - kiwi.app.view.$el.removeClass(function (i, css) { + _kiwi.app.view.$el.removeClass(function (i, css) { return (css.match (/\btheme_\S+/g) || []).join(' '); }); - if (theme) kiwi.app.view.$el.addClass('theme_' + theme); + if (theme) _kiwi.app.view.$el.addClass('theme_' + theme); } }); - kiwi.applets.Settings = Backbone.Model.extend({ + _kiwi.applets.Settings = Backbone.Model.extend({ initialize: function () { this.set('title', 'Settings'); this.view = new View(); diff --git a/client/assets/dev/build.js b/client/assets/dev/build.js index 545fe72..6cb6922 100644 --- a/client/assets/dev/build.js +++ b/client/assets/dev/build.js @@ -25,7 +25,7 @@ config.loadConfig(); /** - * Build the kiwi.js files + * Build the _kiwi.js files */ var src = concat([ @@ -51,7 +51,7 @@ var src = concat([ ]); -src = '(function (global) {\n\n' + src + '\n\n})(window);'; +src = '(function (global, undefined) {\n\n' + src + '\n\n})(window);'; fs.writeFileSync(__dirname + '/../kiwi.js', src, FILE_ENCODING); diff --git a/client/assets/dev/index.html.tmpl b/client/assets/dev/index.html.tmpl index 327d0e1..b5b1db3 100644 --- a/client/assets/dev/index.html.tmpl +++ b/client/assets/dev/index.html.tmpl @@ -223,8 +223,8 @@ //kiwi_server: 'http://kiwiirc.com:80' }; - // Start the app by either the dev or closed environment - (kiwi && kiwi.global && kiwi.global.start(opts)) || (kiwi && kiwi.start(opts)); + // Start the app + kiwi.start(opts); } diff --git a/client/assets/dev/model_applet.js b/client/assets/dev/model_applet.js index cf337e6..e447749 100644 --- a/client/assets/dev/model_applet.js +++ b/client/assets/dev/model_applet.js @@ -1,4 +1,4 @@ -kiwi.model.Applet = kiwi.model.Panel.extend({ +_kiwi.model.Applet = _kiwi.model.Panel.extend({ // Used to determine if this is an applet panel. Applet panel tabs are treated // differently than others applet: true, @@ -7,7 +7,7 @@ kiwi.model.Applet = kiwi.model.Panel.extend({ initialize: function (attributes) { // Temporary name var name = "applet_"+(new Date().getTime().toString()) + Math.ceil(Math.random()*100).toString(); - this.view = new kiwi.view.Applet({model: this, name: name}); + this.view = new _kiwi.view.Applet({model: this, name: name}); this.set({ "name": name @@ -55,13 +55,13 @@ kiwi.model.Applet = kiwi.model.Panel.extend({ this.view.$el.html('Loading..'); $script(applet_url, function () { // Check if the applet loaded OK - if (!kiwi.applets[applet_name]) { + if (!_kiwi.applets[applet_name]) { that.view.$el.html('Not found'); return; } // Load a new instance of this applet - that.load(new kiwi.applets[applet_name]()); + that.load(new _kiwi.applets[applet_name]()); }); }, diff --git a/client/assets/dev/model_application.js b/client/assets/dev/model_application.js index f26e115..8e5f823 100644 --- a/client/assets/dev/model_application.js +++ b/client/assets/dev/model_application.js @@ -1,4 +1,4 @@ -kiwi.model.Application = function () { +_kiwi.model.Application = function () { // Set to a reference to this object within initialize() var that = null; @@ -7,13 +7,13 @@ kiwi.model.Application = function () { var model = function () { - /** Instance of kiwi.model.PanelList */ + /** Instance of _kiwi.model.PanelList */ this.panels = null; - /** kiwi.view.Application */ + /** _kiwi.view.Application */ this.view = null; - /** kiwi.view.StatusMessage */ + /** _kiwi.view.StatusMessage */ this.message = null; /* Address for the kiwi server */ @@ -33,7 +33,7 @@ kiwi.model.Application = function () { this.detectKiwiServer(); // Load the plugin manager - this.plugins = new kiwi.model.PluginManager(); + this.plugins = new _kiwi.model.PluginManager(); }; this.start = function () { @@ -45,8 +45,8 @@ kiwi.model.Application = function () { } // Set the gateway up - kiwi.gateway = new kiwi.model.Gateway(); - this.bindGatewayCommands(kiwi.gateway); + _kiwi.gateway = new _kiwi.model.Gateway(); + this.bindGatewayCommands(_kiwi.gateway); this.initializeClient(); this.initializeGlobals(); @@ -68,10 +68,10 @@ kiwi.model.Application = function () { kiwiServerNotFound(); return; } - kiwi.gateway.set('kiwi_server', that.kiwi_server + '/kiwi'); - kiwi.gateway.set('nick', event.nick); + _kiwi.gateway.set('kiwi_server', that.kiwi_server + '/kiwi'); + _kiwi.gateway.set('nick', event.nick); - kiwi.gateway.connect(event.server, event.port, event.ssl, event.password, function (error) { + _kiwi.gateway.connect(event.server, event.port, event.ssl, event.password, function (error) { if (error) { kiwiServerNotFound(); } @@ -82,7 +82,7 @@ kiwi.model.Application = function () { // TODO: Shouldn't really be here but it's not working in the view.. :/ // Hack for firefox browers: Focus is not given on this event loop iteration setTimeout(function(){ - kiwi.app.panels.server.server_login.$el.find('.nick').select(); + _kiwi.app.panels.server.server_login.$el.find('.nick').select(); }, 0); }; @@ -104,23 +104,23 @@ kiwi.model.Application = function () { this.initializeClient = function () { - this.view = new kiwi.view.Application({model: this, el: this.get('container')}); + this.view = new _kiwi.view.Application({model: this, el: this.get('container')}); /** * Set the UI components up */ - this.panels = new kiwi.model.PanelList(); + this.panels = new _kiwi.model.PanelList(); - this.controlbox = new kiwi.view.ControlBox({el: $('#controlbox')[0]}); + this.controlbox = new _kiwi.view.ControlBox({el: $('#controlbox')[0]}); this.bindControllboxCommands(this.controlbox); - this.topicbar = new kiwi.view.TopicBar({el: $('#topic')[0]}); + this.topicbar = new _kiwi.view.TopicBar({el: $('#topic')[0]}); - new kiwi.view.AppToolbar({el: $('#toolbar .app_tools')[0]}); + new _kiwi.view.AppToolbar({el: $('#toolbar .app_tools')[0]}); - this.message = new kiwi.view.StatusMessage({el: $('#status_message')[0]}); + this.message = new _kiwi.view.StatusMessage({el: $('#status_message')[0]}); - this.resize_handle = new kiwi.view.ResizeHandler({el: $('#memberlists_resize_handle')[0]}); + this.resize_handle = new _kiwi.view.ResizeHandler({el: $('#memberlists_resize_handle')[0]}); this.panels.server.view.show(); @@ -132,7 +132,7 @@ kiwi.model.Application = function () { this.initializeGlobals = function () { - kiwi.global.control = this.controlbox; + _kiwi.global.control = this.controlbox; }; @@ -223,7 +223,7 @@ kiwi.model.Application = function () { this.bindGatewayCommands = function (gw) { gw.on('onmotd', function (event) { - that.panels.server.addMsg(kiwi.gateway.get('name'), event.msg, 'motd'); + that.panels.server.addMsg(_kiwi.gateway.get('name'), event.msg, 'motd'); }); @@ -244,17 +244,17 @@ kiwi.model.Application = function () { that.message.text(msg, {timeout: 10000}); // Mention the disconnection on every channel - $.each(kiwi.app.panels.models, function (idx, panel) { + $.each(_kiwi.app.panels.models, function (idx, panel) { if (!panel || !panel.isChannel()) return; panel.addMsg('', msg, 'action quit'); }); - kiwi.app.panels.server.addMsg('', msg, 'action quit'); + _kiwi.app.panels.server.addMsg('', msg, 'action quit'); gw_stat = 1; }); gw.on('reconnecting', function (event) { msg = 'You have been disconnected. Attempting to reconnect again in ' + (event.delay/1000) + ' seconds..'; - kiwi.app.panels.server.addMsg('', msg, 'action quit'); + _kiwi.app.panels.server.addMsg('', msg, 'action quit'); }); gw.on('connect', function (event) { if (gw_stat !== 1) return; @@ -263,11 +263,11 @@ kiwi.model.Application = function () { that.message.text(msg, {timeout: 5000}); // Mention the disconnection on every channel - $.each(kiwi.app.panels.models, function (idx, panel) { + $.each(_kiwi.app.panels.models, function (idx, panel) { if (!panel || !panel.isChannel()) return; panel.addMsg('', msg, 'action join'); }); - kiwi.app.panels.server.addMsg('', msg, 'action join'); + _kiwi.app.panels.server.addMsg('', msg, 'action join'); gw_stat = 0; }); @@ -278,14 +278,14 @@ kiwi.model.Application = function () { var c, members, user; c = that.panels.getByName(event.channel); if (!c) { - c = new kiwi.model.Channel({name: event.channel}); + c = new _kiwi.model.Channel({name: event.channel}); that.panels.add(c); } members = c.get('members'); if (!members) return; - user = new kiwi.model.Member({nick: event.nick, ident: event.ident, hostname: event.hostname}); + user = new _kiwi.model.Member({nick: event.nick, ident: event.ident, hostname: event.hostname}); members.add(user); // TODO: highlight the new channel in some way }); @@ -302,7 +302,7 @@ kiwi.model.Application = function () { if (!channel) return; // If this is us, close the panel - if (event.nick === kiwi.gateway.get('nick')) { + if (event.nick === _kiwi.gateway.get('nick')) { channel.close(); return; } @@ -354,7 +354,7 @@ kiwi.model.Application = function () { members.remove(user, part_options); - if (event.kicked === kiwi.gateway.get('nick')) { + if (event.kicked === _kiwi.gateway.get('nick')) { members.reset([]); } @@ -363,13 +363,13 @@ kiwi.model.Application = function () { gw.on('onmsg', function (event) { var panel, - is_pm = (event.channel == kiwi.gateway.get('nick')); + is_pm = (event.channel == _kiwi.gateway.get('nick')); if (is_pm) { // If a panel isn't found for this PM, create one panel = that.panels.getByName(event.nick); if (!panel) { - panel = new kiwi.model.Query({name: event.nick}); + panel = new _kiwi.model.Query({name: event.nick}); that.panels.add(panel); } @@ -401,13 +401,13 @@ kiwi.model.Application = function () { gw.on('onaction', function (event) { var panel, - is_pm = (event.channel == kiwi.gateway.get('nick')); + is_pm = (event.channel == _kiwi.gateway.get('nick')); if (is_pm) { // If a panel isn't found for this PM, create one panel = that.panels.getByName(event.nick); if (!panel) { - panel = new kiwi.model.Channel({name: event.nick}); + panel = new _kiwi.model.Channel({name: event.nick}); that.panels.add(panel); } @@ -433,7 +433,7 @@ kiwi.model.Application = function () { c.set('topic', event.topic); // If this is the active channel, update the topic bar too - if (c.get('name') === kiwi.app.panels.active.get('name')) { + if (c.get('name') === _kiwi.app.panels.active.get('name')) { that.topicbar.setCurrentTopic(event.topic); } }); @@ -458,7 +458,7 @@ kiwi.model.Application = function () { channel.temp_userlist = channel.temp_userlist || []; _.each(event.users, function (item) { - var user = new kiwi.model.Member({nick: item.nick, modes: item.modes}); + var user = new _kiwi.model.Member({nick: item.nick, modes: item.modes}); channel.temp_userlist.push(user); }); }); @@ -520,7 +520,7 @@ kiwi.model.Application = function () { channel = that.panels.getByName(event.target); if (channel) { - prefixes = kiwi.gateway.get('user_prefixes'); + prefixes = _kiwi.gateway.get('user_prefixes'); find_prefix = function (p) { return event.modes[i].mode[1] === p.mode; }; @@ -552,7 +552,7 @@ kiwi.model.Application = function () { channel.addMsg('', '== ' + event.nick + ' sets mode ' + friendlyModeString(), 'action mode'); } else { // This is probably a mode being set on us. - if (event.target.toLowerCase() === kiwi.gateway.get("nick").toLowerCase()) { + if (event.target.toLowerCase() === _kiwi.gateway.get("nick").toLowerCase()) { that.panels.server.addMsg('', '== ' + event.nick + ' set mode ' + friendlyModeString(), 'action mode'); } else { console.log('MODE command recieved for unknown target %s: ', event.target, event); @@ -589,7 +589,7 @@ kiwi.model.Application = function () { idle_time = idle_time.h.toString().lpad(2, "0") + ':' + idle_time.m.toString().lpad(2, "0") + ':' + idle_time.s.toString().lpad(2, "0"); } - panel = kiwi.app.panels.active; + panel = _kiwi.app.panels.active; if (event.ident) { panel.addMsg(event.nick, 'is ' + event.nick + '!' + event.ident + '@' + event.host + ' * ' + event.msg, 'whois'); } else if (event.chans) { @@ -611,86 +611,86 @@ kiwi.model.Application = function () { gw.on('onlist_start', function (data) { - if (kiwi.app.channel_list) { - kiwi.app.channel_list.close(); - delete kiwi.app.channel_list; + if (_kiwi.app.channel_list) { + _kiwi.app.channel_list.close(); + delete _kiwi.app.channel_list; } - var panel = new kiwi.model.Applet(), - applet = new kiwi.applets.Chanlist(); + var panel = new _kiwi.model.Applet(), + applet = new _kiwi.applets.Chanlist(); panel.load(applet); - kiwi.app.panels.add(panel); + _kiwi.app.panels.add(panel); panel.view.show(); - kiwi.app.channel_list = applet; + _kiwi.app.channel_list = applet; }); gw.on('onlist_channel', function (data) { // TODO: Put this listener within the applet itself - kiwi.app.channel_list.addChannel(data.chans); + _kiwi.app.channel_list.addChannel(data.chans); }); gw.on('onlist_end', function (data) { // TODO: Put this listener within the applet itself - delete kiwi.app.channel_list; + delete _kiwi.app.channel_list; }); gw.on('onirc_error', function (data) { var panel, tmp; - if (data.channel !== undefined && !(panel = kiwi.app.panels.getByName(data.channel))) { - panel = kiwi.app.panels.server; + if (data.channel !== undefined && !(panel = _kiwi.app.panels.getByName(data.channel))) { + panel = _kiwi.app.panels.server; } switch (data.error) { case 'banned_from_channel': panel.addMsg(' ', '== You are banned from ' + data.channel + '. ' + data.reason, 'status'); - kiwi.app.message.text('You are banned from ' + data.channel + '. ' + data.reason); + _kiwi.app.message.text('You are banned from ' + data.channel + '. ' + data.reason); break; case 'bad_channel_key': panel.addMsg(' ', '== Bad channel key for ' + data.channel, 'status'); - kiwi.app.message.text('Bad channel key or password for ' + data.channel); + _kiwi.app.message.text('Bad channel key or password for ' + data.channel); break; case 'invite_only_channel': panel.addMsg(' ', '== ' + data.channel + ' is invite only.', 'status'); - kiwi.app.message.text(data.channel + ' is invite only'); + _kiwi.app.message.text(data.channel + ' is invite only'); break; case 'channel_is_full': panel.addMsg(' ', '== ' + data.channel + ' is full.', 'status'); - kiwi.app.message.text(data.channel + ' is full'); + _kiwi.app.message.text(data.channel + ' is full'); break; case 'chanop_privs_needed': panel.addMsg(' ', '== ' + data.reason, 'status'); - kiwi.app.message.text(data.reason + ' (' + data.channel + ')'); + _kiwi.app.message.text(data.reason + ' (' + data.channel + ')'); break; case 'no_such_nick': - tmp = kiwi.app.panels.getByName(data.nick); + tmp = _kiwi.app.panels.getByName(data.nick); if (tmp) { tmp.addMsg(' ', '== ' + data.nick + ': ' + data.reason, 'status'); } else { - kiwi.app.panels.server.addMsg(' ', '== ' + data.nick + ': ' + data.reason, 'status'); + _kiwi.app.panels.server.addMsg(' ', '== ' + data.nick + ': ' + data.reason, 'status'); } break; case 'nickname_in_use': - kiwi.app.panels.server.addMsg(' ', '== The nickname ' + data.nick + ' is already in use. Please select a new nickname', 'status'); - if (kiwi.app.panels.server !== kiwi.app.panels.active) { - kiwi.app.message.text('The nickname "' + data.nick + '" is already in use. Please select a new nickname'); + _kiwi.app.panels.server.addMsg(' ', '== The nickname ' + data.nick + ' is already in use. Please select a new nickname', 'status'); + if (_kiwi.app.panels.server !== _kiwi.app.panels.active) { + _kiwi.app.message.text('The nickname "' + data.nick + '" is already in use. Please select a new nickname'); } // Only show the nickchange component if the controlbox is open if (that.controlbox.$el.css('display') !== 'none') { - (new kiwi.view.NickChangeBox()).render(); + (new _kiwi.view.NickChangeBox()).render(); } break; default: // We don't know what data contains, so don't do anything with it. - //kiwi.front.tabviews.server.addMsg(null, ' ', '== ' + data, 'status'); + //_kiwi.front.tabviews.server.addMsg(null, ' ', '== ' + data, 'status'); } }); }; @@ -734,7 +734,7 @@ kiwi.model.Application = function () { controlbox.on('command_part', partCommand); controlbox.on('command_nick', function (ev) { - kiwi.gateway.changeNick(ev.params[0]); + _kiwi.gateway.changeNick(ev.params[0]); }); controlbox.on('command_query', queryCommand); @@ -766,7 +766,7 @@ kiwi.model.Application = function () { // No parameters passed so list them if (!ev.params[1]) { $.each(controlbox.preprocessor.aliases, function (name, rule) { - kiwi.app.panels.server.addMsg(' ', name + ' => ' + rule); + _kiwi.app.panels.server.addMsg(' ', name + ' => ' + rule); }); return; } @@ -799,7 +799,7 @@ kiwi.model.Application = function () { function unknownCommand (ev) { var raw_cmd = ev.command + ' ' + ev.params.join(' '); console.log('RAW: ' + raw_cmd); - kiwi.gateway.raw(raw_cmd); + _kiwi.gateway.raw(raw_cmd); } function allCommands (ev) {} @@ -816,11 +816,11 @@ kiwi.model.Application = function () { // Check if we have the panel already. If not, create it channel = that.panels.getByName(channel_name); if (!channel) { - channel = new kiwi.model.Channel({name: channel_name}); - kiwi.app.panels.add(channel); + channel = new _kiwi.model.Channel({name: channel_name}); + _kiwi.app.panels.add(channel); } - kiwi.gateway.join(channel_name); + _kiwi.gateway.join(channel_name); }); if (channel) channel.view.show(); @@ -835,8 +835,8 @@ kiwi.model.Application = function () { // Check if we have the panel already. If not, create it panel = that.panels.getByName(destination); if (!panel) { - panel = new kiwi.model.Query({name: destination}); - kiwi.app.panels.add(panel); + panel = new _kiwi.model.Query({name: destination}); + _kiwi.app.panels.add(panel); } if (panel) panel.view.show(); @@ -849,30 +849,30 @@ kiwi.model.Application = function () { ev.params.shift(); - panel.addMsg(kiwi.gateway.get('nick'), ev.params.join(' ')); - kiwi.gateway.privmsg(destination, ev.params.join(' ')); + panel.addMsg(_kiwi.gateway.get('nick'), ev.params.join(' ')); + _kiwi.gateway.privmsg(destination, ev.params.join(' ')); } function actionCommand (ev) { - if (kiwi.app.panels.active === kiwi.app.panels.server) { + if (_kiwi.app.panels.active === _kiwi.app.panels.server) { return; } - var panel = kiwi.app.panels.active; - panel.addMsg('', '* ' + kiwi.gateway.get('nick') + ' ' + ev.params.join(' '), 'action'); - kiwi.gateway.action(panel.get('name'), ev.params.join(' ')); + var panel = _kiwi.app.panels.active; + panel.addMsg('', '* ' + _kiwi.gateway.get('nick') + ' ' + ev.params.join(' '), 'action'); + _kiwi.gateway.action(panel.get('name'), ev.params.join(' ')); } function partCommand (ev) { if (ev.params.length === 0) { - kiwi.gateway.part(kiwi.app.panels.active.get('name')); + _kiwi.gateway.part(_kiwi.app.panels.active.get('name')); } else { _.each(ev.params, function (channel) { - kiwi.gateway.part(channel); + _kiwi.gateway.part(channel); }); } // TODO: More responsive = close tab now, more accurate = leave until part event - //kiwi.app.panels.remove(kiwi.app.panels.active); + //_kiwi.app.panels.remove(_kiwi.app.panels.active); } function topicCommand (ev) { @@ -884,10 +884,10 @@ kiwi.model.Application = function () { channel_name = ev.params[0]; ev.params.shift(); } else { - channel_name = kiwi.app.panels.active.get('name'); + channel_name = _kiwi.app.panels.active.get('name'); } - kiwi.gateway.topic(channel_name, ev.params.join(' ')); + _kiwi.gateway.topic(channel_name, ev.params.join(' ')); } function noticeCommand (ev) { @@ -899,16 +899,16 @@ kiwi.model.Application = function () { destination = ev.params[0]; ev.params.shift(); - kiwi.gateway.notice(destination, ev.params.join(' ')); + _kiwi.gateway.notice(destination, ev.params.join(' ')); } function quoteCommand (ev) { var raw = ev.params.join(' '); - kiwi.gateway.raw(raw); + _kiwi.gateway.raw(raw); } function kickCommand (ev) { - var nick, panel = kiwi.app.panels.active; + var nick, panel = _kiwi.app.panels.active; if (!panel.isChannel()) return; @@ -918,36 +918,36 @@ kiwi.model.Application = function () { nick = ev.params[0]; ev.params.shift(); - kiwi.gateway.kick(panel.get('name'), nick, ev.params.join(' ')); + _kiwi.gateway.kick(panel.get('name'), nick, ev.params.join(' ')); } function settingsCommand (ev) { - var panel = new kiwi.model.Applet(); - panel.load(new kiwi.applets.Settings()); + var panel = new _kiwi.model.Applet(); + panel.load(new _kiwi.applets.Settings()); - kiwi.app.panels.add(panel); + _kiwi.app.panels.add(panel); panel.view.show(); } function appletCommand (ev) { if (!ev.params[0]) return; - var panel = new kiwi.model.Applet(); + var panel = new _kiwi.model.Applet(); if (ev.params[1]) { // Url and name given panel.load(ev.params[0], ev.params[1]); } else { // Load a pre-loaded applet - if (kiwi.applets[ev.params[0]]) { - panel.load(new kiwi.applets[ev.params[0]]()); + if (_kiwi.applets[ev.params[0]]) { + panel.load(new _kiwi.applets[ev.params[0]]()); } else { - kiwi.app.panels.server.addMsg('', 'Applet "' + ev.params[0] + '" does not exist'); + _kiwi.app.panels.server.addMsg('', 'Applet "' + ev.params[0] + '" does not exist'); return; } } - kiwi.app.panels.add(panel); + _kiwi.app.panels.add(panel); panel.view.show(); } @@ -956,7 +956,7 @@ kiwi.model.Application = function () { this.isChannelName = function (channel_name) { - var channel_prefix = kiwi.gateway.get('channel_prefix'); + var channel_prefix = _kiwi.gateway.get('channel_prefix'); if (!channel_name || !channel_name.length) return false; return (channel_prefix.indexOf(channel_name[0]) > -1); diff --git a/client/assets/dev/model_channel.js b/client/assets/dev/model_channel.js index 9819bb9..90f11a1 100644 --- a/client/assets/dev/model_channel.js +++ b/client/assets/dev/model_channel.js @@ -1,13 +1,13 @@ // TODO: Channel modes // TODO: Listen to gateway events for anythign related to this channel -kiwi.model.Channel = kiwi.model.Panel.extend({ +_kiwi.model.Channel = _kiwi.model.Panel.extend({ initialize: function (attributes) { var name = this.get("name") || "", members; - this.view = new kiwi.view.Channel({"model": this, "name": name}); + this.view = new _kiwi.view.Channel({"model": this, "name": name}); this.set({ - "members": new kiwi.model.MemberList(), + "members": new _kiwi.model.MemberList(), "name": name, "scrollback": [], "topic": "" diff --git a/client/assets/dev/model_gateway.js b/client/assets/dev/model_gateway.js index 91cf5d0..47c41a4 100644 --- a/client/assets/dev/model_gateway.js +++ b/client/assets/dev/model_gateway.js @@ -1,4 +1,4 @@ -kiwi.model.Gateway = function () { +_kiwi.model.Gateway = function () { // Set to a reference to this object within initialize() var that = null; @@ -62,12 +62,12 @@ kiwi.model.Gateway = function () { var resource; // Work out the resource URL for socket.io - if (kiwi.app.get('base_path').substr(0, 1) === '/') { - resource = kiwi.app.get('base_path'); + if (_kiwi.app.get('base_path').substr(0, 1) === '/') { + resource = _kiwi.app.get('base_path'); resource = resource.substr(1, resource.length-1); resource += '/transport'; } else { - resource = kiwi.app.get('base_path') + '/transport'; + resource = _kiwi.app.get('base_path') + '/transport'; } this.socket = io.connect(this.get('kiwi_server'), { @@ -85,12 +85,12 @@ kiwi.model.Gateway = function () { }); this.socket.on('error', function (e) { - console.log("kiwi.gateway.socket.on('error')", {reason: e}); + console.log("_kiwi.gateway.socket.on('error')", {reason: e}); that.trigger("connect_fail", {reason: e}); }); this.socket.on('connecting', function (transport_type) { - console.log("kiwi.gateway.socket.on('connecting')"); + console.log("_kiwi.gateway.socket.on('connecting')"); that.trigger("connecting"); }); @@ -104,9 +104,9 @@ kiwi.model.Gateway = function () { this.emit('kiwi', {command: 'connect', nick: that.get('nick'), hostname: host, port: port, ssl: ssl, password:password}, function (err, server_num) { if (!err) { that.server_num = server_num; - console.log("kiwi.gateway.socket.on('connect')"); + console.log("_kiwi.gateway.socket.on('connect')"); } else { - console.log("kiwi.gateway.socket.on('error')", {reason: err}); + console.log("_kiwi.gateway.socket.on('error')", {reason: err}); callback(err); } }); @@ -126,20 +126,20 @@ kiwi.model.Gateway = function () { this.socket.on('disconnect', function () { that.trigger("disconnect", {}); - console.log("kiwi.gateway.socket.on('disconnect')"); + console.log("_kiwi.gateway.socket.on('disconnect')"); }); this.socket.on('close', function () { - console.log("kiwi.gateway.socket.on('close')"); + console.log("_kiwi.gateway.socket.on('close')"); }); this.socket.on('reconnecting', function (reconnectionDelay, reconnectionAttempts) { - console.log("kiwi.gateway.socket.on('reconnecting')"); + console.log("_kiwi.gateway.socket.on('reconnecting')"); that.trigger("reconnecting", {delay: reconnectionDelay, attempts: reconnectionAttempts}); }); this.socket.on('reconnect_failed', function () { - console.log("kiwi.gateway.socket.on('reconnect_failed')"); + console.log("_kiwi.gateway.socket.on('reconnect_failed')"); }); }; @@ -210,15 +210,15 @@ kiwi.model.Gateway = function () { break; /* case 'sync': - if (kiwi.gateway.onSync && kiwi.gateway.syncing) { - kiwi.gateway.syncing = false; - kiwi.gateway.onSync(item); + if (_kiwi.gateway.onSync && _kiwi.gateway.syncing) { + _kiwi.gateway.syncing = false; + _kiwi.gateway.onSync(item); } break; */ case 'kiwi': - this.emit('kiwi.' + data.namespace, data.data); + this.emit('_kiwi.' + data.namespace, data.data); break; } } diff --git a/client/assets/dev/model_member.js b/client/assets/dev/model_member.js index 535f906..5d7f478 100644 --- a/client/assets/dev/model_member.js +++ b/client/assets/dev/model_member.js @@ -1,8 +1,8 @@ -kiwi.model.Member = Backbone.Model.extend({ +_kiwi.model.Member = Backbone.Model.extend({ sortModes: function (modes) { return modes.sort(function (a, b) { var a_idx, b_idx, i; - var user_prefixes = kiwi.gateway.get('user_prefixes'); + var user_prefixes = _kiwi.gateway.get('user_prefixes'); for (i = 0; i < user_prefixes.length; i++) { if (user_prefixes[i].mode === a) { @@ -57,7 +57,7 @@ kiwi.model.Member = Backbone.Model.extend({ }, getPrefix: function (modes) { var prefix = ''; - var user_prefixes = kiwi.gateway.get('user_prefixes'); + var user_prefixes = _kiwi.gateway.get('user_prefixes'); if (typeof modes[0] !== 'undefined') { prefix = _.detect(user_prefixes, function (prefix) { @@ -69,7 +69,7 @@ kiwi.model.Member = Backbone.Model.extend({ }, stripPrefix: function (nick) { var tmp = nick, i, j, k; - var user_prefixes = kiwi.gateway.get('user_prefixes'); + var user_prefixes = _kiwi.gateway.get('user_prefixes'); i = 0; for (j = 0; j < nick.length; j++) { diff --git a/client/assets/dev/model_memberlist.js b/client/assets/dev/model_memberlist.js index 5e2c0eb..bb3d0a3 100644 --- a/client/assets/dev/model_memberlist.js +++ b/client/assets/dev/model_memberlist.js @@ -1,8 +1,8 @@ -kiwi.model.MemberList = Backbone.Collection.extend({ - model: kiwi.model.Member, +_kiwi.model.MemberList = Backbone.Collection.extend({ + model: _kiwi.model.Member, comparator: function (a, b) { var i, a_modes, b_modes, a_idx, b_idx, a_nick, b_nick; - var user_prefixes = kiwi.gateway.get('user_prefixes'); + var user_prefixes = _kiwi.gateway.get('user_prefixes'); a_modes = a.get("modes"); b_modes = b.get("modes"); // Try to sort by modes first @@ -46,7 +46,7 @@ kiwi.model.MemberList = Backbone.Collection.extend({ } }, initialize: function (options) { - this.view = new kiwi.view.MemberList({"model": this}); + this.view = new _kiwi.view.MemberList({"model": this}); }, getByNick: function (nick) { if (typeof nick !== 'string') return; diff --git a/client/assets/dev/model_panel.js b/client/assets/dev/model_panel.js index 1b05f89..41a4641 100644 --- a/client/assets/dev/model_panel.js +++ b/client/assets/dev/model_panel.js @@ -1,7 +1,7 @@ -kiwi.model.Panel = Backbone.Model.extend({ +_kiwi.model.Panel = Backbone.Model.extend({ initialize: function (attributes) { var name = this.get("name") || ""; - this.view = new kiwi.view.Panel({"model": this, "name": name}); + this.view = new _kiwi.view.Panel({"model": this, "name": name}); this.set({ "scrollback": [], "name": name @@ -26,7 +26,7 @@ kiwi.model.Panel = Backbone.Model.extend({ // Run through the plugins message_obj = {"msg": msg, "time": opts.time, "nick": nick, "chan": this.get("name"), "type": type, "style": opts.style}; - //tmp = kiwi.plugs.run('addmsg', message_obj); + //tmp = _kiwi.plugs.run('addmsg', message_obj); if (!message_obj) { return; } @@ -68,14 +68,14 @@ kiwi.model.Panel = Backbone.Model.extend({ this.unset('members'); } - kiwi.app.panels.remove(this); + _kiwi.app.panels.remove(this); this.unbind(); this.destroy(); // If closing the active panel, switch to the server panel - if (this.cid === kiwi.app.panels.active.cid) { - kiwi.app.panels.server.view.show(); + if (this.cid === _kiwi.app.panels.active.cid) { + _kiwi.app.panels.server.view.show(); } }, @@ -85,7 +85,7 @@ kiwi.model.Panel = Backbone.Model.extend({ }, isChannel: function () { - var channel_prefix = kiwi.gateway.get('channel_prefix'), + var channel_prefix = _kiwi.gateway.get('channel_prefix'), this_name = this.get('name'); if (this.isApplet() || !this_name) return false; @@ -101,6 +101,6 @@ kiwi.model.Panel = Backbone.Model.extend({ }, isActive: function () { - return (kiwi.app.panels.active === this); + return (_kiwi.app.panels.active === this); } }); \ No newline at end of file diff --git a/client/assets/dev/model_panellist.js b/client/assets/dev/model_panellist.js index f16df71..d95d58f 100644 --- a/client/assets/dev/model_panellist.js +++ b/client/assets/dev/model_panellist.js @@ -1,15 +1,15 @@ -kiwi.model.PanelList = Backbone.Collection.extend({ - model: kiwi.model.Panel, +_kiwi.model.PanelList = Backbone.Collection.extend({ + model: _kiwi.model.Panel, comparator: function (chan) { return chan.get("name"); }, initialize: function () { - this.view = new kiwi.view.Tabs({"el": $('#tabs')[0], "model": this}); + this.view = new _kiwi.view.Tabs({"el": $('#tabs')[0], "model": this}); // Automatically create a server tab - this.add(new kiwi.model.Server({'name': kiwi.gateway.get('name')})); - this.server = this.getByName(kiwi.gateway.get('name')); + this.add(new _kiwi.model.Server({'name': _kiwi.gateway.get('name')})); + this.server = this.getByName(_kiwi.gateway.get('name')); // Holds the active panel this.active = null; diff --git a/client/assets/dev/model_pluginmanager.js b/client/assets/dev/model_pluginmanager.js index 00cf161..e3fc829 100644 --- a/client/assets/dev/model_pluginmanager.js +++ b/client/assets/dev/model_pluginmanager.js @@ -1,4 +1,4 @@ -kiwi.model.PluginManager = Backbone.Model.extend({ +_kiwi.model.PluginManager = Backbone.Model.extend({ initialize: function () { this.$plugin_holder = $('').appendTo('#kiwi'); this.loaded_plugins = {}; diff --git a/client/assets/dev/model_query.js b/client/assets/dev/model_query.js index 253cf5d..8d4de5b 100644 --- a/client/assets/dev/model_query.js +++ b/client/assets/dev/model_query.js @@ -1,9 +1,9 @@ -kiwi.model.Query = kiwi.model.Panel.extend({ +_kiwi.model.Query = _kiwi.model.Panel.extend({ initialize: function (attributes) { var name = this.get("name") || "", members; - this.view = new kiwi.view.Channel({"model": this, "name": name}); + this.view = new _kiwi.view.Channel({"model": this, "name": name}); this.set({ "name": name, "scrollback": [] diff --git a/client/assets/dev/model_server.js b/client/assets/dev/model_server.js index 55e567f..196ab7d 100644 --- a/client/assets/dev/model_server.js +++ b/client/assets/dev/model_server.js @@ -1,10 +1,10 @@ -kiwi.model.Server = kiwi.model.Panel.extend({ +_kiwi.model.Server = _kiwi.model.Panel.extend({ // Used to determine if this is a server panel server: true, initialize: function (attributes) { var name = "Server"; - this.view = new kiwi.view.Panel({"model": this, "name": name}); + this.view = new _kiwi.view.Panel({"model": this, "name": name}); this.set({ "scrollback": [], "name": name @@ -12,7 +12,7 @@ kiwi.model.Server = kiwi.model.Panel.extend({ //this.addMsg(' ', '--> Kiwi IRC: Such an awesome IRC client', '', {style: 'color:#009900;'}); - this.server_login = new kiwi.view.ServerSelect(); + this.server_login = new _kiwi.view.ServerSelect(); this.view.$el.append(this.server_login.$el); this.server_login.show(); diff --git a/client/assets/dev/utils.js b/client/assets/dev/utils.js index 4648235..775073f 100644 --- a/client/assets/dev/utils.js +++ b/client/assets/dev/utils.js @@ -443,8 +443,8 @@ var plugins = [ { name: "activity", onaddmsg: function (event, opts) { - //if (kiwi.front.cur_channel.name.toLowerCase() !== kiwi.front.tabviews[event.tabview.toLowerCase()].name) { - // kiwi.front.tabviews[event.tabview].activity(); + //if (_kiwi.front.cur_channel.name.toLowerCase() !== _kiwi.front.tabviews[event.tabview.toLowerCase()].name) { + // _kiwi.front.tabviews[event.tabview].activity(); //} return event; @@ -457,17 +457,17 @@ var plugins = [ //var tab = Tabviews.getTab(event.tabview.toLowerCase()); // If we have a highlight... - //if (event.msg.toLowerCase().indexOf(kiwi.gateway.nick.toLowerCase()) > -1) { + //if (event.msg.toLowerCase().indexOf(_kiwi.gateway.nick.toLowerCase()) > -1) { // if (Tabview.getCurrentTab() !== tab) { // tab.highlight(); // } - // if (kiwi.front.isChannel(tab.name)) { + // if (_kiwi.front.isChannel(tab.name)) { // event.msg = '' + event.msg + ''; // } //} // If it's a PM, highlight - //if (!kiwi.front.isChannel(tab.name) && tab.name !== "server" + //if (!_kiwi.front.isChannel(tab.name) && tab.name !== "server" // && Tabview.getCurrentTab().name.toLowerCase() !== tab.name //) { // tab.highlight(); @@ -551,7 +551,7 @@ var plugins = [ tooltip; if (tt.text() === '') { - tooltip = $('Open in Kiwi..'); + tooltip = $('Open in _kiwi..'); tt.append(tooltip); } @@ -596,15 +596,15 @@ var plugins = [ return event; } - //if (typeof kiwi.front.tabviews[event.tabview].nick_colours === 'undefined') { - // kiwi.front.tabviews[event.tabview].nick_colours = {}; + //if (typeof _kiwi.front.tabviews[event.tabview].nick_colours === 'undefined') { + // _kiwi.front.tabviews[event.tabview].nick_colours = {}; //} - //if (typeof kiwi.front.tabviews[event.tabview].nick_colours[event.nick] === 'undefined') { - // kiwi.front.tabviews[event.tabview].nick_colours[event.nick] = this.randColour(); + //if (typeof _kiwi.front.tabviews[event.tabview].nick_colours[event.nick] === 'undefined') { + // _kiwi.front.tabviews[event.tabview].nick_colours[event.nick] = this.randColour(); //} - //var c = kiwi.front.tabviews[event.tabview].nick_colours[event.nick]; + //var c = _kiwi.front.tabviews[event.tabview].nick_colours[event.nick]; var c = this.randColour(); event.nick = '' + event.nick + ''; @@ -630,7 +630,7 @@ var plugins = [ name: "kiwitest", oninit: function (event, opts) { console.log('registering namespace'); - $(gateway).bind("kiwi.lol.browser", function (e, data) { + $(gateway).bind("_kiwi.lol.browser", function (e, data) { console.log('YAY kiwitest'); console.log(data); }); @@ -649,7 +649,7 @@ var plugins = [ * @constructor * @param {String} data_namespace The namespace for the data store */ -kiwi.dataStore = function (data_namespace) { +_kiwi.dataStore = function (data_namespace) { var namespace = data_namespace; this.get = function (key) { @@ -661,7 +661,7 @@ kiwi.dataStore = function (data_namespace) { }; }; -kiwi.data = new kiwi.dataStore('kiwi'); +_kiwi.data = new _kiwi.dataStore('kiwi'); diff --git a/client/assets/dev/view.js b/client/assets/dev/view.js index cd1a0b3..65b7df9 100644 --- a/client/assets/dev/view.js +++ b/client/assets/dev/view.js @@ -1,7 +1,7 @@ /*jslint white:true, regexp: true, nomen: true, devel: true, undef: true, browser: true, continue: true, sloppy: true, forin: true, newcap: true, plusplus: true, maxerr: 50, indent: 4 */ /*global kiwi */ -kiwi.view.MemberList = Backbone.View.extend({ +_kiwi.view.MemberList = Backbone.View.extend({ tagName: "ul", events: { "click .nick": "nickClick" @@ -22,7 +22,7 @@ kiwi.view.MemberList = Backbone.View.extend({ nickClick: function (x) { var target = $(x.currentTarget).parent('li'), member = target.data('member'), - userbox = new kiwi.view.UserBox(); + userbox = new _kiwi.view.UserBox(); userbox.member = member; $('.userbox', this.$el).remove(); @@ -36,7 +36,7 @@ kiwi.view.MemberList = Backbone.View.extend({ -kiwi.view.UserBox = Backbone.View.extend({ +_kiwi.view.UserBox = Backbone.View.extend({ events: { 'click .query': 'queryClick', 'click .info': 'infoClick', @@ -48,21 +48,21 @@ kiwi.view.UserBox = Backbone.View.extend({ }, queryClick: function (event) { - var panel = new kiwi.model.Query({name: this.member.get('nick')}); - kiwi.app.panels.add(panel); + var panel = new _kiwi.model.Query({name: this.member.get('nick')}); + _kiwi.app.panels.add(panel); panel.view.show(); }, infoClick: function (event) { - kiwi.app.controlbox.processInput('/whois ' + this.member.get('nick')); + _kiwi.app.controlbox.processInput('/whois ' + this.member.get('nick')); }, slapClick: function (event) { - kiwi.app.controlbox.processInput('/slap ' + this.member.get('nick')); + _kiwi.app.controlbox.processInput('/slap ' + this.member.get('nick')); } }); -kiwi.view.NickChangeBox = Backbone.View.extend({ +_kiwi.view.NickChangeBox = Backbone.View.extend({ events: { 'submit': 'changeNick', 'click .cancel': 'close' @@ -74,10 +74,10 @@ kiwi.view.NickChangeBox = Backbone.View.extend({ render: function () { // Add the UI component and give it focus - kiwi.app.controlbox.$el.prepend(this.$el); + _kiwi.app.controlbox.$el.prepend(this.$el); this.$el.find('input').focus(); - this.$el.css('bottom', kiwi.app.controlbox.$el.outerHeight(true)); + this.$el.css('bottom', _kiwi.app.controlbox.$el.outerHeight(true)); }, close: function () { @@ -87,14 +87,14 @@ kiwi.view.NickChangeBox = Backbone.View.extend({ changeNick: function (event) { var that = this; - kiwi.gateway.changeNick(this.$el.find('input').val(), function (err, val) { + _kiwi.gateway.changeNick(this.$el.find('input').val(), function (err, val) { that.close(); }); return false; } }); -kiwi.view.ServerSelect = function () { +_kiwi.view.ServerSelect = function () { // Are currently showing all the controlls or just a nick_change box? var state = 'all'; @@ -107,10 +107,10 @@ kiwi.view.ServerSelect = function () { initialize: function () { this.$el = $($('#tmpl_server_select').html()); - kiwi.gateway.bind('onconnect', this.networkConnected, this); - kiwi.gateway.bind('connecting', this.networkConnecting, this); + _kiwi.gateway.bind('onconnect', this.networkConnected, this); + _kiwi.gateway.bind('connecting', this.networkConnecting, this); - kiwi.gateway.bind('onirc_error', function (data) { + _kiwi.gateway.bind('onirc_error', function (data) { $('button', this.$el).attr('disabled', null); if (data.error == 'nickname_in_use') { @@ -149,7 +149,7 @@ kiwi.view.ServerSelect = function () { }, submitNickChange: function (event) { - kiwi.gateway.changeNick($('.nick', this.$el).val()); + _kiwi.gateway.changeNick($('.nick', this.$el).val()); this.networkConnecting(); }, @@ -235,7 +235,7 @@ kiwi.view.ServerSelect = function () { }; -kiwi.view.Panel = Backbone.View.extend({ +_kiwi.view.Panel = Backbone.View.extend({ tagName: "div", className: "messages", events: { @@ -280,7 +280,7 @@ kiwi.view.Panel = Backbone.View.extend({ msg.msg = $('
').text(msg.msg).html(); // Make the channels clickable - re = new RegExp('\\B([' + kiwi.gateway.get('channel_prefix') + '][^ ,.\\007]+)', 'g'); + re = new RegExp('\\B([' + _kiwi.gateway.get('channel_prefix') + '][^ ,.\\007]+)', 'g'); msg.msg = msg.msg.replace(re, function (match) { return '' + match + ''; }); @@ -328,13 +328,13 @@ kiwi.view.Panel = Backbone.View.extend({ // Activity/alerts based on the type of new message if (msg.type.match(/^action /)) { this.alert('action'); - } else if (msg.msg.indexOf(kiwi.gateway.get('nick')) > -1) { - kiwi.app.view.alertWindow('* People are talking!'); + } else if (msg.msg.indexOf(_kiwi.gateway.get('nick')) > -1) { + _kiwi.app.view.alertWindow('* People are talking!'); this.alert('highlight'); } else { // If this is the active panel, send an alert out if (this.model.isActive()) { - kiwi.app.view.alertWindow('* People are talking!'); + _kiwi.app.view.alertWindow('* People are talking!'); } this.alert('activity'); } @@ -350,10 +350,10 @@ kiwi.view.Panel = Backbone.View.extend({ }, chanClick: function (event) { if (event.target) { - kiwi.gateway.join($(event.target).text()); + _kiwi.gateway.join($(event.target).text()); } else { // IE... - kiwi.gateway.join($(event.srcElement).text()); + _kiwi.gateway.join($(event.srcElement).text()); } }, show: function () { @@ -373,19 +373,19 @@ kiwi.view.Panel = Backbone.View.extend({ $('#memberlists').hide().children().removeClass('active'); } - kiwi.app.view.doLayout(); + _kiwi.app.view.doLayout(); this.scrollToBottom(); this.alert('none'); this.trigger('active', this.model); - kiwi.app.panels.trigger('active', this.model); + _kiwi.app.panels.trigger('active', this.model); }, alert: function (level) { // No need to highlight if this si the active panel - if (this.model == kiwi.app.panels.active) return; + if (this.model == _kiwi.app.panels.active) return; var types, type_idx; types = ['none', 'action', 'activity', 'highlight']; @@ -426,14 +426,14 @@ kiwi.view.Panel = Backbone.View.extend({ } }); -kiwi.view.Applet = kiwi.view.Panel.extend({ +_kiwi.view.Applet = _kiwi.view.Panel.extend({ className: 'applet', initialize: function (options) { this.initializePanel(options); } }); -kiwi.view.Channel = kiwi.view.Panel.extend({ +_kiwi.view.Channel = _kiwi.view.Panel.extend({ initialize: function (options) { this.initializePanel(options); this.model.bind('change:topic', this.topic, this); @@ -447,14 +447,14 @@ kiwi.view.Channel = kiwi.view.Panel.extend({ this.model.addMsg('', '== Topic for ' + this.model.get('name') + ' is: ' + topic, 'topic'); // If this is the active channel then update the topic bar - if (kiwi.app.panels.active === this) { - kiwi.app.topicbar.setCurrentTopic(this.model.get("topic")); + if (_kiwi.app.panels.active === this) { + _kiwi.app.topicbar.setCurrentTopic(this.model.get("topic")); } } }); -// Model for this = kiwi.model.PanelList -kiwi.view.Tabs = Backbone.View.extend({ +// Model for this = _kiwi.model.PanelList +_kiwi.view.Tabs = Backbone.View.extend({ events: { 'click li': 'tabClick', 'click li .part': 'partClick' @@ -470,7 +470,7 @@ kiwi.view.Tabs = Backbone.View.extend({ this.tabs_applets = $('ul.applets', this.$el); this.tabs_msg = $('ul.channels', this.$el); - kiwi.gateway.on('change:name', function (gateway, new_val) { + _kiwi.gateway.on('change:name', function (gateway, new_val) { $('span', this.model.server.tab).text(new_val); }, this); }, @@ -494,7 +494,7 @@ kiwi.view.Tabs = Backbone.View.extend({ .appendTo(panel.isApplet() ? this.tabs_applets : this.tabs_msg); }); - kiwi.app.view.doLayout(); + _kiwi.app.view.doLayout(); }, updateTabTitle: function (panel, new_title) { @@ -513,13 +513,13 @@ kiwi.view.Tabs = Backbone.View.extend({ .appendTo(panel.isApplet() ? this.tabs_applets : this.tabs_msg); panel.bind('change:title', this.updateTabTitle); - kiwi.app.view.doLayout(); + _kiwi.app.view.doLayout(); }, panelRemoved: function (panel) { panel.tab.remove(); delete panel.tab; - kiwi.app.view.doLayout(); + _kiwi.app.view.doLayout(); }, panelActive: function (panel) { @@ -555,20 +555,20 @@ kiwi.view.Tabs = Backbone.View.extend({ // Only need to part if it's a channel // If the nicklist is empty, we haven't joined the channel as yet if (panel.isChannel() && panel.get('members').models.length > 0) { - kiwi.gateway.part(panel.get('name')); + _kiwi.gateway.part(panel.get('name')); } else { panel.close(); } }, next: function () { - var next = kiwi.app.panels.active.tab.next(); + var next = _kiwi.app.panels.active.tab.next(); if (!next.length) next = $('li:first', this.tabs_msgs); next.click(); }, prev: function () { - var prev = kiwi.app.panels.active.tab.prev(); + var prev = _kiwi.app.panels.active.tab.prev(); if (!prev.length) prev = $('li:last', this.tabs_msgs); prev.click(); @@ -577,13 +577,13 @@ kiwi.view.Tabs = Backbone.View.extend({ -kiwi.view.TopicBar = Backbone.View.extend({ +_kiwi.view.TopicBar = Backbone.View.extend({ events: { 'keydown div': 'process' }, initialize: function () { - kiwi.app.panels.bind('active', function (active_panel) { + _kiwi.app.panels.bind('active', function (active_panel) { // If it's a channel topic, update and make editable if (active_panel.isChannel()) { this.setCurrentTopic(active_panel.get('topic') || ''); @@ -602,13 +602,13 @@ kiwi.view.TopicBar = Backbone.View.extend({ inp_val = inp.text(); // Only allow topic editing if this is a channel panel - if (!kiwi.app.panels.active.isChannel()) { + if (!_kiwi.app.panels.active.isChannel()) { return false; } // If hit return key, update the current topic if (ev.keyCode === 13) { - kiwi.gateway.topic(kiwi.app.panels.active.get('name'), inp_val); + _kiwi.gateway.topic(_kiwi.app.panels.active.get('name'), inp_val); return false; } }, @@ -623,7 +623,7 @@ kiwi.view.TopicBar = Backbone.View.extend({ -kiwi.view.ControlBox = Backbone.View.extend({ +_kiwi.view.ControlBox = Backbone.View.extend({ events: { 'keydown .inp': 'process', 'click .nick': 'showNickChange' @@ -641,13 +641,13 @@ kiwi.view.ControlBox = Backbone.View.extend({ // Hold tab autocomplete data this.tabcomplete = {active: false, data: [], prefix: ''}; - kiwi.gateway.bind('change:nick', function () { + _kiwi.gateway.bind('change:nick', function () { $('.nick', that.$el).text(this.get('nick')); }); }, showNickChange: function (ev) { - (new kiwi.view.NickChangeBox()).render(); + (new _kiwi.view.NickChangeBox()).render(); }, process: function (ev) { @@ -702,11 +702,11 @@ kiwi.view.ControlBox = Backbone.View.extend({ break; case (ev.keyCode === 37 && meta): // left - kiwi.app.panels.view.prev(); + _kiwi.app.panels.view.prev(); return false; case (ev.keyCode === 39 && meta): // right - kiwi.app.panels.view.next(); + _kiwi.app.panels.view.next(); return false; case (ev.keyCode === 9): // tab @@ -714,7 +714,7 @@ kiwi.view.ControlBox = Backbone.View.extend({ if (_.isEqual(this.tabcomplete.data, [])) { // Get possible autocompletions var ac_data = []; - $.each(kiwi.app.panels.active.get('members').models, function (i, member) { + $.each(_kiwi.app.panels.active.get('members').models, function (i, member) { if (!member) return; ac_data.push(member.get('nick')); }); @@ -774,12 +774,12 @@ kiwi.view.ControlBox = Backbone.View.extend({ // The default command if (command_raw[0] !== '/') { - command_raw = '/msg ' + kiwi.app.panels.active.get('name') + ' ' + command_raw; + command_raw = '/msg ' + _kiwi.app.panels.active.get('name') + ' ' + command_raw; } // Process the raw command for any aliases - this.preprocessor.vars.server = kiwi.gateway.get('name'); - this.preprocessor.vars.channel = kiwi.app.panels.active.get('name'); + this.preprocessor.vars.server = _kiwi.gateway.get('name'); + this.preprocessor.vars.channel = _kiwi.app.panels.active.get('name'); this.preprocessor.vars.destination = this.preprocessor.vars.channel; command_raw = this.preprocessor.process(command_raw); @@ -791,7 +791,7 @@ kiwi.view.ControlBox = Backbone.View.extend({ } else { // Default command command = 'msg'; - params.unshift(kiwi.app.panels.active.get('name')); + params.unshift(_kiwi.app.panels.active.get('name')); } // Trigger the command events @@ -809,7 +809,7 @@ kiwi.view.ControlBox = Backbone.View.extend({ -kiwi.view.StatusMessage = Backbone.View.extend({ +_kiwi.view.StatusMessage = Backbone.View.extend({ initialize: function () { this.$el.hide(); @@ -824,7 +824,7 @@ kiwi.view.StatusMessage = Backbone.View.extend({ opt.timeout = opt.timeout || 5000; this.$el.text(text).attr('class', opt.type); - this.$el.slideDown(kiwi.app.view.doLayout); + this.$el.slideDown(_kiwi.app.view.doLayout); if (opt.timeout) this.doTimeout(opt.timeout); }, @@ -836,13 +836,13 @@ kiwi.view.StatusMessage = Backbone.View.extend({ opt.timeout = opt.timeout || 5000; this.$el.html(text).attr('class', opt.type); - this.$el.slideDown(kiwi.app.view.doLayout); + this.$el.slideDown(_kiwi.app.view.doLayout); if (opt.timeout) this.doTimeout(opt.timeout); }, hide: function () { - this.$el.slideUp(kiwi.app.view.doLayout); + this.$el.slideUp(_kiwi.app.view.doLayout); }, doTimeout: function (length) { @@ -855,7 +855,7 @@ kiwi.view.StatusMessage = Backbone.View.extend({ -kiwi.view.ResizeHandler = Backbone.View.extend({ +_kiwi.view.ResizeHandler = Backbone.View.extend({ events: { 'mousedown': 'startDrag', 'mouseup': 'stopDrag' @@ -881,13 +881,13 @@ kiwi.view.ResizeHandler = Backbone.View.extend({ this.$el.css('left', event.clientX - (this.$el.outerWidth(true) / 2)); $('#memberlists').css('width', this.$el.parent().width() - (this.$el.position().left + this.$el.outerWidth())); - kiwi.app.view.doLayout(); + _kiwi.app.view.doLayout(); } }); -kiwi.view.AppToolbar = Backbone.View.extend({ +_kiwi.view.AppToolbar = Backbone.View.extend({ events: { 'click .settings': 'clickSettings' }, @@ -896,13 +896,13 @@ kiwi.view.AppToolbar = Backbone.View.extend({ }, clickSettings: function (event) { - kiwi.app.controlbox.processInput('/settings'); + _kiwi.app.controlbox.processInput('/settings'); } }); -kiwi.view.Application = Backbone.View.extend({ +_kiwi.view.Application = Backbone.View.extend({ initialize: function () { $(window).resize(this.doLayout); $('#toolbar').resize(this.doLayout); @@ -914,7 +914,7 @@ kiwi.view.Application = Backbone.View.extend({ // Confirmation require to leave the page window.onbeforeunload = function () { - if (kiwi.gateway.isConnected()) { + if (_kiwi.gateway.isConnected()) { return 'This will close all KiwiIRC conversations. Are you sure you want to close this window?'; } };