]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/baseui.js
Dos2Unix
[irc/quakenet/qwebirc.git] / js / ui / baseui.js
index 02a1d9a601cf0a3e23bdee9de3011924a2c60c7b..4769cc6f7fc7948089a3b505c87aba767f3a936e 100644 (file)
@@ -1,93 +1,93 @@
-WINDOW_STATUS = 1;\r
-WINDOW_QUERY = 2;\r
-WINDOW_CHANNEL = 3;\r
-\r
-var UIWindow = new Class({\r
-  Implements: [Events],\r
-  initialize: function(parentObject, client, type, name, identifier) {\r
-    this.parentObject = parentObject;\r
-    this.type = type;\r
-    this.name = name;\r
-    this.active = false;\r
-    this.client = client;\r
-    this.identifier = identifier;\r
-  },\r
-  updateNickList: function(nicks) {\r
-  },\r
-  updateTopic: function(topic)  {\r
-  },\r
-  close: function() {\r
-    this.parentObject.__closed(this);\r
-    this.fireEvent("close", this);\r
-  },\r
-  select: function() {\r
-    this.active = true;\r
-    this.parentObject.__setActiveWindow(this);\r
-  },\r
-  deselect: function() {\r
-    this.active = false;\r
-  },\r
-  addLine: function(type, line, colour) {\r
-  },\r
-  errorMessage: function(message) {\r
-    this.addLine("", message, "red");\r
-  }\r
-});\r
-\r
-var UI = new Class({\r
-  initialize: function(parentElement, windowClass, uiName) {\r
-    this.windows = {};\r
-    this.windowArray = [];\r
-    this.windowClass = windowClass;\r
-    this.parentElement = parentElement;\r
-    this.parentElement.addClass("qwebirc");\r
-    this.parentElement.addClass("qwebirc-" + uiName);\r
-  },\r
-  newClient: function(client) {\r
-    this.windows[client] = {}\r
-    var w = this.newWindow(client, WINDOW_STATUS, "Status");\r
-    this.selectWindow(w);\r
-    \r
-    return w;\r
-  },\r
-  newWindow: function(client, type, name) {\r
-    var identifier = name;\r
-    if(type == WINDOW_STATUS)\r
-      identifier = "";\r
-      \r
-    var w = this.windows[client][identifier] = new this.windowClass(this, client, type, name, identifier);\r
-    this.windowArray.push(w);\r
-    \r
-    return w;\r
-  },\r
-  getActiveWindow: function() {\r
-    return this.active;\r
-  },\r
-  __setActiveWindow: function(window) {\r
-    this.active = window;\r
-  },\r
-  selectWindow: function(window) {\r
-    if(this.active)\r
-      this.active.deselect();\r
-    window.select();  /* calls setActiveWindow */\r
-  },\r
-  __closed: function(window) {\r
-    if(window.active) {\r
-      this.active = undefined;\r
-      if(this.windowArray.length == 1) {\r
-        this.windowArray = [];\r
-      } else {\r
-        var index = this.windowArray.indexOf(window);\r
-        if(index == 0) {\r
-          this.selectWindow(this.windowArray[1]);\r
-        } else {\r
-          this.selectWindow(this.windowArray[index - 1]);\r
-        }\r
-        \r
-        this.windowArray = this.windowArray.erase(window);\r
-      }\r
-    }\r
-    \r
-    delete this.windows[window.client][window.identifier];\r
-  }\r
-});\r
+WINDOW_STATUS = 1;
+WINDOW_QUERY = 2;
+WINDOW_CHANNEL = 3;
+
+var UIWindow = new Class({
+  Implements: [Events],
+  initialize: function(parentObject, client, type, name, identifier) {
+    this.parentObject = parentObject;
+    this.type = type;
+    this.name = name;
+    this.active = false;
+    this.client = client;
+    this.identifier = identifier;
+  },
+  updateNickList: function(nicks) {
+  },
+  updateTopic: function(topic)  {
+  },
+  close: function() {
+    this.parentObject.__closed(this);
+    this.fireEvent("close", this);
+  },
+  select: function() {
+    this.active = true;
+    this.parentObject.__setActiveWindow(this);
+  },
+  deselect: function() {
+    this.active = false;
+  },
+  addLine: function(type, line, colour) {
+  },
+  errorMessage: function(message) {
+    this.addLine("", message, "red");
+  }
+});
+
+var UI = new Class({
+  initialize: function(parentElement, windowClass, uiName) {
+    this.windows = {};
+    this.windowArray = [];
+    this.windowClass = windowClass;
+    this.parentElement = parentElement;
+    this.parentElement.addClass("qwebirc");
+    this.parentElement.addClass("qwebirc-" + uiName);
+  },
+  newClient: function(client) {
+    this.windows[client] = {}
+    var w = this.newWindow(client, WINDOW_STATUS, "Status");
+    this.selectWindow(w);
+    
+    return w;
+  },
+  newWindow: function(client, type, name) {
+    var identifier = name;
+    if(type == WINDOW_STATUS)
+      identifier = "";
+      
+    var w = this.windows[client][identifier] = new this.windowClass(this, client, type, name, identifier);
+    this.windowArray.push(w);
+    
+    return w;
+  },
+  getActiveWindow: function() {
+    return this.active;
+  },
+  __setActiveWindow: function(window) {
+    this.active = window;
+  },
+  selectWindow: function(window) {
+    if(this.active)
+      this.active.deselect();
+    window.select();  /* calls setActiveWindow */
+  },
+  __closed: function(window) {
+    if(window.active) {
+      this.active = undefined;
+      if(this.windowArray.length == 1) {
+        this.windowArray = [];
+      } else {
+        var index = this.windowArray.indexOf(window);
+        if(index == 0) {
+          this.selectWindow(this.windowArray[1]);
+        } else {
+          this.selectWindow(this.windowArray[index - 1]);
+        }
+        
+        this.windowArray = this.windowArray.erase(window);
+      }
+    }
+    
+    delete this.windows[window.client][window.identifier];
+  }
+});