]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/baseui.js
Try not to corrupt the namespaces.
[irc/quakenet/qwebirc.git] / js / ui / baseui.js
index ea507f56928ca574ae7e88f5cfd19a0eccf49d2f..9f8b97007784ba2b37b837985b09aca4b968d350 100644 (file)
@@ -1,11 +1,11 @@
-var WINDOW_STATUS = 1;
-var WINDOW_QUERY = 2;
-var WINDOW_CHANNEL = 3;
-var WINDOW_CUSTOM = 4;
-var WINDOW_CONNECT = 5;
-var CUSTOM_CLIENT = "custom";
+qwebirc.ui.WINDOW_STATUS = 1;
+qwebirc.ui.WINDOW_QUERY = 2;
+qwebirc.ui.WINDOW_CHANNEL = 3;
+qwebirc.ui.WINDOW_CUSTOM = 4;
+qwebirc.ui.WINDOW_CONNECT = 5;
+qwebirc.ui.CUSTOM_CLIENT = "custom";
 
-var BaseUI = new Class({
+qwebirc.ui.BaseUI = new Class({
   Implements: [Events, Options],
   options: {
     appTitle: "QuakeNet Web IRC",
@@ -15,22 +15,22 @@ var BaseUI = new Class({
     this.setOptions(options);
     
     this.windows = {};
-    this.windows[CUSTOM_CLIENT] = {};
+    this.windows[qwebirc.ui.CUSTOM_CLIENT] = {};
     this.windowArray = [];
     this.windowClass = windowClass;
     this.parentElement = parentElement;
     this.parentElement.addClass("qwebirc");
     this.parentElement.addClass("qwebirc-" + uiName);
     this.firstClient = false;
-    this.commandhistory = new CommandHistory();
+    this.commandhistory = new qwebirc.irc.CommandHistory();
   },
   newClient: function(client) {
     this.windows[client] = {}
-    var w = this.newWindow(client, WINDOW_STATUS, "Status");
+    var w = this.newWindow(client, qwebirc.ui.WINDOW_STATUS, "Status");
     this.selectWindow(w);
     if(!this.firstClient) {
       this.firstClient = true;
-      w.addLine("", "qwebirc v" + QWEBIRC_VERSION);
+      w.addLine("", "qwebirc v" + qwebirc.VERSION);
       w.addLine("", "Copyright (C) 2008 Chris Porter. All rights reserved.");
       w.addLine("", "http://webchat.quakenet.org/");
       w.addLine("", "This is BETA quality software, please report bugs to slug@quakenet.org");
@@ -39,7 +39,7 @@ var BaseUI = new Class({
   },
   newWindow: function(client, type, name) {
     var identifier = name;
-    if(type == WINDOW_STATUS)
+    if(type == qwebirc.ui.WINDOW_STATUS)
       identifier = "";
       
     var w = this.windows[client][identifier] = new this.windowClass(this, client, type, name, identifier);
@@ -88,12 +88,12 @@ var BaseUI = new Class({
       tricked into getting themselves glined
     */
   loginBox: function(callback, initialNickname, initialChannels, autoConnect, autoNick) {
-    GenericLoginBox(this.parentElement, callback, initialNickname, initialChannels, autoConnect, autoNick);
+    qwebirc.ui.GenericLoginBox(this.parentElement, callback, initialNickname, initialChannels, autoConnect, autoNick);
   }
 });
 
-var UI = new Class({
-  Extends: BaseUI,
+qwebirc.ui.StandardUI = new Class({
+  Extends: qwebirc.ui.BaseUI,
   initialize: function(parentElement, windowClass, uiName, options) {
     this.parent(parentElement, windowClass, uiName, options);
     window.addEvent("keydown", function(x) {
@@ -126,9 +126,9 @@ var UI = new Class({
   },
   newCustomWindow: function(name, select, type) {
     if(!type)
-      type = WINDOW_CUSTOM;
+      type = qwebirc.ui.WINDOW_CUSTOM;
       
-    var w = this.newWindow(CUSTOM_CLIENT, type, name);
+    var w = this.newWindow(qwebirc.ui.CUSTOM_CLIENT, type, name);
     w.addEvent("close", function(w) {
       delete this.windows[name];
     }.bind(this));
@@ -149,7 +149,7 @@ var UI = new Class({
       this.embedded = null;
     }.bind(this));
         
-    var ew = new WebmasterGuide({parent: this.embedded.lines});
+    var ew = new qwebirc.ui.EmbedWizard({parent: this.embedded.lines});
     ew.addEvent("close", function() {
       this.embedded.close();
     }.bind(this));
@@ -162,16 +162,16 @@ var UI = new Class({
   }
 });
 
-var NewLoginUI = new Class({
-  Extends: UI,
+qwebirc.ui.NewLoginUI = new Class({
+  Extends: qwebirc.ui.StandardUI,
   loginBox: function(callbackfn, initialNickname, initialChannels, autoConnect, autoNick) {
     this.postInitialize();
-    var w = this.newCustomWindow("Connect", true, WINDOW_CONNECT);
+    var w = this.newCustomWindow("Connect", true, qwebirc.ui.WINDOW_CONNECT);
     var callback = function(args) {
       w.close();
       callbackfn(args);
     };
     
-    GenericLoginBox(w.lines, callback, initialNickname, initialChannels, autoConnect, autoNick);
+    qwebirc.ui.GenericLoginBox(w.lines, callback, initialNickname, initialChannels, autoConnect, autoNick);
   }
 });