$(kiwi.gateway).bind("onnick", kiwi.front.onNick);
$(kiwi.gateway).bind("onuserlist", kiwi.front.onUserList);
$(kiwi.gateway).bind("onuserlist_end", kiwi.front.onUserListEnd);
+ $(kiwi.gateway).bind("onlist_start", kiwi.front.onChannelListStart);
+ $(kiwi.gateway).bind("onlist_channel", kiwi.front.onChannelList);
+ $(kiwi.gateway).bind("onlist_end", kiwi.front.onChannelListEnd);
$(kiwi.gateway).bind("onjoin", kiwi.front.onJoin);
$(kiwi.gateway).bind("ontopic", kiwi.front.onTopic);
$(kiwi.gateway).bind("onpart", kiwi.front.onPart);
kiwi.front.registerKeys();
$('#kiwi .toolbars').resize(kiwi.front.doLayoutSize);
+ $(window).resize(kiwi.front.doLayoutSize);
+
+ // Add the resizer for the userlist
+ $('<div id="nicklist_resize" style="position:absolute; cursor:w-resize; width:5px;"></div>').appendTo('#kiwi');
+ $('#nicklist_resize').draggable({axis: "x", drag: function() {
+ var t = $(this);
+
+ var new_width = $(document).width() - parseInt(t.css('left'), 10);
+ new_width = new_width - parseInt($('#kiwi .userlist').css('margin-left'), 10);
+ new_width = new_width - parseInt($('#kiwi .userlist').css('margin-right'), 10);
+
+ // Make sure we don't remove the userlist alltogether
+ console.log(new_width);
+ if (new_width < 20) {
+ $(this).data('draggable').offset.click.left = 10;
+ console.log('whoaa');
+ }
+
+ kiwi.front.cur_channel.setUserlistWidth(new_width);
+ }});
+
$('#kiwi .formconnectwindow').submit(function () {
var netsel = $('#kiwi .formconnectwindow .network'),
kiwi.front.doLayout();
try {
kiwi.front.run('/connect ' + netsel.val());
- } catch (e) {
- alert(e);
- }
+ } catch (e) {}
$('#kiwi .connectwindow').slideUp('', kiwi.front.barsShow);
$('#windows').click(function () { $('#kiwi_msginput').focus(); });
n_bottom = $(document).height() - parseInt($('#kiwi .control').offset().top, 10);
$('#kiwi .windows').css({top: n_top + 'px', bottom: n_bottom + 'px'});
- $('#kiwi .userlist').css({top: n_top + 'px', bottom: n_bottom + 'px'});
+ ul.css({top: n_top + 'px', bottom: n_bottom + 'px'});
+
+ var nl = $('#nicklist_resize');
+ nl.css({top: n_top + 'px', bottom: n_bottom + 'px', left: $(document).width()-ul.outerWidth(true)});
},
document.userlist_updating = false;
},
+ onChannelListStart: function (e, data) {
+ console.log('Channel listing started');
+ },
+ onChannelList: function (e, data) {
+ var network_name = kiwi.gateway.network_name;
+ kiwi.front.tabviews.server.addMsg(null, network_name, data.channel + ' (' + data.num_users + ') ' + data.topic, '');
+ },
+ onChannelListEnd: function (e, data) {
+ console.log('Channel listing ended');
+ },
+
+
onJoin: function (e, data) {
if (!kiwi.front.tabviewExists(data.channel)) {
kiwi.front.tabviewAdd(data.channel.toLowerCase());
w.css('overflow-y', 'scroll');
// Set the window size accordingly
- if (this.userlist_width > 0) {
- u.width(this.userlist_width);
- w.css('right', u.outerWidth(true));
- } else {
- w.css('right', 0);
- }
+ this.setUserlistWidth();
// Activate this tab!
this.div.addClass('active');
if (this.userlist_width > 0) {
this.userlist.addClass('active');
+ // Enable the userlist resizer
+ $('#nicklist_resize').css('display', 'block');
+ } else {
+ // Disable the userlist resizer
+ $('#nicklist_resize').css('display', 'none');
}
this.tab.addClass('active');
delete kiwi.front.tabviews[this.name.toLowerCase()];
};
+Tabview.prototype.setUserlistWidth = function (new_width) {
+ var w, u;
+ if (typeof new_width === 'number') this.userlist_width = new_width;
+
+ w = $('#windows');
+ u = $('#kiwi .userlist');
+
+ // Set the window size accordingly
+ if (this.userlist_width > 0) {
+ u.width(this.userlist_width);
+ w.css('right', u.outerWidth(true));
+ } else {
+ w.css('right', 0);
+ }
+};
+
Tabview.prototype.addPartImage = function () {
this.clearPartImage();
RPL_WHOISIDLE: '317',
RPL_ENDOFWHOIS: '318',
RPL_WHOISCHANNELS: '319',
+ RPL_LISTSTART: '321',
+ RPL_LIST: '322',
+ RPL_LISTEND: '323',
RPL_NOTOPIC: '331',
RPL_TOPIC: '332',
RPL_NAMEREPLY: '353',
case ircNumerics.RPL_WHOISMODES:
websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing});
break;
+
+ case ircNumerics.RPL_LISTSTART:
+ (function () {
+ websocket.sendClientEvent('list_start', {server: ''});
+ }());
+ break;
+ case ircNumerics.RPL_LISTEND:
+ (function () {
+ websocket.sendClientEvent('list_end', {server: ''});
+ }());
+ break;
+
+ case ircNumerics.RPL_LIST:
+ (function () {
+ var parts, channel, num_users, modes, topic;
+
+ parts = msg.params.split(' ');
+ channel = parts[1];
+ num_users = parts[2];
+ modes = msg.trailing.split(' ', 1);
+ topic = msg.trailing.substring(msg.trailing.indexOf(' ')+1);
+
+ websocket.sendClientEvent('list_channel', {
+ server: '',
+ channel: channel,
+ topic: topic,
+ modes: modes,
+ num_users: num_users
+ });
+ }());
+ break;
+
case ircNumerics.RPL_WHOISIDLE:
params = msg.params.split(" ", 4);
rtn = {server: '', nick: params[1], idle: params[2]};