X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/ffe442b08c729645d9408cd9e4b76375b6c3ca9a..ff4befd89d1843750b9d68ca2616526f88e78fb8:/js/ui/baseui.js diff --git a/js/ui/baseui.js b/js/ui/baseui.js index ed05624..b8b515a 100644 --- a/js/ui/baseui.js +++ b/js/ui/baseui.js @@ -61,6 +61,29 @@ qwebirc.ui.BaseUI = new Class({ window.select(); /* calls setActiveWindow */ document.title = window.name + " - " + this.options.appTitle; }, + nextWindow: function(direction) { + if(this.windowArray.length == 0 || !this.active) + return; + + if(!direction) + direction = 1; + + var index = this.windowArray.indexOf(this.active); + if(index == -1) + return; + + index = index + direction; + if(index < 0) { + index = this.windowArray.length - 1; + } else if(index >= this.windowArray.length) { + index = 0; + } + + this.selectWindow(this.windowArray[index]); + }, + prevWindow: function() { + this.nextWindow(-1); + }, __closed: function(window) { if(window.active) { this.active = undefined; @@ -127,6 +150,10 @@ qwebirc.ui.StandardUI = new Class({ return; this.selectWindow(this.windowArray[number]); + } else if(x.key == "left") { + this.prevWindow(); + } else if(x.key == "right") { + this.nextWindow(); } }.bind(this)); }, @@ -162,7 +189,7 @@ qwebirc.ui.StandardUI = new Class({ }, urlDispatcher: function(name) { if(name == "embedded") - return this.embeddedWindow.bind(this); + return ["a", this.embeddedWindow.bind(this)]; return null; } @@ -172,9 +199,14 @@ qwebirc.ui.QuakeNetUI = new Class({ Extends: qwebirc.ui.StandardUI, urlDispatcher: function(name, window) { if(name == "qwhois") { - return function(auth) { + return ["a", function(auth) { this.client.exec("/MSG Q whois #" + auth); - }.bind(window); + }.bind(window)]; + } + if(name == "whois") { + return ["span", function(nick) { + this.client.exec("/WHOIS " + nick); + }.bind(window)]; } return this.parent(name);