}
$('#kiwi .connectwindow').slideUp();
- $(document).mouseup(function(){ $('#kiwi_msginput').focus(); });
+ $('#windows').click(function(){ $('#kiwi_msginput').focus(); });
return false;
});
var ct = $('#kiwi .cur_topic');
var ul = $('#kiwi .userlist');
- var top = parseInt(ct.offset().top) + parseInt(ct.height());
- top = top + parseInt(ct.css('border-top-width').replace('px', ''));
- top = top + parseInt(ct.css('border-bottom-width').replace('px', ''));
- top = top + parseInt(ct.css('padding-top').replace('px', ''));
- top = top + parseInt(ct.css('padding-bottom').replace('px', ''));
- top = top + 1;
+ var n_top = parseInt(ct.offset().top) + parseInt(ct.height());
+ n_top = n_top + parseInt(ct.css('border-top-width').replace('px', ''));
+ n_top = n_top + parseInt(ct.css('border-bottom-width').replace('px', ''));
+ n_top = n_top + parseInt(ct.css('padding-top').replace('px', ''));
+ n_top = n_top + parseInt(ct.css('padding-bottom').replace('px', ''));
+ n_top = n_top + 1; // Dunno why this is needed.. but it's always 1 px out :/
- $('#kiwi .windows').css('top', top + "px");
- $('#kiwi .userlist').css('top', top + "px");
+ var n_bottom = $(document).height() - parseInt($('#kiwi .control').offset().top);
+
+ $('#kiwi .windows').css({top: n_top + 'px', bottom: n_bottom + 'px'});
+ $('#kiwi .userlist').css({top: n_top + 'px', bottom: n_bottom + 'px'});
},
registerKeys: function () {
$('#kiwi_msginput').bind('keydown', function (e) {
+ var windows = $('#windows');
+ console.log(e.which);
//$('input').keypress(function(e){
- switch (e.which) {
- case 27: // escape
+ switch (true) {
+ case (e.which >= 48) && (e.which <= 57):
+ if(e.altKey){
+ var num = e.which - 48;
+ if(num === 0) num = 10;
+ num = num - 1;
+ front.windowsShow(num);
+ return false;
+ }
+ break;
+ case e.which === 27: // escape
return false;
- case 13: // return
+ case e.which === 13: // return
var msg = $('#kiwi_msginput').val();
msg = msg.trim();
$('#kiwi_msginput').val('');
break;
-
- case 38: // up
+ case e.which === 33: // page up
+ console.log("page up");
+ windows[0].scrollTop = windows[0].scrollTop - windows.height();
+ return false;
+ break;
+ case e.which === 34: // page down
+ windows[0].scrollTop = windows[0].scrollTop + windows.height();
+ return false;
+ break;
+ case e.which === 37: // left
+ if(e.altKey) front.windowsPrevious();
+ return false;
+ break;
+ case e.which === 38: // up
if (front.buffer_pos > 0) {
front.buffer_pos--;
$('#kiwi_msginput').val(front.buffer[front.buffer_pos]);
}
break;
- case 40: // down
+ case e.which === 39: // right
+ if(e.altKey) front.windowsNext();
+ return false;
+ break;
+ case e.which === 40: // down
if (front.buffer_pos < front.buffer.length) {
front.buffer_pos++;
$('#kiwi_msginput').val(front.buffer[front.buffer_pos]);
}
break;
- case 9: // tab
+ case e.which === 9: // tab
// Get possible autocompletions
var data = [];
front.cur_channel.userlist.children().each(function () {
this.first_press=true;
return false;
}
+ });
- if(ev.keyCode === 27){ // ESC
+ $('#kiwi .txtnewnick').keydown(function(ev){
+ if(ev.which === 27){ // ESC
$('#kiwi_msginput').focus();
$('#kiwi .newnick').remove();
}
}
} else {
front.tabviews[tab].show();
+ return;
}
};
},
next = false;
for(tab in front.tabviews){
if(front.tabviews[tab] == front.cur_channel){
- prev_tab.show();
+ if(prev_tab) prev_tab.show();
return;
}
prev_tab = front.tabviews[tab];
};
+ },
+
+ windowsShow: function(num){
+ num = parseInt(num);
+ console.log('Showing window '+num.toString());
+ var i = 0, tab;
+ for(tab in front.tabviews){
+ if(i === num){
+ front.tabviews[tab].show();
+ return;
+ }
+ i++;
+ }
}
}
tabview.prototype.scrollBottom = function(){
var w = $('#windows');
- w.attr({ scrollTop: w.attr("scrollHeight") });
+ w[0].scrollTop = w[0].scrollHeight;
}
tabview.prototype.changeNick = function(newNick, oldNick){