-// Holds anything kiwi client specific (ie. front, gateway, kiwi.plugs..)\r
+// Holds anything kiwi client specific (ie. front, gateway, _kiwi.plugs..)\r
/**\r
* @namespace\r
*/\r
-var kiwi = {};\r
+var _kiwi = {};\r
\r
-kiwi.model = {};\r
-kiwi.view = {};\r
-kiwi.applets = {};\r
+_kiwi.model = {};\r
+_kiwi.view = {};\r
+_kiwi.applets = {};\r
\r
\r
/**\r
* Will be used to access a limited subset of kiwi functionality\r
* and data (think: plugins)\r
*/\r
-kiwi.global = {\r
+_kiwi.global = {\r
utils: undefined, // Re-usable methods\r
gateway: undefined,\r
user: undefined,\r
start: function (opts) {\r
opts = opts || {};\r
\r
- kiwi.app = new kiwi.model.Application(opts);\r
+ _kiwi.app = new _kiwi.model.Application(opts);\r
\r
if (opts.kiwi_server) {\r
- kiwi.app.kiwi_server = opts.kiwi_server;\r
+ _kiwi.app.kiwi_server = opts.kiwi_server;\r
}\r
\r
- kiwi.app.start();\r
+ _kiwi.app.start();\r
\r
return true;\r
}\r
\r
// If within a closure, expose the kiwi globals\r
if (typeof global !== 'undefined') {\r
- global.kiwi = kiwi.global;\r
+ global.kiwi = _kiwi.global;\r
+} else {\r
+ // Not within a closure so set a var in the current scope\r
+ var kiwi = _kiwi.global;\r
}
\ No newline at end of file
\r
\r
\r
- kiwi.applets.Chanlist = Backbone.Model.extend({\r
+ _kiwi.applets.Chanlist = Backbone.Model.extend({\r
initialize: function () {\r
this.set('title', 'Channel List');\r
this.view = new View();\r
\r
\r
\r
- kiwi.applets.nickserv = Backbone.Model.extend({\r
+ _kiwi.applets.nickserv = Backbone.Model.extend({\r
initialize: function () {\r
this.set('title', 'Nickserv Login');\r
//this.view = new View();\r
\r
- kiwi.global.control.on('command_login', this.loginCommand, this);\r
+ _kiwi.global.control.on('command_login', this.loginCommand, this);\r
},\r
\r
loginCommand: function (event) {\r
var theme = $('.theme', this.$el).val();\r
\r
// Clear any current theme\r
- kiwi.app.view.$el.removeClass(function (i, css) {\r
+ _kiwi.app.view.$el.removeClass(function (i, css) {\r
return (css.match (/\btheme_\S+/g) || []).join(' ');\r
});\r
\r
- if (theme) kiwi.app.view.$el.addClass('theme_' + theme);\r
+ if (theme) _kiwi.app.view.$el.addClass('theme_' + theme);\r
}\r
});\r
\r
\r
\r
- kiwi.applets.Settings = Backbone.Model.extend({\r
+ _kiwi.applets.Settings = Backbone.Model.extend({\r
initialize: function () {\r
this.set('title', 'Settings');\r
this.view = new View();\r
\r
\r
/**\r
- * Build the kiwi.js files\r
+ * Build the _kiwi.js files\r
*/\r
\r
var src = concat([\r
]);\r
\r
\r
-src = '(function (global) {\n\n' + src + '\n\n})(window);';\r
+src = '(function (global, undefined) {\n\n' + src + '\n\n})(window);';\r
\r
\r
fs.writeFileSync(__dirname + '/../kiwi.js', src, FILE_ENCODING);\r
//kiwi_server: 'http://kiwiirc.com:80'\r
};\r
\r
- // Start the app by either the dev or closed environment\r
- (kiwi && kiwi.global && kiwi.global.start(opts)) || (kiwi && kiwi.start(opts));\r
+ // Start the app\r
+ kiwi.start(opts);\r
}\r
\r
\r
-kiwi.model.Applet = kiwi.model.Panel.extend({\r
+_kiwi.model.Applet = _kiwi.model.Panel.extend({\r
// Used to determine if this is an applet panel. Applet panel tabs are treated\r
// differently than others\r
applet: true,\r
initialize: function (attributes) {\r
// Temporary name\r
var name = "applet_"+(new Date().getTime().toString()) + Math.ceil(Math.random()*100).toString();\r
- this.view = new kiwi.view.Applet({model: this, name: name});\r
+ this.view = new _kiwi.view.Applet({model: this, name: name});\r
\r
this.set({\r
"name": name\r
this.view.$el.html('Loading..');\r
$script(applet_url, function () {\r
// Check if the applet loaded OK\r
- if (!kiwi.applets[applet_name]) {\r
+ if (!_kiwi.applets[applet_name]) {\r
that.view.$el.html('Not found');\r
return;\r
}\r
\r
// Load a new instance of this applet\r
- that.load(new kiwi.applets[applet_name]());\r
+ that.load(new _kiwi.applets[applet_name]());\r
});\r
},\r
\r
-kiwi.model.Application = function () {\r
+_kiwi.model.Application = function () {\r
// Set to a reference to this object within initialize()\r
var that = null;\r
\r
\r
\r
var model = function () {\r
- /** Instance of kiwi.model.PanelList */\r
+ /** Instance of _kiwi.model.PanelList */\r
this.panels = null;\r
\r
- /** kiwi.view.Application */\r
+ /** _kiwi.view.Application */\r
this.view = null;\r
\r
- /** kiwi.view.StatusMessage */\r
+ /** _kiwi.view.StatusMessage */\r
this.message = null;\r
\r
/* Address for the kiwi server */\r
this.detectKiwiServer();\r
\r
// Load the plugin manager\r
- this.plugins = new kiwi.model.PluginManager();\r
+ this.plugins = new _kiwi.model.PluginManager();\r
};\r
\r
this.start = function () {\r
}\r
\r
// Set the gateway up\r
- kiwi.gateway = new kiwi.model.Gateway();\r
- this.bindGatewayCommands(kiwi.gateway);\r
+ _kiwi.gateway = new _kiwi.model.Gateway();\r
+ this.bindGatewayCommands(_kiwi.gateway);\r
\r
this.initializeClient();\r
this.initializeGlobals();\r
kiwiServerNotFound();\r
return;\r
}\r
- kiwi.gateway.set('kiwi_server', that.kiwi_server + '/kiwi');\r
- kiwi.gateway.set('nick', event.nick);\r
+ _kiwi.gateway.set('kiwi_server', that.kiwi_server + '/kiwi');\r
+ _kiwi.gateway.set('nick', event.nick);\r
\r
- kiwi.gateway.connect(event.server, event.port, event.ssl, event.password, function (error) {\r
+ _kiwi.gateway.connect(event.server, event.port, event.ssl, event.password, function (error) {\r
if (error) {\r
kiwiServerNotFound();\r
}\r
// TODO: Shouldn't really be here but it's not working in the view.. :/\r
// Hack for firefox browers: Focus is not given on this event loop iteration\r
setTimeout(function(){\r
- kiwi.app.panels.server.server_login.$el.find('.nick').select();\r
+ _kiwi.app.panels.server.server_login.$el.find('.nick').select();\r
}, 0);\r
};\r
\r
\r
\r
this.initializeClient = function () {\r
- this.view = new kiwi.view.Application({model: this, el: this.get('container')});\r
+ this.view = new _kiwi.view.Application({model: this, el: this.get('container')});\r
\r
/**\r
* Set the UI components up\r
*/\r
- this.panels = new kiwi.model.PanelList();\r
+ this.panels = new _kiwi.model.PanelList();\r
\r
- this.controlbox = new kiwi.view.ControlBox({el: $('#controlbox')[0]});\r
+ this.controlbox = new _kiwi.view.ControlBox({el: $('#controlbox')[0]});\r
this.bindControllboxCommands(this.controlbox);\r
\r
- this.topicbar = new kiwi.view.TopicBar({el: $('#topic')[0]});\r
+ this.topicbar = new _kiwi.view.TopicBar({el: $('#topic')[0]});\r
\r
- new kiwi.view.AppToolbar({el: $('#toolbar .app_tools')[0]});\r
+ new _kiwi.view.AppToolbar({el: $('#toolbar .app_tools')[0]});\r
\r
- this.message = new kiwi.view.StatusMessage({el: $('#status_message')[0]});\r
+ this.message = new _kiwi.view.StatusMessage({el: $('#status_message')[0]});\r
\r
- this.resize_handle = new kiwi.view.ResizeHandler({el: $('#memberlists_resize_handle')[0]});\r
+ this.resize_handle = new _kiwi.view.ResizeHandler({el: $('#memberlists_resize_handle')[0]});\r
\r
this.panels.server.view.show();\r
\r
\r
\r
this.initializeGlobals = function () {\r
- kiwi.global.control = this.controlbox;\r
+ _kiwi.global.control = this.controlbox;\r
};\r
\r
\r
\r
this.bindGatewayCommands = function (gw) {\r
gw.on('onmotd', function (event) {\r
- that.panels.server.addMsg(kiwi.gateway.get('name'), event.msg, 'motd');\r
+ that.panels.server.addMsg(_kiwi.gateway.get('name'), event.msg, 'motd');\r
});\r
\r
\r
that.message.text(msg, {timeout: 10000});\r
\r
// Mention the disconnection on every channel\r
- $.each(kiwi.app.panels.models, function (idx, panel) {\r
+ $.each(_kiwi.app.panels.models, function (idx, panel) {\r
if (!panel || !panel.isChannel()) return;\r
panel.addMsg('', msg, 'action quit');\r
});\r
- kiwi.app.panels.server.addMsg('', msg, 'action quit');\r
+ _kiwi.app.panels.server.addMsg('', msg, 'action quit');\r
\r
gw_stat = 1;\r
});\r
gw.on('reconnecting', function (event) {\r
msg = 'You have been disconnected. Attempting to reconnect again in ' + (event.delay/1000) + ' seconds..';\r
- kiwi.app.panels.server.addMsg('', msg, 'action quit');\r
+ _kiwi.app.panels.server.addMsg('', msg, 'action quit');\r
});\r
gw.on('connect', function (event) {\r
if (gw_stat !== 1) return;\r
that.message.text(msg, {timeout: 5000});\r
\r
// Mention the disconnection on every channel\r
- $.each(kiwi.app.panels.models, function (idx, panel) {\r
+ $.each(_kiwi.app.panels.models, function (idx, panel) {\r
if (!panel || !panel.isChannel()) return;\r
panel.addMsg('', msg, 'action join');\r
});\r
- kiwi.app.panels.server.addMsg('', msg, 'action join');\r
+ _kiwi.app.panels.server.addMsg('', msg, 'action join');\r
\r
gw_stat = 0;\r
});\r
var c, members, user;\r
c = that.panels.getByName(event.channel);\r
if (!c) {\r
- c = new kiwi.model.Channel({name: event.channel});\r
+ c = new _kiwi.model.Channel({name: event.channel});\r
that.panels.add(c);\r
}\r
\r
members = c.get('members');\r
if (!members) return;\r
\r
- user = new kiwi.model.Member({nick: event.nick, ident: event.ident, hostname: event.hostname});\r
+ user = new _kiwi.model.Member({nick: event.nick, ident: event.ident, hostname: event.hostname});\r
members.add(user);\r
// TODO: highlight the new channel in some way\r
});\r
if (!channel) return;\r
\r
// If this is us, close the panel\r
- if (event.nick === kiwi.gateway.get('nick')) {\r
+ if (event.nick === _kiwi.gateway.get('nick')) {\r
channel.close();\r
return;\r
}\r
\r
members.remove(user, part_options);\r
\r
- if (event.kicked === kiwi.gateway.get('nick')) {\r
+ if (event.kicked === _kiwi.gateway.get('nick')) {\r
members.reset([]);\r
}\r
\r
\r
gw.on('onmsg', function (event) {\r
var panel,\r
- is_pm = (event.channel == kiwi.gateway.get('nick'));\r
+ is_pm = (event.channel == _kiwi.gateway.get('nick'));\r
\r
if (is_pm) {\r
// If a panel isn't found for this PM, create one\r
panel = that.panels.getByName(event.nick);\r
if (!panel) {\r
- panel = new kiwi.model.Query({name: event.nick});\r
+ panel = new _kiwi.model.Query({name: event.nick});\r
that.panels.add(panel);\r
}\r
\r
\r
gw.on('onaction', function (event) {\r
var panel,\r
- is_pm = (event.channel == kiwi.gateway.get('nick'));\r
+ is_pm = (event.channel == _kiwi.gateway.get('nick'));\r
\r
if (is_pm) {\r
// If a panel isn't found for this PM, create one\r
panel = that.panels.getByName(event.nick);\r
if (!panel) {\r
- panel = new kiwi.model.Channel({name: event.nick});\r
+ panel = new _kiwi.model.Channel({name: event.nick});\r
that.panels.add(panel);\r
}\r
\r
c.set('topic', event.topic);\r
\r
// If this is the active channel, update the topic bar too\r
- if (c.get('name') === kiwi.app.panels.active.get('name')) {\r
+ if (c.get('name') === _kiwi.app.panels.active.get('name')) {\r
that.topicbar.setCurrentTopic(event.topic);\r
}\r
});\r
\r
channel.temp_userlist = channel.temp_userlist || [];\r
_.each(event.users, function (item) {\r
- var user = new kiwi.model.Member({nick: item.nick, modes: item.modes});\r
+ var user = new _kiwi.model.Member({nick: item.nick, modes: item.modes});\r
channel.temp_userlist.push(user);\r
});\r
});\r
\r
channel = that.panels.getByName(event.target);\r
if (channel) {\r
- prefixes = kiwi.gateway.get('user_prefixes');\r
+ prefixes = _kiwi.gateway.get('user_prefixes');\r
find_prefix = function (p) {\r
return event.modes[i].mode[1] === p.mode;\r
};\r
channel.addMsg('', '== ' + event.nick + ' sets mode ' + friendlyModeString(), 'action mode');\r
} else {\r
// This is probably a mode being set on us.\r
- if (event.target.toLowerCase() === kiwi.gateway.get("nick").toLowerCase()) {\r
+ if (event.target.toLowerCase() === _kiwi.gateway.get("nick").toLowerCase()) {\r
that.panels.server.addMsg('', '== ' + event.nick + ' set mode ' + friendlyModeString(), 'action mode');\r
} else {\r
console.log('MODE command recieved for unknown target %s: ', event.target, event);\r
idle_time = idle_time.h.toString().lpad(2, "0") + ':' + idle_time.m.toString().lpad(2, "0") + ':' + idle_time.s.toString().lpad(2, "0");\r
}\r
\r
- panel = kiwi.app.panels.active;\r
+ panel = _kiwi.app.panels.active;\r
if (event.ident) {\r
panel.addMsg(event.nick, 'is ' + event.nick + '!' + event.ident + '@' + event.host + ' * ' + event.msg, 'whois');\r
} else if (event.chans) {\r
\r
\r
gw.on('onlist_start', function (data) {\r
- if (kiwi.app.channel_list) {\r
- kiwi.app.channel_list.close();\r
- delete kiwi.app.channel_list;\r
+ if (_kiwi.app.channel_list) {\r
+ _kiwi.app.channel_list.close();\r
+ delete _kiwi.app.channel_list;\r
}\r
\r
- var panel = new kiwi.model.Applet(),\r
- applet = new kiwi.applets.Chanlist();\r
+ var panel = new _kiwi.model.Applet(),\r
+ applet = new _kiwi.applets.Chanlist();\r
\r
panel.load(applet);\r
\r
- kiwi.app.panels.add(panel);\r
+ _kiwi.app.panels.add(panel);\r
panel.view.show();\r
\r
- kiwi.app.channel_list = applet;\r
+ _kiwi.app.channel_list = applet;\r
});\r
\r
\r
gw.on('onlist_channel', function (data) {\r
// TODO: Put this listener within the applet itself\r
- kiwi.app.channel_list.addChannel(data.chans);\r
+ _kiwi.app.channel_list.addChannel(data.chans);\r
});\r
\r
\r
gw.on('onlist_end', function (data) {\r
// TODO: Put this listener within the applet itself\r
- delete kiwi.app.channel_list;\r
+ delete _kiwi.app.channel_list;\r
});\r
\r
\r
gw.on('onirc_error', function (data) {\r
var panel, tmp;\r
\r
- if (data.channel !== undefined && !(panel = kiwi.app.panels.getByName(data.channel))) {\r
- panel = kiwi.app.panels.server;\r
+ if (data.channel !== undefined && !(panel = _kiwi.app.panels.getByName(data.channel))) {\r
+ panel = _kiwi.app.panels.server;\r
}\r
\r
switch (data.error) {\r
case 'banned_from_channel':\r
panel.addMsg(' ', '== You are banned from ' + data.channel + '. ' + data.reason, 'status');\r
- kiwi.app.message.text('You are banned from ' + data.channel + '. ' + data.reason);\r
+ _kiwi.app.message.text('You are banned from ' + data.channel + '. ' + data.reason);\r
break;\r
case 'bad_channel_key':\r
panel.addMsg(' ', '== Bad channel key for ' + data.channel, 'status');\r
- kiwi.app.message.text('Bad channel key or password for ' + data.channel);\r
+ _kiwi.app.message.text('Bad channel key or password for ' + data.channel);\r
break;\r
case 'invite_only_channel':\r
panel.addMsg(' ', '== ' + data.channel + ' is invite only.', 'status');\r
- kiwi.app.message.text(data.channel + ' is invite only');\r
+ _kiwi.app.message.text(data.channel + ' is invite only');\r
break;\r
case 'channel_is_full':\r
panel.addMsg(' ', '== ' + data.channel + ' is full.', 'status');\r
- kiwi.app.message.text(data.channel + ' is full');\r
+ _kiwi.app.message.text(data.channel + ' is full');\r
break;\r
case 'chanop_privs_needed':\r
panel.addMsg(' ', '== ' + data.reason, 'status');\r
- kiwi.app.message.text(data.reason + ' (' + data.channel + ')');\r
+ _kiwi.app.message.text(data.reason + ' (' + data.channel + ')');\r
break;\r
case 'no_such_nick':\r
- tmp = kiwi.app.panels.getByName(data.nick);\r
+ tmp = _kiwi.app.panels.getByName(data.nick);\r
if (tmp) {\r
tmp.addMsg(' ', '== ' + data.nick + ': ' + data.reason, 'status');\r
} else {\r
- kiwi.app.panels.server.addMsg(' ', '== ' + data.nick + ': ' + data.reason, 'status');\r
+ _kiwi.app.panels.server.addMsg(' ', '== ' + data.nick + ': ' + data.reason, 'status');\r
}\r
break;\r
case 'nickname_in_use':\r
- kiwi.app.panels.server.addMsg(' ', '== The nickname ' + data.nick + ' is already in use. Please select a new nickname', 'status');\r
- if (kiwi.app.panels.server !== kiwi.app.panels.active) {\r
- kiwi.app.message.text('The nickname "' + data.nick + '" is already in use. Please select a new nickname');\r
+ _kiwi.app.panels.server.addMsg(' ', '== The nickname ' + data.nick + ' is already in use. Please select a new nickname', 'status');\r
+ if (_kiwi.app.panels.server !== _kiwi.app.panels.active) {\r
+ _kiwi.app.message.text('The nickname "' + data.nick + '" is already in use. Please select a new nickname');\r
}\r
\r
// Only show the nickchange component if the controlbox is open\r
if (that.controlbox.$el.css('display') !== 'none') {\r
- (new kiwi.view.NickChangeBox()).render();\r
+ (new _kiwi.view.NickChangeBox()).render();\r
}\r
\r
break;\r
default:\r
// We don't know what data contains, so don't do anything with it.\r
- //kiwi.front.tabviews.server.addMsg(null, ' ', '== ' + data, 'status');\r
+ //_kiwi.front.tabviews.server.addMsg(null, ' ', '== ' + data, 'status');\r
}\r
});\r
};\r
controlbox.on('command_part', partCommand);\r
\r
controlbox.on('command_nick', function (ev) {\r
- kiwi.gateway.changeNick(ev.params[0]);\r
+ _kiwi.gateway.changeNick(ev.params[0]);\r
});\r
\r
controlbox.on('command_query', queryCommand);\r
// No parameters passed so list them\r
if (!ev.params[1]) {\r
$.each(controlbox.preprocessor.aliases, function (name, rule) {\r
- kiwi.app.panels.server.addMsg(' ', name + ' => ' + rule);\r
+ _kiwi.app.panels.server.addMsg(' ', name + ' => ' + rule);\r
});\r
return;\r
}\r
function unknownCommand (ev) {\r
var raw_cmd = ev.command + ' ' + ev.params.join(' ');\r
console.log('RAW: ' + raw_cmd);\r
- kiwi.gateway.raw(raw_cmd);\r
+ _kiwi.gateway.raw(raw_cmd);\r
}\r
\r
function allCommands (ev) {}\r
// Check if we have the panel already. If not, create it\r
channel = that.panels.getByName(channel_name);\r
if (!channel) {\r
- channel = new kiwi.model.Channel({name: channel_name});\r
- kiwi.app.panels.add(channel);\r
+ channel = new _kiwi.model.Channel({name: channel_name});\r
+ _kiwi.app.panels.add(channel);\r
}\r
\r
- kiwi.gateway.join(channel_name);\r
+ _kiwi.gateway.join(channel_name);\r
});\r
\r
if (channel) channel.view.show();\r
// Check if we have the panel already. If not, create it\r
panel = that.panels.getByName(destination);\r
if (!panel) {\r
- panel = new kiwi.model.Query({name: destination});\r
- kiwi.app.panels.add(panel);\r
+ panel = new _kiwi.model.Query({name: destination});\r
+ _kiwi.app.panels.add(panel);\r
}\r
\r
if (panel) panel.view.show();\r
\r
ev.params.shift();\r
\r
- panel.addMsg(kiwi.gateway.get('nick'), ev.params.join(' '));\r
- kiwi.gateway.privmsg(destination, ev.params.join(' '));\r
+ panel.addMsg(_kiwi.gateway.get('nick'), ev.params.join(' '));\r
+ _kiwi.gateway.privmsg(destination, ev.params.join(' '));\r
}\r
\r
function actionCommand (ev) {\r
- if (kiwi.app.panels.active === kiwi.app.panels.server) {\r
+ if (_kiwi.app.panels.active === _kiwi.app.panels.server) {\r
return;\r
}\r
\r
- var panel = kiwi.app.panels.active;\r
- panel.addMsg('', '* ' + kiwi.gateway.get('nick') + ' ' + ev.params.join(' '), 'action');\r
- kiwi.gateway.action(panel.get('name'), ev.params.join(' '));\r
+ var panel = _kiwi.app.panels.active;\r
+ panel.addMsg('', '* ' + _kiwi.gateway.get('nick') + ' ' + ev.params.join(' '), 'action');\r
+ _kiwi.gateway.action(panel.get('name'), ev.params.join(' '));\r
}\r
\r
function partCommand (ev) {\r
if (ev.params.length === 0) {\r
- kiwi.gateway.part(kiwi.app.panels.active.get('name'));\r
+ _kiwi.gateway.part(_kiwi.app.panels.active.get('name'));\r
} else {\r
_.each(ev.params, function (channel) {\r
- kiwi.gateway.part(channel);\r
+ _kiwi.gateway.part(channel);\r
});\r
}\r
// TODO: More responsive = close tab now, more accurate = leave until part event\r
- //kiwi.app.panels.remove(kiwi.app.panels.active);\r
+ //_kiwi.app.panels.remove(_kiwi.app.panels.active);\r
}\r
\r
function topicCommand (ev) {\r
channel_name = ev.params[0];\r
ev.params.shift();\r
} else {\r
- channel_name = kiwi.app.panels.active.get('name');\r
+ channel_name = _kiwi.app.panels.active.get('name');\r
}\r
\r
- kiwi.gateway.topic(channel_name, ev.params.join(' '));\r
+ _kiwi.gateway.topic(channel_name, ev.params.join(' '));\r
}\r
\r
function noticeCommand (ev) {\r
destination = ev.params[0];\r
ev.params.shift();\r
\r
- kiwi.gateway.notice(destination, ev.params.join(' '));\r
+ _kiwi.gateway.notice(destination, ev.params.join(' '));\r
}\r
\r
function quoteCommand (ev) {\r
var raw = ev.params.join(' ');\r
- kiwi.gateway.raw(raw);\r
+ _kiwi.gateway.raw(raw);\r
}\r
\r
function kickCommand (ev) {\r
- var nick, panel = kiwi.app.panels.active;\r
+ var nick, panel = _kiwi.app.panels.active;\r
\r
if (!panel.isChannel()) return;\r
\r
nick = ev.params[0];\r
ev.params.shift();\r
\r
- kiwi.gateway.kick(panel.get('name'), nick, ev.params.join(' '));\r
+ _kiwi.gateway.kick(panel.get('name'), nick, ev.params.join(' '));\r
}\r
\r
function settingsCommand (ev) {\r
- var panel = new kiwi.model.Applet();\r
- panel.load(new kiwi.applets.Settings());\r
+ var panel = new _kiwi.model.Applet();\r
+ panel.load(new _kiwi.applets.Settings());\r
\r
- kiwi.app.panels.add(panel);\r
+ _kiwi.app.panels.add(panel);\r
panel.view.show();\r
}\r
\r
function appletCommand (ev) {\r
if (!ev.params[0]) return;\r
\r
- var panel = new kiwi.model.Applet();\r
+ var panel = new _kiwi.model.Applet();\r
\r
if (ev.params[1]) {\r
// Url and name given\r
panel.load(ev.params[0], ev.params[1]);\r
} else {\r
// Load a pre-loaded applet\r
- if (kiwi.applets[ev.params[0]]) {\r
- panel.load(new kiwi.applets[ev.params[0]]());\r
+ if (_kiwi.applets[ev.params[0]]) {\r
+ panel.load(new _kiwi.applets[ev.params[0]]());\r
} else {\r
- kiwi.app.panels.server.addMsg('', 'Applet "' + ev.params[0] + '" does not exist');\r
+ _kiwi.app.panels.server.addMsg('', 'Applet "' + ev.params[0] + '" does not exist');\r
return;\r
}\r
}\r
\r
- kiwi.app.panels.add(panel);\r
+ _kiwi.app.panels.add(panel);\r
panel.view.show();\r
}\r
\r
\r
\r
this.isChannelName = function (channel_name) {\r
- var channel_prefix = kiwi.gateway.get('channel_prefix');\r
+ var channel_prefix = _kiwi.gateway.get('channel_prefix');\r
\r
if (!channel_name || !channel_name.length) return false;\r
return (channel_prefix.indexOf(channel_name[0]) > -1);\r
// TODO: Channel modes\r
// TODO: Listen to gateway events for anythign related to this channel\r
-kiwi.model.Channel = kiwi.model.Panel.extend({\r
+_kiwi.model.Channel = _kiwi.model.Panel.extend({\r
initialize: function (attributes) {\r
var name = this.get("name") || "",\r
members;\r
\r
- this.view = new kiwi.view.Channel({"model": this, "name": name});\r
+ this.view = new _kiwi.view.Channel({"model": this, "name": name});\r
this.set({\r
- "members": new kiwi.model.MemberList(),\r
+ "members": new _kiwi.model.MemberList(),\r
"name": name,\r
"scrollback": [],\r
"topic": ""\r
-kiwi.model.Gateway = function () {\r
+_kiwi.model.Gateway = function () {\r
\r
// Set to a reference to this object within initialize()\r
var that = null;\r
var resource;\r
\r
// Work out the resource URL for socket.io\r
- if (kiwi.app.get('base_path').substr(0, 1) === '/') {\r
- resource = kiwi.app.get('base_path');\r
+ if (_kiwi.app.get('base_path').substr(0, 1) === '/') {\r
+ resource = _kiwi.app.get('base_path');\r
resource = resource.substr(1, resource.length-1);\r
resource += '/transport';\r
} else {\r
- resource = kiwi.app.get('base_path') + '/transport';\r
+ resource = _kiwi.app.get('base_path') + '/transport';\r
}\r
\r
this.socket = io.connect(this.get('kiwi_server'), {\r
});\r
\r
this.socket.on('error', function (e) {\r
- console.log("kiwi.gateway.socket.on('error')", {reason: e});\r
+ console.log("_kiwi.gateway.socket.on('error')", {reason: e});\r
that.trigger("connect_fail", {reason: e});\r
});\r
\r
this.socket.on('connecting', function (transport_type) {\r
- console.log("kiwi.gateway.socket.on('connecting')");\r
+ console.log("_kiwi.gateway.socket.on('connecting')");\r
that.trigger("connecting");\r
});\r
\r
this.emit('kiwi', {command: 'connect', nick: that.get('nick'), hostname: host, port: port, ssl: ssl, password:password}, function (err, server_num) {\r
if (!err) {\r
that.server_num = server_num;\r
- console.log("kiwi.gateway.socket.on('connect')");\r
+ console.log("_kiwi.gateway.socket.on('connect')");\r
} else {\r
- console.log("kiwi.gateway.socket.on('error')", {reason: err});\r
+ console.log("_kiwi.gateway.socket.on('error')", {reason: err});\r
callback(err);\r
}\r
});\r
\r
this.socket.on('disconnect', function () {\r
that.trigger("disconnect", {});\r
- console.log("kiwi.gateway.socket.on('disconnect')");\r
+ console.log("_kiwi.gateway.socket.on('disconnect')");\r
});\r
\r
this.socket.on('close', function () {\r
- console.log("kiwi.gateway.socket.on('close')");\r
+ console.log("_kiwi.gateway.socket.on('close')");\r
});\r
\r
this.socket.on('reconnecting', function (reconnectionDelay, reconnectionAttempts) {\r
- console.log("kiwi.gateway.socket.on('reconnecting')");\r
+ console.log("_kiwi.gateway.socket.on('reconnecting')");\r
that.trigger("reconnecting", {delay: reconnectionDelay, attempts: reconnectionAttempts});\r
});\r
\r
this.socket.on('reconnect_failed', function () {\r
- console.log("kiwi.gateway.socket.on('reconnect_failed')");\r
+ console.log("_kiwi.gateway.socket.on('reconnect_failed')");\r
});\r
};\r
\r
break;\r
/*\r
case 'sync':\r
- if (kiwi.gateway.onSync && kiwi.gateway.syncing) {\r
- kiwi.gateway.syncing = false;\r
- kiwi.gateway.onSync(item);\r
+ if (_kiwi.gateway.onSync && _kiwi.gateway.syncing) {\r
+ _kiwi.gateway.syncing = false;\r
+ _kiwi.gateway.onSync(item);\r
}\r
break;\r
*/\r
\r
case 'kiwi':\r
- this.emit('kiwi.' + data.namespace, data.data);\r
+ this.emit('_kiwi.' + data.namespace, data.data);\r
break;\r
}\r
}\r
-kiwi.model.Member = Backbone.Model.extend({\r
+_kiwi.model.Member = Backbone.Model.extend({\r
sortModes: function (modes) {\r
return modes.sort(function (a, b) {\r
var a_idx, b_idx, i;\r
- var user_prefixes = kiwi.gateway.get('user_prefixes');\r
+ var user_prefixes = _kiwi.gateway.get('user_prefixes');\r
\r
for (i = 0; i < user_prefixes.length; i++) {\r
if (user_prefixes[i].mode === a) {\r
},\r
getPrefix: function (modes) {\r
var prefix = '';\r
- var user_prefixes = kiwi.gateway.get('user_prefixes');\r
+ var user_prefixes = _kiwi.gateway.get('user_prefixes');\r
\r
if (typeof modes[0] !== 'undefined') {\r
prefix = _.detect(user_prefixes, function (prefix) {\r
},\r
stripPrefix: function (nick) {\r
var tmp = nick, i, j, k;\r
- var user_prefixes = kiwi.gateway.get('user_prefixes');\r
+ var user_prefixes = _kiwi.gateway.get('user_prefixes');\r
i = 0;\r
\r
for (j = 0; j < nick.length; j++) {\r
-kiwi.model.MemberList = Backbone.Collection.extend({\r
- model: kiwi.model.Member,\r
+_kiwi.model.MemberList = Backbone.Collection.extend({\r
+ model: _kiwi.model.Member,\r
comparator: function (a, b) {\r
var i, a_modes, b_modes, a_idx, b_idx, a_nick, b_nick;\r
- var user_prefixes = kiwi.gateway.get('user_prefixes');\r
+ var user_prefixes = _kiwi.gateway.get('user_prefixes');\r
a_modes = a.get("modes");\r
b_modes = b.get("modes");\r
// Try to sort by modes first\r
}\r
},\r
initialize: function (options) {\r
- this.view = new kiwi.view.MemberList({"model": this});\r
+ this.view = new _kiwi.view.MemberList({"model": this});\r
},\r
getByNick: function (nick) {\r
if (typeof nick !== 'string') return;\r
-kiwi.model.Panel = Backbone.Model.extend({\r
+_kiwi.model.Panel = Backbone.Model.extend({\r
initialize: function (attributes) {\r
var name = this.get("name") || "";\r
- this.view = new kiwi.view.Panel({"model": this, "name": name});\r
+ this.view = new _kiwi.view.Panel({"model": this, "name": name});\r
this.set({\r
"scrollback": [],\r
"name": name\r
\r
// Run through the plugins\r
message_obj = {"msg": msg, "time": opts.time, "nick": nick, "chan": this.get("name"), "type": type, "style": opts.style};\r
- //tmp = kiwi.plugs.run('addmsg', message_obj);\r
+ //tmp = _kiwi.plugs.run('addmsg', message_obj);\r
if (!message_obj) {\r
return;\r
}\r
this.unset('members');\r
}\r
\r
- kiwi.app.panels.remove(this);\r
+ _kiwi.app.panels.remove(this);\r
\r
this.unbind();\r
this.destroy();\r
\r
// If closing the active panel, switch to the server panel\r
- if (this.cid === kiwi.app.panels.active.cid) {\r
- kiwi.app.panels.server.view.show();\r
+ if (this.cid === _kiwi.app.panels.active.cid) {\r
+ _kiwi.app.panels.server.view.show();\r
}\r
},\r
\r
},\r
\r
isChannel: function () {\r
- var channel_prefix = kiwi.gateway.get('channel_prefix'),\r
+ var channel_prefix = _kiwi.gateway.get('channel_prefix'),\r
this_name = this.get('name');\r
\r
if (this.isApplet() || !this_name) return false;\r
},\r
\r
isActive: function () {\r
- return (kiwi.app.panels.active === this);\r
+ return (_kiwi.app.panels.active === this);\r
}\r
});
\ No newline at end of file
-kiwi.model.PanelList = Backbone.Collection.extend({\r
- model: kiwi.model.Panel,\r
+_kiwi.model.PanelList = Backbone.Collection.extend({\r
+ model: _kiwi.model.Panel,\r
\r
comparator: function (chan) {\r
return chan.get("name");\r
},\r
initialize: function () {\r
- this.view = new kiwi.view.Tabs({"el": $('#tabs')[0], "model": this});\r
+ this.view = new _kiwi.view.Tabs({"el": $('#tabs')[0], "model": this});\r
\r
// Automatically create a server tab\r
- this.add(new kiwi.model.Server({'name': kiwi.gateway.get('name')}));\r
- this.server = this.getByName(kiwi.gateway.get('name'));\r
+ this.add(new _kiwi.model.Server({'name': _kiwi.gateway.get('name')}));\r
+ this.server = this.getByName(_kiwi.gateway.get('name'));\r
\r
// Holds the active panel\r
this.active = null;\r
-kiwi.model.PluginManager = Backbone.Model.extend({\r
+_kiwi.model.PluginManager = Backbone.Model.extend({\r
initialize: function () {\r
this.$plugin_holder = $('<div id="kiwi_plugins" style="display:none;"></div>').appendTo('#kiwi');\r
this.loaded_plugins = {};\r
-kiwi.model.Query = kiwi.model.Panel.extend({\r
+_kiwi.model.Query = _kiwi.model.Panel.extend({\r
initialize: function (attributes) {\r
var name = this.get("name") || "",\r
members;\r
\r
- this.view = new kiwi.view.Channel({"model": this, "name": name});\r
+ this.view = new _kiwi.view.Channel({"model": this, "name": name});\r
this.set({\r
"name": name,\r
"scrollback": []\r
-kiwi.model.Server = kiwi.model.Panel.extend({\r
+_kiwi.model.Server = _kiwi.model.Panel.extend({\r
// Used to determine if this is a server panel\r
server: true,\r
\r
initialize: function (attributes) {\r
var name = "Server";\r
- this.view = new kiwi.view.Panel({"model": this, "name": name});\r
+ this.view = new _kiwi.view.Panel({"model": this, "name": name});\r
this.set({\r
"scrollback": [],\r
"name": name\r
\r
//this.addMsg(' ', '--> Kiwi IRC: Such an awesome IRC client', '', {style: 'color:#009900;'});\r
\r
- this.server_login = new kiwi.view.ServerSelect();\r
+ this.server_login = new _kiwi.view.ServerSelect();\r
\r
this.view.$el.append(this.server_login.$el);\r
this.server_login.show();\r
{
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;
//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 = '<span style="color:red;">' + event.msg + '</span>';
// }
//}
// 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();
tooltip;
if (tt.text() === '') {
- tooltip = $('<a class="link_ext_browser">Open in Kiwi..</a>');
+ tooltip = $('<a class="link_ext_browser">Open in _kiwi..</a>');
tt.append(tooltip);
}
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 = '<span style="color:' + c + ';">' + event.nick + '</span>';
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);
});
* @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) {
};
};
-kiwi.data = new kiwi.dataStore('kiwi');
+_kiwi.data = new _kiwi.dataStore('kiwi');
/*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 */\r
/*global kiwi */\r
\r
-kiwi.view.MemberList = Backbone.View.extend({\r
+_kiwi.view.MemberList = Backbone.View.extend({\r
tagName: "ul",\r
events: {\r
"click .nick": "nickClick"\r
nickClick: function (x) {\r
var target = $(x.currentTarget).parent('li'),\r
member = target.data('member'),\r
- userbox = new kiwi.view.UserBox();\r
+ userbox = new _kiwi.view.UserBox();\r
\r
userbox.member = member;\r
$('.userbox', this.$el).remove();\r
\r
\r
\r
-kiwi.view.UserBox = Backbone.View.extend({\r
+_kiwi.view.UserBox = Backbone.View.extend({\r
events: {\r
'click .query': 'queryClick',\r
'click .info': 'infoClick',\r
},\r
\r
queryClick: function (event) {\r
- var panel = new kiwi.model.Query({name: this.member.get('nick')});\r
- kiwi.app.panels.add(panel);\r
+ var panel = new _kiwi.model.Query({name: this.member.get('nick')});\r
+ _kiwi.app.panels.add(panel);\r
panel.view.show();\r
},\r
\r
infoClick: function (event) {\r
- kiwi.app.controlbox.processInput('/whois ' + this.member.get('nick'));\r
+ _kiwi.app.controlbox.processInput('/whois ' + this.member.get('nick'));\r
},\r
\r
slapClick: function (event) {\r
- kiwi.app.controlbox.processInput('/slap ' + this.member.get('nick'));\r
+ _kiwi.app.controlbox.processInput('/slap ' + this.member.get('nick'));\r
}\r
});\r
\r
-kiwi.view.NickChangeBox = Backbone.View.extend({\r
+_kiwi.view.NickChangeBox = Backbone.View.extend({\r
events: {\r
'submit': 'changeNick',\r
'click .cancel': 'close'\r
\r
render: function () {\r
// Add the UI component and give it focus\r
- kiwi.app.controlbox.$el.prepend(this.$el);\r
+ _kiwi.app.controlbox.$el.prepend(this.$el);\r
this.$el.find('input').focus();\r
\r
- this.$el.css('bottom', kiwi.app.controlbox.$el.outerHeight(true));\r
+ this.$el.css('bottom', _kiwi.app.controlbox.$el.outerHeight(true));\r
},\r
\r
close: function () {\r
\r
changeNick: function (event) {\r
var that = this;\r
- kiwi.gateway.changeNick(this.$el.find('input').val(), function (err, val) {\r
+ _kiwi.gateway.changeNick(this.$el.find('input').val(), function (err, val) {\r
that.close();\r
});\r
return false;\r
}\r
});\r
\r
-kiwi.view.ServerSelect = function () {\r
+_kiwi.view.ServerSelect = function () {\r
// Are currently showing all the controlls or just a nick_change box?\r
var state = 'all';\r
\r
initialize: function () {\r
this.$el = $($('#tmpl_server_select').html());\r
\r
- kiwi.gateway.bind('onconnect', this.networkConnected, this);\r
- kiwi.gateway.bind('connecting', this.networkConnecting, this);\r
+ _kiwi.gateway.bind('onconnect', this.networkConnected, this);\r
+ _kiwi.gateway.bind('connecting', this.networkConnecting, this);\r
\r
- kiwi.gateway.bind('onirc_error', function (data) {\r
+ _kiwi.gateway.bind('onirc_error', function (data) {\r
$('button', this.$el).attr('disabled', null);\r
\r
if (data.error == 'nickname_in_use') {\r
},\r
\r
submitNickChange: function (event) {\r
- kiwi.gateway.changeNick($('.nick', this.$el).val());\r
+ _kiwi.gateway.changeNick($('.nick', this.$el).val());\r
this.networkConnecting();\r
},\r
\r
};\r
\r
\r
-kiwi.view.Panel = Backbone.View.extend({\r
+_kiwi.view.Panel = Backbone.View.extend({\r
tagName: "div",\r
className: "messages",\r
events: {\r
msg.msg = $('<div />').text(msg.msg).html();\r
\r
// Make the channels clickable\r
- re = new RegExp('\\B([' + kiwi.gateway.get('channel_prefix') + '][^ ,.\\007]+)', 'g');\r
+ re = new RegExp('\\B([' + _kiwi.gateway.get('channel_prefix') + '][^ ,.\\007]+)', 'g');\r
msg.msg = msg.msg.replace(re, function (match) {\r
return '<a class="chan">' + match + '</a>';\r
});\r
// Activity/alerts based on the type of new message\r
if (msg.type.match(/^action /)) {\r
this.alert('action');\r
- } else if (msg.msg.indexOf(kiwi.gateway.get('nick')) > -1) {\r
- kiwi.app.view.alertWindow('* People are talking!');\r
+ } else if (msg.msg.indexOf(_kiwi.gateway.get('nick')) > -1) {\r
+ _kiwi.app.view.alertWindow('* People are talking!');\r
this.alert('highlight');\r
} else {\r
// If this is the active panel, send an alert out\r
if (this.model.isActive()) {\r
- kiwi.app.view.alertWindow('* People are talking!');\r
+ _kiwi.app.view.alertWindow('* People are talking!');\r
}\r
this.alert('activity');\r
}\r
},\r
chanClick: function (event) {\r
if (event.target) {\r
- kiwi.gateway.join($(event.target).text());\r
+ _kiwi.gateway.join($(event.target).text());\r
} else {\r
// IE...\r
- kiwi.gateway.join($(event.srcElement).text());\r
+ _kiwi.gateway.join($(event.srcElement).text());\r
}\r
},\r
show: function () {\r
$('#memberlists').hide().children().removeClass('active');\r
}\r
\r
- kiwi.app.view.doLayout();\r
+ _kiwi.app.view.doLayout();\r
\r
this.scrollToBottom();\r
this.alert('none');\r
\r
this.trigger('active', this.model);\r
- kiwi.app.panels.trigger('active', this.model);\r
+ _kiwi.app.panels.trigger('active', this.model);\r
},\r
\r
\r
alert: function (level) {\r
// No need to highlight if this si the active panel\r
- if (this.model == kiwi.app.panels.active) return;\r
+ if (this.model == _kiwi.app.panels.active) return;\r
\r
var types, type_idx;\r
types = ['none', 'action', 'activity', 'highlight'];\r
}\r
});\r
\r
-kiwi.view.Applet = kiwi.view.Panel.extend({\r
+_kiwi.view.Applet = _kiwi.view.Panel.extend({\r
className: 'applet',\r
initialize: function (options) {\r
this.initializePanel(options);\r
}\r
});\r
\r
-kiwi.view.Channel = kiwi.view.Panel.extend({\r
+_kiwi.view.Channel = _kiwi.view.Panel.extend({\r
initialize: function (options) {\r
this.initializePanel(options);\r
this.model.bind('change:topic', this.topic, this);\r
this.model.addMsg('', '== Topic for ' + this.model.get('name') + ' is: ' + topic, 'topic');\r
\r
// If this is the active channel then update the topic bar\r
- if (kiwi.app.panels.active === this) {\r
- kiwi.app.topicbar.setCurrentTopic(this.model.get("topic"));\r
+ if (_kiwi.app.panels.active === this) {\r
+ _kiwi.app.topicbar.setCurrentTopic(this.model.get("topic"));\r
}\r
}\r
});\r
\r
-// Model for this = kiwi.model.PanelList\r
-kiwi.view.Tabs = Backbone.View.extend({\r
+// Model for this = _kiwi.model.PanelList\r
+_kiwi.view.Tabs = Backbone.View.extend({\r
events: {\r
'click li': 'tabClick',\r
'click li .part': 'partClick'\r
this.tabs_applets = $('ul.applets', this.$el);\r
this.tabs_msg = $('ul.channels', this.$el);\r
\r
- kiwi.gateway.on('change:name', function (gateway, new_val) {\r
+ _kiwi.gateway.on('change:name', function (gateway, new_val) {\r
$('span', this.model.server.tab).text(new_val);\r
}, this);\r
},\r
.appendTo(panel.isApplet() ? this.tabs_applets : this.tabs_msg);\r
});\r
\r
- kiwi.app.view.doLayout();\r
+ _kiwi.app.view.doLayout();\r
},\r
\r
updateTabTitle: function (panel, new_title) {\r
.appendTo(panel.isApplet() ? this.tabs_applets : this.tabs_msg);\r
\r
panel.bind('change:title', this.updateTabTitle);\r
- kiwi.app.view.doLayout();\r
+ _kiwi.app.view.doLayout();\r
},\r
panelRemoved: function (panel) {\r
panel.tab.remove();\r
delete panel.tab;\r
\r
- kiwi.app.view.doLayout();\r
+ _kiwi.app.view.doLayout();\r
},\r
\r
panelActive: function (panel) {\r
// Only need to part if it's a channel\r
// If the nicklist is empty, we haven't joined the channel as yet\r
if (panel.isChannel() && panel.get('members').models.length > 0) {\r
- kiwi.gateway.part(panel.get('name'));\r
+ _kiwi.gateway.part(panel.get('name'));\r
} else {\r
panel.close();\r
}\r
},\r
\r
next: function () {\r
- var next = kiwi.app.panels.active.tab.next();\r
+ var next = _kiwi.app.panels.active.tab.next();\r
if (!next.length) next = $('li:first', this.tabs_msgs);\r
\r
next.click();\r
},\r
prev: function () {\r
- var prev = kiwi.app.panels.active.tab.prev();\r
+ var prev = _kiwi.app.panels.active.tab.prev();\r
if (!prev.length) prev = $('li:last', this.tabs_msgs);\r
\r
prev.click();\r
\r
\r
\r
-kiwi.view.TopicBar = Backbone.View.extend({\r
+_kiwi.view.TopicBar = Backbone.View.extend({\r
events: {\r
'keydown div': 'process'\r
},\r
\r
initialize: function () {\r
- kiwi.app.panels.bind('active', function (active_panel) {\r
+ _kiwi.app.panels.bind('active', function (active_panel) {\r
// If it's a channel topic, update and make editable\r
if (active_panel.isChannel()) {\r
this.setCurrentTopic(active_panel.get('topic') || '');\r
inp_val = inp.text();\r
\r
// Only allow topic editing if this is a channel panel\r
- if (!kiwi.app.panels.active.isChannel()) {\r
+ if (!_kiwi.app.panels.active.isChannel()) {\r
return false;\r
}\r
\r
// If hit return key, update the current topic\r
if (ev.keyCode === 13) {\r
- kiwi.gateway.topic(kiwi.app.panels.active.get('name'), inp_val);\r
+ _kiwi.gateway.topic(_kiwi.app.panels.active.get('name'), inp_val);\r
return false;\r
}\r
},\r
\r
\r
\r
-kiwi.view.ControlBox = Backbone.View.extend({\r
+_kiwi.view.ControlBox = Backbone.View.extend({\r
events: {\r
'keydown .inp': 'process',\r
'click .nick': 'showNickChange'\r
// Hold tab autocomplete data\r
this.tabcomplete = {active: false, data: [], prefix: ''};\r
\r
- kiwi.gateway.bind('change:nick', function () {\r
+ _kiwi.gateway.bind('change:nick', function () {\r
$('.nick', that.$el).text(this.get('nick'));\r
});\r
},\r
\r
showNickChange: function (ev) {\r
- (new kiwi.view.NickChangeBox()).render();\r
+ (new _kiwi.view.NickChangeBox()).render();\r
},\r
\r
process: function (ev) {\r
break;\r
\r
case (ev.keyCode === 37 && meta): // left\r
- kiwi.app.panels.view.prev();\r
+ _kiwi.app.panels.view.prev();\r
return false;\r
\r
case (ev.keyCode === 39 && meta): // right\r
- kiwi.app.panels.view.next();\r
+ _kiwi.app.panels.view.next();\r
return false;\r
\r
case (ev.keyCode === 9): // tab\r
if (_.isEqual(this.tabcomplete.data, [])) {\r
// Get possible autocompletions\r
var ac_data = [];\r
- $.each(kiwi.app.panels.active.get('members').models, function (i, member) {\r
+ $.each(_kiwi.app.panels.active.get('members').models, function (i, member) {\r
if (!member) return;\r
ac_data.push(member.get('nick'));\r
});\r
\r
// The default command\r
if (command_raw[0] !== '/') {\r
- command_raw = '/msg ' + kiwi.app.panels.active.get('name') + ' ' + command_raw;\r
+ command_raw = '/msg ' + _kiwi.app.panels.active.get('name') + ' ' + command_raw;\r
}\r
\r
// Process the raw command for any aliases\r
- this.preprocessor.vars.server = kiwi.gateway.get('name');\r
- this.preprocessor.vars.channel = kiwi.app.panels.active.get('name');\r
+ this.preprocessor.vars.server = _kiwi.gateway.get('name');\r
+ this.preprocessor.vars.channel = _kiwi.app.panels.active.get('name');\r
this.preprocessor.vars.destination = this.preprocessor.vars.channel;\r
command_raw = this.preprocessor.process(command_raw);\r
\r
} else {\r
// Default command\r
command = 'msg';\r
- params.unshift(kiwi.app.panels.active.get('name'));\r
+ params.unshift(_kiwi.app.panels.active.get('name'));\r
}\r
\r
// Trigger the command events\r
\r
\r
\r
-kiwi.view.StatusMessage = Backbone.View.extend({\r
+_kiwi.view.StatusMessage = Backbone.View.extend({\r
initialize: function () {\r
this.$el.hide();\r
\r
opt.timeout = opt.timeout || 5000;\r
\r
this.$el.text(text).attr('class', opt.type);\r
- this.$el.slideDown(kiwi.app.view.doLayout);\r
+ this.$el.slideDown(_kiwi.app.view.doLayout);\r
\r
if (opt.timeout) this.doTimeout(opt.timeout);\r
},\r
opt.timeout = opt.timeout || 5000;\r
\r
this.$el.html(text).attr('class', opt.type);\r
- this.$el.slideDown(kiwi.app.view.doLayout);\r
+ this.$el.slideDown(_kiwi.app.view.doLayout);\r
\r
if (opt.timeout) this.doTimeout(opt.timeout);\r
},\r
\r
hide: function () {\r
- this.$el.slideUp(kiwi.app.view.doLayout);\r
+ this.$el.slideUp(_kiwi.app.view.doLayout);\r
},\r
\r
doTimeout: function (length) {\r
\r
\r
\r
-kiwi.view.ResizeHandler = Backbone.View.extend({\r
+_kiwi.view.ResizeHandler = Backbone.View.extend({\r
events: {\r
'mousedown': 'startDrag',\r
'mouseup': 'stopDrag'\r
\r
this.$el.css('left', event.clientX - (this.$el.outerWidth(true) / 2));\r
$('#memberlists').css('width', this.$el.parent().width() - (this.$el.position().left + this.$el.outerWidth()));\r
- kiwi.app.view.doLayout();\r
+ _kiwi.app.view.doLayout();\r
}\r
});\r
\r
\r
\r
-kiwi.view.AppToolbar = Backbone.View.extend({\r
+_kiwi.view.AppToolbar = Backbone.View.extend({\r
events: {\r
'click .settings': 'clickSettings'\r
},\r
},\r
\r
clickSettings: function (event) {\r
- kiwi.app.controlbox.processInput('/settings');\r
+ _kiwi.app.controlbox.processInput('/settings');\r
}\r
});\r
\r
\r
\r
-kiwi.view.Application = Backbone.View.extend({\r
+_kiwi.view.Application = Backbone.View.extend({\r
initialize: function () {\r
$(window).resize(this.doLayout);\r
$('#toolbar').resize(this.doLayout);\r
\r
// Confirmation require to leave the page\r
window.onbeforeunload = function () {\r
- if (kiwi.gateway.isConnected()) {\r
+ if (_kiwi.gateway.isConnected()) {\r
return 'This will close all KiwiIRC conversations. Are you sure you want to close this window?';\r
}\r
};\r