]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/uglyui.js
Add URL parsing for channels/nick selection.
[irc/quakenet/qwebirc.git] / js / ui / uglyui.js
index d2a50313834996152e42b04e50d3d3fa9a2862f0..de3e6a34971bf8983ebc4e666435cc0e5754590b 100644 (file)
@@ -83,8 +83,7 @@ var UglyUIWindow = new Class({
     this.parent();
     
     this.outerContainer.removeClass("tab-invisible");
-    this.tab.removeClass("tab-unselected");
-    this.tab.removeClass("tab-highlighted");
+    this.tab.removeClass("tab-unselected");    
     this.tab.addClass("tab-selected");
   },
   deselect: function() {
@@ -101,35 +100,27 @@ var UglyUIWindow = new Class({
     this.parentObject.tabs.removeChild(this.tab);
   },
   addLine: function(type, line, colour) {
-    this.parent(type, line, colour);
-    
     var e = new Element("div");
 
     if(colour) {
-      e.addStyle("background", colour);
+      e.setStyles({"background": colour});
     } else if(this.lastcolour) {
       e.addClass("linestyle1");
     } else {
       e.addClass("linestyle2");
     }
-    
-    if(type)
-      line = this.parentObject.theme.message(type, line);
-    
-    Colourise(IRCTimestamp(new Date()) + " " + line, e);
-    
     this.lastcolour = !this.lastcolour;
     
-    var prev = this.lines.getScroll();
-    var prevbottom = this.lines.getScrollSize().y;
-    var prevsize = this.lines.getSize();
-    this.lines.appendChild(e);
+    this.parent(type, line, colour, e);
+  },
+  setHilighted: function(state) {
+    this.parent(state);
     
-    if(prev.y + prevsize.y == prevbottom)
-      this.lines.scrollTo(prev.x, this.lines.getScrollSize().y);
-      
-    if(!this.active)
+    if(state) {
       this.tab.addClass("tab-highlighted");
+    } else {
+      this.tab.removeClass("tab-highlighted");
+    }
   }
 });
 
@@ -137,18 +128,19 @@ var UglyUI = new Class({
   Extends: UI,
   initialize: function(parentElement, theme) {
     this.parent(parentElement, UglyUIWindow, "uglyui");
-    
     this.theme = theme;
-    
+    this.parentElement = parentElement;
+  },
+  postInitialize: function() {    
     this.tabs = new Element("div");
     this.tabs.addClass("tabbar");
     
-    parentElement.appendChild(this.tabs);
+    this.parentElement.appendChild(this.tabs);
     
     this.container = new Element("div");
     this.container.addClass("container");
     
-    parentElement.appendChild(this.container);
+    this.parentElement.appendChild(this.container);
   
     var form = new Element("form");
     var inputbox = new Element("input");
@@ -160,8 +152,15 @@ var UglyUI = new Class({
       this.getActiveWindow().client.exec(inputbox.value);
       inputbox.value = "";
     }.bind(this));
-    parentElement.appendChild(form);  
+    this.parentElement.appendChild(form);  
     form.appendChild(inputbox);
     inputbox.focus();
+  },
+  loginBox: function(callbackfn, intialNickname, initialChannels, autoConnect, autoNick) {
+    this.parent(function(options) {
+      this.postInitialize();
+      callbackfn(options);
+    }.bind(this), intialNickname, initialChannels, autoConnect, autoNick);
   }
-});
\ No newline at end of file
+});
+