+qwebirc.ui.QUI = new Class({
+ Extends: qwebirc.ui.NewLoginUI,
+ initialize: function(parentElement, theme) {
+ this.parent(parentElement, qwebirc.ui.QUI.Window, "qui");
+ this.theme = theme;
+ this.parentElement = parentElement;
+ },
+ postInitialize: function() {
+ this.qjsui = new qwebirc.ui.QUI.JSUI("qwebirc-qui", this.parentElement);
+
+ this.qjsui.top.addClass("tabbar");
+
+ this.qjsui.bottom.addClass("input");
+ this.qjsui.right.addClass("nicklist");
+ this.qjsui.topic.addClass("topic");
+ this.qjsui.middle.addClass("lines");
+
+ this.tabs = this.qjsui.top;
+ this.origtopic = this.topic = this.qjsui.topic;
+ this.origlines = this.lines = this.qjsui.middle;
+ this.orignicklist = this.nicklist = this.qjsui.right;
+
+ this.input = this.qjsui.bottom;
+ this.reflow = this.qjsui.reflow.bind(this.qjsui);
+
+ this.createInput();
+ this.reflow();
+ },
+ createInput: function() {
+ var form = new Element("form");
+ this.input.appendChild(form);
+ form.addClass("input");
+
+ var inputbox = new Element("input");
+ form.appendChild(inputbox);
+ this.inputbox = inputbox;
+
+ form.addEvent("submit", function(e) {
+ new Event(e).stop();
+
+ if(inputbox.value == "")
+ return;
+
+ this.getActiveWindow().historyExec(inputbox.value);
+ inputbox.value = "";
+ }.bind(this));
+
+ inputbox.addEvent("keydown", function(e) {
+ var resultfn;
+ var cvalue = inputbox.value;
+
+ if(e.key == "up") {
+ resultfn = this.commandhistory.upLine;
+ } else if(e.key == "down") {
+ resultfn = this.commandhistory.downLine;
+ } else {
+ return;
+ }
+
+ if((cvalue != "") && (this.lastcvalue != cvalue))
+ this.commandhistory.addLine(cvalue, true);
+
+ var result = resultfn.bind(this.commandhistory)();
+
+ new Event(e).stop();
+ if(!result)
+ result = "";
+ this.lastcvalue = result;
+
+ inputbox.value = result;
+ setAtEnd(inputbox);
+ }.bind(this));
+ },
+ setLines: function(lines) {
+ this.lines.parentNode.replaceChild(lines, this.lines);
+ this.qjsui.middle = this.lines = lines;
+ },
+ setChannelItems: function(nicklist, topic) {
+ if(!$defined(nicklist)) {
+ nicklist = this.orignicklist;
+ topic = this.origtopic;
+ }
+ this.nicklist.parentNode.replaceChild(nicklist, this.nicklist);
+ this.qjsui.right = this.nicklist = nicklist;
+
+ this.topic.parentNode.replaceChild(topic, this.topic);
+ this.qjsui.topic = this.topic = topic;
+ }
+});
+
+qwebirc.ui.QUI.JSUI = new Class({