]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/baseui.js
Add title changing.
[irc/quakenet/qwebirc.git] / js / ui / baseui.js
index e342a25faa72b27b8cd6e4ac8d3f1e79b215e38b..b3573a36ec9a2683d1c9895c362aed7bac5fdf2d 100644 (file)
@@ -2,40 +2,14 @@ var WINDOW_STATUS = 1;
 var WINDOW_QUERY = 2;
 var 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) {
+  Implements: [Events, Options],
+  options: {
+    appTitle: "QuakeNet Web IRC",
+  },
+  initialize: function(parentElement, windowClass, uiName, options) {
+    this.setOptions(options);
+    
     this.windows = {};
     this.windowArray = [];
     this.windowClass = windowClass;
@@ -50,8 +24,10 @@ var UI = new Class({
     this.selectWindow(w);
     if(!this.firstClient) {
       this.firstClient = true;
-      w.addLine("", "qwebirc v" + QWEBIRC_VERSION + " -- Copyright (C) 2008 Chris Porter. All rights reserved.");
+      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");
     }
     return w;
   },
@@ -75,6 +51,7 @@ var UI = new Class({
     if(this.active)
       this.active.deselect();
     window.select();  /* calls setActiveWindow */
+    document.title = window.name + " - " + this.options.appTitle;
   },
   __closed: function(window) {
     if(window.active) {
@@ -95,7 +72,7 @@ var UI = new Class({
     
     delete this.windows[window.client][window.identifier];
   },
-  loginBox: function(callback) {
+  loginBox: function(callback, initialNickname, initialChannels) {
     /*
       this shouldn't be called by overriding classes!
       some form of user input MUST be received before an
@@ -103,13 +80,13 @@ var UI = new Class({
       tricked into getting themselves glined
     */
 
-    var nick = prompt("Nickname:");
+    var nick = prompt("Nickname:", initialNickname);
     if(!nick) {
       alert("Aborted.");
       return;
     }
 
-    var chans = prompt("Channels (seperate by comma):", "#quakenetX");
+    var chans = prompt("Channels (seperate by comma):", initialChannels);
     callback({"nickname": nick, "autojoin": chans});
   }
 });