]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Try not to corrupt the namespaces.
authorChris Porter <redacted>
Sat, 18 Oct 2008 20:39:49 +0000 (21:39 +0100)
committerChris Porter <redacted>
Sat, 18 Oct 2008 20:39:49 +0000 (21:39 +0100)
36 files changed:
TODO.txt
compile.bat
compile.sh
js/irc/baseircclient.js
js/irc/commandhistory.js
js/irc/commandparser.js
js/irc/ircclient.js
js/irc/ircconnection.js
js/irc/irclib.js
js/irc/irctracker.js
js/irc/version.js [deleted file]
js/jslib.js
js/qwebirc.js [new file with mode: 0644]
js/qwebircinterface.js
js/ui/basetheme.js
js/ui/baseui.js
js/ui/baseuiwindow.js
js/ui/colour.js
js/ui/embedwizard.js
js/ui/genericlogin.js
js/ui/mochaui.js
js/ui/qui.js
js/ui/swmlayout.js
js/ui/swmui.js
js/ui/theme.js
js/ui/uglyui.js
js/ui/url.js
js/version.js
static/mochaui.html
static/mochauidebug.html
static/qui.html
static/quidebug.html
static/swmui.html
static/swmuidebug.html
static/uglyui.html
static/uglyuidebug.html

index 20a214cd11dab44c3a74aea293d449f565d1aede..06231d48f4f539cb2fef940ab59c62c93cd926ab 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,4 +1,2 @@
-IE7\r
-IE6\r
-ping timeout bug?\r
-opera weirdness\r
+make pretty again.\r
+swmui window bug\r
index dae4e55f3de39c4589ae31704cb9b75044a89a84..710a63d75de73b210d87d826fe6d5201232c9e27 100644 (file)
@@ -3,8 +3,8 @@ mkdir compiled
 del /q compiled\*.js\r
 \r
 cd js\r
-copy version.js + jslib.js + irc\ircconnection.js + irc\irclib.js + irc\baseircclient.js + irc\irctracker.js + irc\commandparser.js + irc\ircclient.js + ui\baseui.js + ui\baseuiwindow.js + ui\colour.js + ui\url.js + ui\theme.js + ui\genericlogin.js + ui\embedwizard.js + qwebircinterface.js + irc\commandhistory.js ..\compiled\qwebirc-concat.js /b\r
-copy ui\swmlayout.js + ui\swmui.js ..\compiled\swmui-concat.js /b\r
+copy qwebirc.js version.js + jslib.js + irc\ircconnection.js + irc\irclib.js + irc\baseircclient.js + irc\irctracker.js + irc\commandparser.js + irc\ircclient.js + ui\baseui.js + ui\baseuiwindow.js + ui\colour.js + ui\url.js + ui\theme.js + ui\genericlogin.js + ui\embedwizard.js + qwebircinterface.js + irc\commandhistory.js ..\compiled\qwebirc-concat.js /b\r
+copy ui\swmui.js + ui\swmlayout.js ..\compiled\swmui-concat.js /b\r
 cd ..\compiled\r
 \r
 java -jar ..\bin\yuicompressor-2.3.5.jar ..\static\js\mochaui\mocha.js > mocha-compressed.js\r
index da65e742ee5982c0f1ba80720de0b9374e0c34f9..bfa232ccf4377952873fa54a4c5464c59be3e98b 100755 (executable)
@@ -3,8 +3,8 @@ mkdir -p compiled
 rm -f compiled/*.js
 
 cd js
-cat version.js jslib.js irc/ircconnection.js irc/irclib.js irc/baseircclient.js irc/irctracker.js irc/commandparser.js irc/ircclient.js ui/baseui.js ui/baseuiwindow.js ui/colour.js ui/url.js ui/theme.js ui/genericlogin.js ui/embedwizard.js irc/commandhistory.js qwebircinterface.js > ../compiled/qwebirc-concat.js
-cat ui/swmlayout.js ui/swmui.js > ../compiled/swmui-concat.js
+cat qwebirc.js version.js jslib.js irc/ircconnection.js irc/irclib.js irc/baseircclient.js irc/irctracker.js irc/commandparser.js irc/ircclient.js ui/baseui.js ui/baseuiwindow.js ui/colour.js ui/url.js ui/theme.js ui/genericlogin.js ui/embedwizard.js irc/commandhistory.js qwebircinterface.js > ../compiled/qwebirc-concat.js
+cat ui/swmui.js ui/swmlayout.js > ../compiled/swmui-concat.js
 
 error() {
   cd ..
index 69393d440b5bce9428aeae6b15e06c060adb04b7..165edd934249d0031dd8773e3cd5bae07d6417f0 100644 (file)
@@ -1,19 +1,19 @@
-var Numerics = {"001": "RPL_WELCOME", "433": "ERR_NICKNAMEINUSE", "004": "RPL_MYINFO", "005": "RPL_ISUPPORT", "353": "RPL_NAMREPLY", "366": "RPL_ENDOFNAMES", "331": "RPL_NOTOPIC", "332": "RPL_TOPIC", "333": "RPL_TOPICWHOTIME"};
+qwebirc.irc.Numerics = {"001": "RPL_WELCOME", "433": "ERR_NICKNAMEINUSE", "004": "RPL_MYINFO", "005": "RPL_ISUPPORT", "353": "RPL_NAMREPLY", "366": "RPL_ENDOFNAMES", "331": "RPL_NOTOPIC", "332": "RPL_TOPIC", "333": "RPL_TOPICWHOTIME"};
 
-var RegisteredCTCPs = {
+qwebirc.irc.RegisteredCTCPs = {
   "VERSION": function(x) {
-    return "qwebirc v" + QWEBIRC_VERSION + ", copyright (C) Chris Porter 2008 -- user agent: " + Browser.Engine.name + " (" + Browser.Platform.name + ")";
+    return "qwebirc v" + qwebirc.VERSION + ", copyright (C) Chris Porter 2008 -- user agent: " + Browser.Engine.name + " (" + Browser.Platform.name + ")";
   },
   "USERINFO": function(x) { return "qwebirc"; },
-  "TIME": function(x) { return IRCTime(new Date()); },
+  "TIME": function(x) { return qwebirc.irc.IRCTime(new Date()); },
   "PING": function(x) { return x; },
   "CLIENTINFO": function(x) { return "PING VERSION TIME USERINFO CLIENTINFO"; }
 };
 
-var BaseIRCClient = new Class({
+qwebirc.irc.BaseIRCClient = new Class({
   Implements: [Options],
   options: {
-    nickname: "WCunset"
+    nickname: "qwebirc"
   },
   initialize: function(options) {
     this.setOptions(options);
@@ -25,7 +25,7 @@ var BaseIRCClient = new Class({
     this.channels = {}
     this.nextctcp = 0;    
 
-    this.connection = new IRCConnection({initialNickname: this.nickname, onRecv: this.dispatch.bind(this)});
+    this.connection = new qwebirc.irc.IRCConnection({initialNickname: this.nickname, onRecv: this.dispatch.bind(this)});
   
     this.send = this.connection.send.bind(this.connection);
     this.connect = this.connection.connect.bind(this.connection);
@@ -47,7 +47,7 @@ var BaseIRCClient = new Class({
        
       var prefix = data[2];
       var sl = data[3];
-      var n = Numerics[command];
+      var n = qwebirc.irc.Numerics[command];
       
       var x = n;
       if(!n)
@@ -176,7 +176,7 @@ var BaseIRCClient = new Class({
     if(ctcp) {
       var type = ctcp[0].toUpperCase();
       
-      var replyfn = RegisteredCTCPs[type];
+      var replyfn = qwebirc.irc.RegisteredCTCPs[type];
       if(replyfn) {
         var t = new Date().getTime() / 1000;
         if(t > this.nextctcp)
index 175ac19b6e9504ecc96815e3027d2e9d9d6420ae..dae85d56e377078b029b24c84b6e24cbb5cd7a3a 100644 (file)
@@ -1,4 +1,4 @@
-var CommandHistory = new Class({
+qwebirc.irc.CommandHistory = new Class({
   Implements: [Options],
   options: {
     lines: 20
index 46b68eebfae1a96d6216735a9ab8cfc447051ab1..45cca494da42eb78799ef5cc2c3d4836068c24a0 100644 (file)
@@ -1,4 +1,4 @@
-var CommandParser = new Class({
+qwebirc.irc.CommandParser = new Class({
   initialize: function(parentObject) {
     this.aliases = {
       "J": "JOIN",
index e0e78b299361451da0e648141eb8dcfda103feed..2d3f0b8a2cbd3460dbd20fb2ddb82dc1a0914c81 100644 (file)
@@ -1,7 +1,7 @@
-var IRCClient = new Class({
-  Extends: BaseIRCClient,
+qwebirc.irc.IRCClient = new Class({
+  Extends: qwebirc.irc.BaseIRCClient,
   options: {
-    nickname: "WCunset",
+    nickname: "qwebirc",
     autojoin: ""
   },
   initialize: function(options, ui) {
@@ -13,7 +13,7 @@ var IRCClient = new Class({
     this.modeprefixes = "ov";
     this.windows = {};
     
-    this.commandparser = new CommandParser(this);
+    this.commandparser = new qwebirc.irc.CommandParser(this);
     this.exec = this.commandparser.dispatch.bind(this.commandparser);
 
     this.statusWindow = this.ui.newClient(this);
@@ -126,7 +126,7 @@ var IRCClient = new Class({
     this.newServerLine("RAW", {"n": "numeric", "m": params.slice(1).join(" ")});
   },
   signedOn: function(nickname) {
-    this.tracker = new IRCTracker();
+    this.tracker = new qwebirc.irc.IRCTracker();
     this.nickname = nickname;
     this.newServerLine("SIGNON");
     
index 619251b99ccb53f6c2b332166a6f4a69b1968574..d7632030d8a31fec427c08022c0948ad86fc8b3c 100644 (file)
@@ -1,6 +1,6 @@
 /* This could do with a rewrite from scratch. */
 
-var IRCConnection = new Class({
+qwebirc.irc.IRCConnection = new Class({
   Implements: [Events, Options],
   options: {
     initialNickname: "ircconnX",
index 8e53c38f9dc1ce415eb8840344594a8c0a465eb9..a83850a08b6359310cd6e4ee4b79855b5190ec73 100644 (file)
@@ -1,4 +1,4 @@
-var IRCLowerTable = [
+qwebirc.irc.IRCLowerTable = [
 /* x00-x07 */ '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
 /* x08-x0f */ '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
 /* x10-x17 */ '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
@@ -40,7 +40,7 @@ String.prototype.toIRCLower = function() {
   for(var i=0;i<x.length;i++) {
     var l = x.charCodeAt(i);
 
-    p.push(IRCLowerTable[l]);
+    p.push(qwebirc.irc.IRCLowerTable[l]);
   }
     
   return p.join("");
@@ -54,7 +54,7 @@ String.prototype.hostToHost = function() {
   return this.split("!", 2)[1];
 }
 
-function IRCTimestamp(d) {
+qwebirc.irc.IRCTimestamp = function(d) {
   function pad(x) {
     x = "" + x;
     if(x.length == 1)
@@ -65,31 +65,6 @@ function IRCTimestamp(d) {
   return "[" + pad(d.getHours()) + ":" + pad(d.getMinutes()) + "]";
 }
 
-var DaysOfWeek = {
-  0: "Sun",
-  1: "Mon",
-  2: "Tue",
-  3: "Wed",
-  4: "Thu",
-  5: "Fri",
-  6: "Sat"
-};
-
-var MonthsOfYear = {
-  0: "Jan",
-  1: "Feb",
-  2: "Mar",
-  3: "Apr",
-  4: "May",
-  5: "Jun",
-  6: "Jul",
-  7: "Aug",
-  8: "Sep",
-  9: "Oct",
-  10: "Nov",
-  11: "Dec"
-};
-
-function IRCDate(d) {
-  return DaysOfWeek[d.getDay()] + " " + MonthsOfYear[d.getMonth()] + " " + pad(d.getDate()) + " "  + pad(d.getHours()) + ":" + pad(d.getMinutes()) + ":" + pad(d.getSeconds()) + " " + d.getFullYear();
+qwebirc.irc.IRCDate = function(d) {
+  return qwebirc.util.DaysOfWeek[d.getDay()] + " " + qwebirc.util.MonthsOfYear[d.getMonth()] + " " + pad(d.getDate()) + " "  + pad(d.getHours()) + ":" + pad(d.getMinutes()) + ":" + pad(d.getSeconds()) + " " + d.getFullYear();
 }
\ No newline at end of file
index b52796db30993d199fe9a66224c3a9d497700241..ea9dd845ec75f0e199adf07d8aefc9b897cf3456 100644 (file)
@@ -1,8 +1,8 @@
-function NickChanEntry() {
+qwebirc.irc.NickChanEntry = function() {
   this.prefixes = "";
 }
 
-var IRCTracker = new Class({
+qwebirc.irc.IRCTracker = new Class({
   initialize: function() {
     this.channels = {};
     this.nicknames = {};
@@ -40,7 +40,7 @@ var IRCTracker = new Class({
     return nc;
   },
   addNickToChannel: function(nick, channel) {
-    var nc = new NickChanEntry();
+    var nc = new qwebirc.irc.NickChanEntry();
 
     var n = this.getOrCreateNick(nick);
     n[channel] = nc;
diff --git a/js/irc/version.js b/js/irc/version.js
deleted file mode 100644 (file)
index 2daf346..0000000
+++ /dev/null
@@ -1 +0,0 @@
-QWEBIRC_VERSION = "0.01";
index 5f99f7839bfb7d3b40ff2bb666835e5b8ebcf960..b50c39667bf0e841803df71d8b4b13e1af30eeea 100644 (file)
@@ -30,7 +30,7 @@ String.prototype.splitMax = function(by, max) {
   return newitems;
 }
 
-function setAtEnd(obj) {
+qwebirc.util.setAtEnd = function(obj) {
   pos = obj.value.length;
   
   if(obj.createTextRange) { 
@@ -44,7 +44,7 @@ function setAtEnd(obj) {
 }
 
 /* returns the arguments */
-function parseURI(uri) {
+qwebirc.util.parseURI = function(uri) {
   var result = {}
 
   var start = uri.indexOf('?');
@@ -66,12 +66,27 @@ function parseURI(uri) {
   return result;
 }
 
-function BrowserVersion() {
-  if(Browser.Engine.trident) {
-    if(Browser.Engine.version == '4')
-      return 'ie6';
-    if(Browser.Engine.version == '5')
-      return 'ie7';
-  }
-  return null;
-}
\ No newline at end of file
+qwebirc.util.DaysOfWeek = {
+  0: "Sun",
+  1: "Mon",
+  2: "Tue",
+  3: "Wed",
+  4: "Thu",
+  5: "Fri",
+  6: "Sat"
+};
+
+qwebirc.util.MonthsOfYear = {
+  0: "Jan",
+  1: "Feb",
+  2: "Mar",
+  3: "Apr",
+  4: "May",
+  5: "Jun",
+  6: "Jul",
+  7: "Aug",
+  8: "Sep",
+  9: "Oct",
+  10: "Nov",
+  11: "Dec"
+};
diff --git a/js/qwebirc.js b/js/qwebirc.js
new file mode 100644 (file)
index 0000000..4e89853
--- /dev/null
@@ -0,0 +1 @@
+var qwebirc = {"ui": {"themes": {}}, "irc": {}, "util": {}};
index 6259076a2878a003260be5efad0d1f9dbf1e187b..62fc9d7c82a0c4c633faf19ac724ae41f0546c7f 100644 (file)
@@ -1,4 +1,4 @@
-var QWebIRCInterface = new Class({
+qwebirc.ui.Interface = new Class({
   Implements: [Options],
   options: {
     initialNickname: "qwebirc" + Math.ceil(Math.random() * 100000),
@@ -10,13 +10,13 @@ var QWebIRCInterface = new Class({
     this.setOptions(options);
 
     window.addEvent("domready", function() {
-      var ui_ = new ui($(element), new Theme(this.options.theme));
+      var ui_ = new ui($(element), new qwebirc.ui.Theme(this.options.theme));
       var inick = this.options.initialNickname;
       var ichans = this.options.initialChannels;
       var autoNick = true;
       
       var callback = function(options) {
-        var IRC = new IRCClient(options, ui_);
+        var IRC = new qwebirc.irc.IRCClient(options, ui_);
         IRC.connect();
         window.addEvent("beforeunload", function() {
           IRC.quit("Page closed");
@@ -25,7 +25,7 @@ var QWebIRCInterface = new Class({
 
       var supplied = false; 
       if(this.options.searchURL) {
-        var args = parseURI(String(document.location));
+        var args = qwebirc.util.parseURI(String(document.location));
         
         var chans = args["channels"];
         var nick = args["nick"];
index e81a92ef6d1f8674a5e0068dbef478ee3197fc2e..bfa57b391028241a11fd998cff80e45f16b98ee4 100644 (file)
@@ -1,5 +1,5 @@
 /* don't even attempt to use a $! */
-var DefaultTheme = {
+qwebirc.ui.theme.Default = {
   "PREFIX": ["$C4==$O "],
   "SIGNON": ["Signed on!", true],
   "CONNECT": ["Connected to server.", true],
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);
   }
 });
index 112f6c5ef0a143e9c666192ce418571d43a2e558..1c339cfb37ec22350e69b5108b0dc8563fadc955 100644 (file)
@@ -1,4 +1,4 @@
-var UIWindow = new Class({
+qwebirc.ui.Window = new Class({
   Implements: [Events],
   initialize: function(parentObject, client, type, name, identifier) {
     this.parentObject = parentObject;
@@ -50,7 +50,7 @@ var UIWindow = new Class({
     if(type)
       line = this.parentObject.theme.message(type, line);
     
-    Colourise(IRCTimestamp(new Date()) + " " + line, element, this.client.exec, this.parentObject.urlDispatcher.bind(this.parentObject));
+    qwebirc.ui.Colourise(qwebirc.irc.IRCTimestamp(new Date()) + " " + line, element, this.client.exec, this.parentObject.urlDispatcher.bind(this.parentObject));
     
     this.scrollAdd(element);
   },
index 5e86813e6ab1be4bbc40dae9f5d1f21c3d09a3f2..2673f22f588901d2d0079c5bdf3e527f02269280 100644 (file)
@@ -1,4 +1,4 @@
-function Colourise(line, entity, execfn, cmdfn) {
+qwebirc.ui.Colourise = function(line, entity, execfn, cmdfn) {
   var fg;
   var bg;
   var underline = false;
@@ -44,7 +44,7 @@ function Colourise(line, entity, execfn, cmdfn) {
 
   function emitEndToken() {
     if(out.length > 0) {
-      urlificate(element, out.join(""), execfn, cmdfn);
+      qwebirc.ui.urlificate(element, out.join(""), execfn, cmdfn);
       entity.appendChild(element);
       out = [];
     }
@@ -100,4 +100,4 @@ function Colourise(line, entity, execfn, cmdfn) {
   }
   
   emitEndToken();
-}
\ No newline at end of file
+}
index 12bbba2df99a9b21f12d64ea3f7ef6466be324b8..987ec7c88f9ab1fabcac012bf7194f7b3a466ab9 100644 (file)
@@ -1,4 +1,4 @@
-var WebmasterGuideStep = new Class({
+qwebirc.ui.EmbedWizardStep = new Class({
   Implements: [Options, Events],
   options: {
     "title": "",
@@ -28,7 +28,7 @@ var WebmasterGuideStep = new Class({
   }
 });
 
-var WebmasterGuide = new Class({
+qwebirc.ui.EmbedWizard = new Class({
   Implements: [Options, Events],
   options: {
     parent: null,
@@ -85,7 +85,7 @@ var WebmasterGuide = new Class({
     return cell;
   },
   newStep: function(options) {
-    return new WebmasterGuideStep(this, options);
+    return new qwebirc.ui.EmbedWizardStep(this, options);
   },
   newRadio: function(parent, text, name, selected) {
     var p = new Element("div");
index 18cc06ce5137252e9e272f9cd99c74494ecc7106..1d7fba6e83403d6fb13e84ce1cb482a87417cf01 100644 (file)
@@ -1,13 +1,12 @@
-function GenericLoginBox(parentElement, callback, initialNickname, initialChannels, autoConnect, autoNick) {
+qwebirc.ui.GenericLoginBox = function(parentElement, callback, initialNickname, initialChannels, autoConnect, autoNick) {
   if(autoConnect) {
-    ConfirmBox(parentElement, callback, initialNickname, initialChannels, autoNick);
+    qwebirc.ui.ConfirmBox(parentElement, callback, initialNickname, initialChannels, autoNick);
   } else {
-    LoginBox(parentElement, callback, initialNickname, initialChannels);
+    qwebirc.ui.LoginBox(parentElement, callback, initialNickname, initialChannels);
   }
-  
 }
 
-function ConfirmBox(parentElement, callback, initialNickname, initialChannels, autoNick) {
+qwebirc.ui.ConfirmBox = function(parentElement, callback, initialNickname, initialChannels, autoNick) {
   var box = new Element("table");
   box.addClass("confirmbox");
   parentElement.appendChild(box);
@@ -67,7 +66,7 @@ function ConfirmBox(parentElement, callback, initialNickname, initialChannels, a
   });
 }
 
-function LoginBox(parentElement, callback, initialNickname, initialChannels) {
+qwebirc.ui.LoginBox = function(parentElement, callback, initialNickname, initialChannels) {
   var box = new Element("table");
   parentElement.appendChild(box);
   box.addClass("loginbox");
index 710e0732303f61c8325f7516ee9726d92e0de6b9..9c1e86a3843fdbbd64e69e894385845525ac6f0f 100644 (file)
@@ -1,12 +1,68 @@
-var QMochaUIWindow = new Class({
-  Extends: UIWindow,
+qwebirc.ui.MochaUI = new Class({
+  Extends: qwebirc.ui.NewLoginUI,
+  initialize: function(parentElement, theme) {
+    this.parent(parentElement, qwebirc.ui.MochaUI.Window, "mochaui");
+    this.theme = theme;
+    this.parentElement = parentElement;
+    
+    window.addEvent("domready", function() {
+      /* determine input size */
+      var l = new Element("input", {styles: {border: 0}});
+      this.parentElement.appendChild(l);
+      this.inputHeight = l.getSize().y;
+      this.parentElement.removeChild(l);
+      
+      MochaUI.Desktop = new MochaUI.Desktop();
+      MochaUI.Dock = new MochaUI.Dock({
+        dockPosition: "top"
+      });
+
+      MochaUI.Modal = new MochaUI.Modal();
+      MochaUI.options.useEffects = false;
+    }.bind(this));
+    
+    window.addEvent("unload", function() {
+      if(MochaUI)
+        MochaUI.garbageCleanUp();
+    });
+  },
+  postInitialize: function() {    
+    return;
+    this.tabs = new Element("div");
+    this.tabs.addClass("tabbar");
+    
+    this.parentElement.appendChild(this.tabs);
+    
+    this.container = new Element("div");
+    this.container.addClass("container");
+    
+    this.parentElement.appendChild(this.container);
+  
+    var form = new Element("form");
+    var inputbox = new Element("input");
+    inputbox.addClass("input");
+  
+    form.addEvent("submit", function(e) {
+      new Event(e).stop();
+    
+      this.getActiveWindow().client.exec(inputbox.value);
+      inputbox.value = "";
+    }.bind(this));
+    this.parentElement.appendChild(form);  
+    form.appendChild(inputbox);
+    inputbox.focus();
+  }
+});
+
+qwebirc.ui.MochaUI.Window = new Class({
+  Extends: qwebirc.ui.Window,
   
   initialize: function(parentObject, client, type, name) {
     this.parent(parentObject, client, type, name);
 
     this.lines = new Element("div", {styles: {overflow: "auto", "width": "90"}});
 
-    var toolbar = type != WINDOW_CUSTOM && type != WINDOW_CONNECT;
+    var toolbar = (type != qwebirc.ui.WINDOW_CUSTOM) && (type != qwebirc.ui.WINDOW_CONNECT);
     
     if(toolbar) {
       this.form = new Element("form");
@@ -50,14 +106,14 @@ var QMochaUIWindow = new Class({
         parentObject.selectWindow(this);
       }.bind(this),
       onClose: function() {
-        if(type == WINDOW_CHANNEL)
+        if(type == qwebirc.ui.WINDOW_CHANNEL)
           this.client.exec("/PART " + name);
         this.close();
       }.bind(this)
     };
     
     prefs.toolbar = toolbar;
-    prefs.closable = type != WINDOW_STATUS && type != WINDOW_CONNECT;
+    prefs.closable = type != qwebirc.ui.WINDOW_STATUS && type != qwebirc.ui.WINDOW_CONNECT;
     
     /* HACK */
 /*    var oldIndexLevel = MochaUI.Windows.indexLevel;
@@ -174,59 +230,3 @@ var QMochaUIWindow = new Class({
     MochaUI.closeWindow(this.window.windowEl);
   },
 });
-
-var QMochaUI = new Class({
-  Extends: NewLoginUI,
-    initialize: function(parentElement, theme) {
-    this.parent(parentElement, QMochaUIWindow, "mochaui");
-    this.theme = theme;
-    this.parentElement = parentElement;
-    
-    window.addEvent("domready", function() {
-      /* determine input size */
-      var l = new Element("input", {styles: {border: 0}});
-      this.parentElement.appendChild(l);
-      this.inputHeight = l.getSize().y;
-      this.parentElement.removeChild(l);
-      
-      MochaUI.Desktop = new MochaUI.Desktop();
-      MochaUI.Dock = new MochaUI.Dock({
-        dockPosition: "top"
-      });
-
-      MochaUI.Modal = new MochaUI.Modal();
-      MochaUI.options.useEffects = false;
-    }.bind(this));
-    
-    window.addEvent("unload", function() {
-      if(MochaUI)
-        MochaUI.garbageCleanUp();
-    });
-  },
-  postInitialize: function() {    
-    return;
-    this.tabs = new Element("div");
-    this.tabs.addClass("tabbar");
-    
-    this.parentElement.appendChild(this.tabs);
-    
-    this.container = new Element("div");
-    this.container.addClass("container");
-    
-    this.parentElement.appendChild(this.container);
-  
-    var form = new Element("form");
-    var inputbox = new Element("input");
-    inputbox.addClass("input");
-  
-    form.addEvent("submit", function(e) {
-      new Event(e).stop();
-    
-      this.getActiveWindow().client.exec(inputbox.value);
-      inputbox.value = "";
-    }.bind(this));
-    this.parentElement.appendChild(form);  
-    form.appendChild(inputbox);
-    inputbox.focus();
-  }
-});
index 62fca0b9736e01fe0316e99e2a6e9685ecf50711..959b83694e7d295ae937921c3dc6fb5ef413e2ed 100644 (file)
@@ -1,4 +1,94 @@
-var QJSUI = new Class({
+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({
   initialize: function(class_, parent, sizer) {
     this.parent = parent;
     this.sizer = $defined(sizer)?sizer:parent;
@@ -98,8 +188,8 @@ var QJSUI = new Class({
   }
 });
 
-var QUIWindow = new Class({
-  Extends: UIWindow,
+qwebirc.ui.QUI.Window = new Class({
+  Extends: qwebirc.ui.Window,
   
   initialize: function(parentObject, client, type, name) {
     this.parent(parentObject, client, type, name);
@@ -114,13 +204,14 @@ var QUIWindow = new Class({
       parentObject.selectWindow(this);
     }.bind(this));
     
-    if(type != WINDOW_STATUS && type != WINDOW_CONNECT) {
-      tabclose = new Element("span");
+    if(type != qwebirc.ui.WINDOW_STATUS && type != qwebirc.ui.WINDOW_CONNECT) {
+      var tabclose = new Element("span");
+      tabclose.set("text", "X");
       tabclose.addClass("tabclose");
       tabclose.addEvent("click", function(e) {
         new Event(e).stop();
         
-        if(type == WINDOW_CHANNEL)
+        if(type == qwebirc.ui.WINDOW_CHANNEL)
           this.client.exec("/PART " + name);
 
         this.close();
@@ -137,7 +228,7 @@ var QUIWindow = new Class({
       this.scrolleddown = this.scrolledDown();
     }.bind(this));
     
-    if(type == WINDOW_CHANNEL) {
+    if(type == qwebirc.ui.WINDOW_CHANNEL) {
       this.topic = new Element("div");
       this.topic.addClass("topic");
       this.topic.addClass("tab-invisible");
@@ -150,7 +241,7 @@ var QUIWindow = new Class({
       this.parentObject.qjsui.applyClasses("nicklist", this.nicklist);
     }
     
-    if(type == WINDOW_CHANNEL) {
+    if(type == qwebirc.ui.WINDOW_CHANNEL) {
       this.updateTopic("");
     } else {
       this.reflow();
@@ -195,7 +286,7 @@ var QUIWindow = new Class({
     this.reflow();
   },
   select: function() {
-    var inputVisible = this.type != WINDOW_CONNECT && this.type != WINDOW_CUSTOM;
+    var inputVisible = this.type != qwebirc.ui.WINDOW_CONNECT && this.type != qwebirc.ui.WINDOW_CUSTOM;
     
     this.tab.removeClass("tab-unselected");
     this.tab.addClass("tab-selected");
@@ -247,93 +338,3 @@ var QUIWindow = new Class({
     }
   }
 });
-
-var QUI = new Class({
-  Extends: NewLoginUI,
-  initialize: function(parentElement, theme) {
-    this.parent(parentElement, QUIWindow, "qui");
-    this.theme = theme;
-    this.parentElement = parentElement;
-  },
-  postInitialize: function() {
-    this.qjsui = new QJSUI("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;
-  }
-});
index dae0b0187395cd871c604d226084ae2cc7e122a7..41c51ce95e6c810c414f6c0b510fdfa9bb299d65 100644 (file)
@@ -1,10 +1,10 @@
-var SWM_ANCHOR_NONE =   0x00;
-var SWM_ANCHOR_TOP =    0x01;
-var SWM_ANCHOR_BOTTOM = 0x02;
-var SWM_ANCHOR_LEFT =   0x04;
-var SWM_ANCHOR_RIGHT =  0x08;
+qwebirc.ui.SWMUI.SWM_ANCHOR_NONE =   0x00;
+qwebirc.ui.SWMUI.SWM_ANCHOR_TOP =    0x01;
+qwebirc.ui.SWMUI.SWM_ANCHOR_BOTTOM = 0x02;
+qwebirc.ui.SWMUI.SWM_ANCHOR_LEFT =   0x04;
+qwebirc.ui.SWMUI.SWM_ANCHOR_RIGHT =  0x08;
 
-var SWMContainer = new Class({
+qwebirc.ui.SWMUI.Container = new Class({
   initialize: function(parentElement) {
     this.parentElement = parentElement;
   },
@@ -78,11 +78,11 @@ var SWMContainer = new Class({
       });
     }
 
-    var top = anchorFilter(x, SWM_ANCHOR_TOP);
-    var bottom = anchorFilter(x, SWM_ANCHOR_BOTTOM);
-    var left = anchorFilter(x, SWM_ANCHOR_LEFT);
-    var right = anchorFilter(x, SWM_ANCHOR_RIGHT);
-    var none = anchorFilter(x, SWM_ANCHOR_NONE);
+    var top = anchorFilter(x, qwebirc.ui.SWMUI.SWM_ANCHOR_TOP);
+    var bottom = anchorFilter(x, qwebirc.ui.SWMUI.SWM_ANCHOR_BOTTOM);
+    var left = anchorFilter(x, qwebirc.ui.SWMUI.SWM_ANCHOR_LEFT);
+    var right = anchorFilter(x, qwebirc.ui.SWMUI.SWM_ANCHOR_RIGHT);
+    var none = anchorFilter(x, qwebirc.ui.SWMUI.SWM_ANCHOR_NONE);
     
     var x = this.getInnerSize();
     var y = this.getOuterSize();
@@ -123,8 +123,8 @@ var SWMContainer = new Class({
   }
 });
 
-var SWMFrame = new Class({
-  Extends: SWMContainer,
+qwebirc.ui.SWMUI.Frame = new Class({
+  Extends: qwebirc.ui.SWMUI.Container,
   initialize: function(parentElement) {
     this.parent(this);
 
@@ -142,8 +142,8 @@ var SWMFrame = new Class({
   }
 });
 
-var SWMPanel = new Class({
-  Extends: SWMContainer,
+qwebirc.ui.SWMUI.Panel = new Class({
+  Extends: qwebirc.ui.SWMUI.Container,
   initialize: function(parentPanel, hidden) {
     this.parent(parentPanel);
     this.element = new Element("div", {"styles": {
@@ -158,7 +158,7 @@ var SWMPanel = new Class({
     }
     
     parentPanel.element.appendChild(this.element);
-    this.anchor = SWM_ANCHOR_NONE;
+    this.anchor = qwebirc.ui.SWMUI.SWM_ANCHOR_NONE;
   },
   setHeight: function(height) {
     this.height = height;
index ce257ee03185d5bfd55283aa60128254fa79748c..50957e303245ae089760d1d47c110b0195a8009e 100644 (file)
@@ -1,22 +1,76 @@
-var SWMUIWindow = new Class({
-  Extends: UIWindow,
+qwebirc.ui.SWMUI = new Class({
+  Extends: qwebirc.ui.NewLoginUI,
+  initialize: function(parentElement, theme) {
+    this.parent(parentElement, qwebirc.ui.SWMUI.Window, "swmui");
+
+    this.parentElement = parentElement;
+    this.theme = theme;
+  },
+  postInitialize: function() {
+    this.rootFrame = new qwebirc.ui.SWMUI.Frame(this.parentElement);
+
+    this.tabPanel = new qwebirc.ui.SWMUI.Panel(this.rootFrame);
+    this.tabPanel.anchor = qwebirc.ui.SWMUI.SWM_ANCHOR_TOP;
+    this.tabPanel.addClass("tabs");
+    
+    this.mainPanel = new qwebirc.ui.SWMUI.Panel(this.rootFrame);
+    this.mainPanel.addClass("main");
+    
+    this.entryPanel = new qwebirc.ui.SWMUI.Panel(this.rootFrame);
+    this.entryPanel.anchor = qwebirc.ui.SWMUI.SWM_ANCHOR_BOTTOM;
+    this.entryPanel.addClass("entry");
+
+    var form = new Element("form");
+    
+    var inputbox = new Element("input");
+    inputbox.setStyle("border", "0px");
+    
+    window.addEvent("resize", function() {
+      var s = this.entryPanel.getInnerSize().x;
+      inputbox.setStyle("width", s + "px");
+    }.bind(this));
+
+    form.addEvent("submit", function(e) {
+      new Event(e).stop();
+    
+      this.getActiveWindow().client.exec(inputbox.value);
+      inputbox.value = "";
+    }.bind(this));
+
+    this.entryPanel.appendChild(form);
+    form.appendChild(inputbox);
+    inputbox.focus();
+
+    this.resize();
+  },
+  showInput: function(state) {
+    this.entryPanel.setHidden(state);
+    this.resize();
+  },
+  resize: function() {
+    window.fireEvent("resize");
+  }
+});
+
+qwebirc.ui.SWMUI.Window = new Class({
+  Extends: qwebirc.ui.Window,
   
   initialize: function(parentObject, client, type, name) {
     this.parent(parentObject, client, type, name);
-    this.contentPanel = new SWMPanel(parentObject.mainPanel, true);
+    this.contentPanel = new qwebirc.ui.SWMUI.Panel(parentObject.mainPanel, true);
     this.contentPanel.addClass("content");
 
-    if(type == WINDOW_CHANNEL) {
-      this.nickList = new SWMPanel(this.contentPanel);
-      this.nickList.anchor = SWM_ANCHOR_RIGHT;
+    if(type == qwebirc.ui.WINDOW_CHANNEL) {
+      this.nickList = new qwebirc.ui.SWMUI.Panel(this.contentPanel);
+      this.nickList.anchor = qwebirc.ui.SWMUI.SWM_ANCHOR_RIGHT;
       this.nickList.addClass("nicklist");
 
-      this.topic = new SWMPanel(this.contentPanel);
-      this.topic.anchor = SWM_ANCHOR_TOP;
+      this.topic = new qwebirc.ui.SWMUI.Panel(this.contentPanel);
+      this.topic.anchor = qwebirc.ui.SWMUI.SWM_ANCHOR_TOP;
       this.topic.addClass("topic");
     }
     
-    this.xlines = new SWMPanel(this.contentPanel);
+    this.xlines = new qwebirc.ui.SWMUI.Panel(this.contentPanel);
     this.lines = this.xlines.element;
     
     this.tab = new Element("span");
@@ -30,13 +84,13 @@ var SWMUIWindow = new Class({
     parentObject.tabPanel.appendChild(this.tab);
     parentObject.resize();
     
-    if(type != WINDOW_STATUS && type != WINDOW_CONNECT) {
+    if(type != qwebirc.ui.WINDOW_STATUS && type != qwebirc.ui.WINDOW_CONNECT) {
       tabclose = new Element("span");
       tabclose.addClass("tabclose");
       tabclose.addEvent("click", function(e) {
         new Event(e).stop();
         
-        if(type == WINDOW_CHANNEL)
+        if(type == qwebirc.ui.WINDOW_CHANNEL)
           this.client.exec("/PART " + name);
 
         this.close();
@@ -72,7 +126,7 @@ var SWMUIWindow = new Class({
     this.parentObject.resize();
     this.tab.removeClass("tab-unselected");
     this.tab.addClass("tab-selected");
-    this.parentObject.showInput(this.type == WINDOW_CONNECT || this.type == WINDOW_CUSTOM);
+    this.parentObject.showInput(this.type == qwebirc.ui.WINDOW_CONNECT || this.type == qwebirc.ui.WINDOW_CUSTOM);
   },
   deselect: function() {
     this.parent();
@@ -113,57 +167,3 @@ var SWMUIWindow = new Class({
     }
   }
 });
-
-var SWMUI = new Class({
-  Extends: NewLoginUI,
-  initialize: function(parentElement, theme) {
-    this.parent(parentElement, SWMUIWindow, "swmui");
-
-    this.parentElement = parentElement;
-    this.theme = theme;
-  },
-  postInitialize: function() {
-    this.rootFrame = new SWMFrame(this.parentElement);
-
-    this.tabPanel = new SWMPanel(this.rootFrame);
-    this.tabPanel.anchor = SWM_ANCHOR_TOP;
-    this.tabPanel.addClass("tabs");
-    
-    this.mainPanel = new SWMPanel(this.rootFrame);
-    this.mainPanel.addClass("main");
-    
-    this.entryPanel = new SWMPanel(this.rootFrame);
-    this.entryPanel.anchor = SWM_ANCHOR_BOTTOM;
-    this.entryPanel.addClass("entry");
-
-    var form = new Element("form");
-    
-    var inputbox = new Element("input");
-    inputbox.setStyle("border", "0px");
-    
-    window.addEvent("resize", function() {
-      var s = this.entryPanel.getInnerSize().x;
-      inputbox.setStyle("width", s + "px");
-    }.bind(this));
-
-    form.addEvent("submit", function(e) {
-      new Event(e).stop();
-    
-      this.getActiveWindow().client.exec(inputbox.value);
-      inputbox.value = "";
-    }.bind(this));
-
-    this.entryPanel.appendChild(form);
-    form.appendChild(inputbox);
-    inputbox.focus();
-
-    this.resize();
-  },
-  showInput: function(state) {
-    this.entryPanel.setHidden(state);
-    this.resize();
-  },
-  resize: function() {
-    window.fireEvent("resize");
-  }
-});
index b9e87551a80aaf52dd7ec8cc59d4fbb90d275b53..edafc4e1fa41a0c1cc3e5a6bf4ed37c37a02ad31 100644 (file)
@@ -1,4 +1,4 @@
-var ThemeControlCodeMap = {
+qwebirc.ui.themes.ThemeControlCodeMap = {
   "C": "\x03",
   "B": "\x02",
   "U": "\x1F",
@@ -6,7 +6,7 @@ var ThemeControlCodeMap = {
   "$": "$"
 };
 
-var DefaultTheme = {
+qwebirc.ui.themes.Default = {
   "PREFIX": ["$C4==$O "],
   "SIGNON": ["Signed on!", true],
   "CONNECT": ["Connected to server.", true],
@@ -46,12 +46,12 @@ var DefaultTheme = {
   "OURTARGETEDCTCP": ["[ctcp($t)] $x $m"]
 };
 
-var Theme = new Class({
+qwebirc.ui.Theme = new Class({
   initialize: function(themeDict) {
     this.__theme = {};
     
-    for(var k in DefaultTheme)
-      this.__theme[k] = DefaultTheme[k];
+    for(var k in qwebirc.ui.themes.Default)
+      this.__theme[k] = qwebirc.ui.themes.Default[k];
   
     if(themeDict)
       for(var k in themeDict)
@@ -78,7 +78,7 @@ var Theme = new Class({
       if(c == "$" && (i <= n.length - 1)) {
         var c2 = n[++i];
 
-        var o = ThemeControlCodeMap[c2];
+        var o = qwebirc.ui.themes.ThemeControlCodeMap[c2];
         if(!o)
           o = h[c2];
         if(o)
index d2ebd51127a07b8d121007ee7b2e3045245c5df2..d9ce39bb28a4560af7a3e439182091c0d219d4f1 100644 (file)
@@ -1,5 +1,44 @@
-var UglyUIWindow = new Class({
-  Extends: UIWindow,
+qwebirc.ui.UglyUI = new Class({
+  Extends: qwebirc.ui.NewLoginUI,
+  initialize: function(parentElement, theme) {
+    this.parent(parentElement, qwebirc.ui.UglyUI.Window, "uglyui");
+    this.theme = theme;
+    this.parentElement = parentElement;
+  },
+  postInitialize: function() {    
+    this.tabs = new Element("div");
+    this.tabs.addClass("tabbar");
+    
+    this.parentElement.appendChild(this.tabs);
+    
+    this.container = new Element("div");
+    this.container.addClass("container");
+    
+    this.parentElement.appendChild(this.container);
+  
+    var form = new Element("form");
+    this.form = form;
+    
+    var inputbox = new Element("input");
+    inputbox.addClass("input");
+  
+    form.addEvent("submit", function(e) {
+      new Event(e).stop();
+    
+      this.getActiveWindow().client.exec(inputbox.value);
+      inputbox.value = "";
+    }.bind(this));
+    this.parentElement.appendChild(form);  
+    form.appendChild(inputbox);
+    inputbox.focus();
+  },
+  showInput: function(state) {
+    this.form.setStyle("display", state?"block":"none");
+  }
+});
+
+qwebirc.ui.UglyUI.Window = new Class({
+  Extends: qwebirc.ui.Window,
   
   initialize: function(parentObject, client, type, name) {
     this.parent(parentObject, client, type, name);
@@ -10,7 +49,7 @@ var UglyUIWindow = new Class({
     
     parentObject.container.appendChild(this.outerContainer);
     
-    if(type == WINDOW_CHANNEL) {
+    if(type == qwebirc.ui.WINDOW_CHANNEL) {
       this.nicklist = new Element("div");
       this.nicklist.addClass("nicklist");
       
@@ -21,7 +60,7 @@ var UglyUIWindow = new Class({
     innerContainer.addClass("innercontainer");
     this.outerContainer.appendChild(innerContainer);
     
-    if(type == WINDOW_CHANNEL) {
+    if(type == qwebirc.ui.WINDOW_CHANNEL) {
       this.topic = new Element("div");
       this.topic.addClass("topic");
       innerContainer.appendChild(this.topic);
@@ -41,13 +80,13 @@ var UglyUIWindow = new Class({
 
     parentObject.tabs.appendChild(this.tab);
     
-    if(type != WINDOW_STATUS && type != WINDOW_CONNECT) {
+    if(type != qwebirc.ui.WINDOW_STATUS && type != qwebirc.ui.WINDOW_CONNECT) {
       tabclose = new Element("span");
       tabclose.addClass("tabclose");
       tabclose.addEvent("click", function(e) {
         new Event(e).stop();
         
-        if(type == WINDOW_CHANNEL)
+        if(type == qwebirc.ui.WINDOW_CHANNEL)
           this.client.exec("/PART " + name);
 
         this.close();
@@ -85,7 +124,7 @@ var UglyUIWindow = new Class({
     this.outerContainer.removeClass("tab-invisible");
     this.tab.removeClass("tab-unselected");    
     this.tab.addClass("tab-selected");
-    this.parentObject.showInput(this.type != WINDOW_CONNECT && this.type != WINDOW_CUSTOM);
+    this.parentObject.showInput(this.type != qwebirc.ui.WINDOW_CONNECT && this.type != qwebirc.ui.WINDOW_CUSTOM);
   },
   deselect: function() {
     this.parent();
@@ -125,42 +164,3 @@ var UglyUIWindow = new Class({
   }
 });
 
-var UglyUI = new Class({
-  Extends: NewLoginUI,
-  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");
-    
-    this.parentElement.appendChild(this.tabs);
-    
-    this.container = new Element("div");
-    this.container.addClass("container");
-    
-    this.parentElement.appendChild(this.container);
-  
-    var form = new Element("form");
-    this.form = form;
-    
-    var inputbox = new Element("input");
-    inputbox.addClass("input");
-  
-    form.addEvent("submit", function(e) {
-      new Event(e).stop();
-    
-      this.getActiveWindow().client.exec(inputbox.value);
-      inputbox.value = "";
-    }.bind(this));
-    this.parentElement.appendChild(form);  
-    form.appendChild(inputbox);
-    inputbox.focus();
-  },
-  showInput: function(state) {
-    this.form.setStyle("display", state?"block":"none");
-  }
-});
-
index dd4f5b0d89fd1f62b77b9db2a3c35741c0e303c5..5ff4c021c1efcbc4dffc01d05fae7c6b8e4ea92d 100644 (file)
@@ -1,4 +1,4 @@
-function urlificate(element, text, execfn, cmdfn) {
+qwebirc.ui.urlificate = function(element, text, execfn, cmdfn) {
   var punct_re = /(\.*|\,|;)$/;
 
   var txtprocess = function(text, regex, appendfn, matchfn) {
index ab314296822d6d5157067d04b2b176fcd20722fa..a2bbf592e5d151f18511b077ff5e3015ce614ba1 100644 (file)
@@ -1 +1 @@
-QWEBIRC_VERSION = "0.10"
+qwebirc.VERSION = "0.10"
index fb1fa1196b97464e4dab862b19e8b8f2e20a1664..afa24cd71e17dabe922ff08547e3cbb2c334325e 100644 (file)
@@ -15,7 +15,7 @@
   <script type="text/javascript" src="js/qwebirc.js"></script>
   <script type="text/javascript" src="js/mochaui.js"></script>
   <script type="text/javascript">
-    new QWebIRCInterface("ircui", QMochaUI);
+    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.QMochaUI);
   </script>
 </head>
 <body scroll="no">
index e69f05df10670faeb5f3ece5dadaebc9c2298bd7..acc21a0cd397a35469b894dcfdaaf4773a02b0cb 100644 (file)
@@ -12,6 +12,7 @@
   <script type="text/javascript" src="js/mootools-1.2-core.js"></script>
   <script type="text/javascript" src="js/mootools-1.2-more.js"></script>
   <script type="text/javascript" src="js/mochaui/mocha.js"></script>
+  <script type="text/javascript" src="js/debug/qwebirc.js"></script>
   <script type="text/javascript" src="js/debug/version.js"></script>
   <script type="text/javascript" src="js/debug/jslib.js"></script>
   <script type="text/javascript" src="js/debug/irc/ircconnection.js"></script>
@@ -31,7 +32,7 @@
   <script type="text/javascript" src="js/debug/ui/mochaui.js"></script>
   <script type="text/javascript" src="js/debug/qwebircinterface.js"></script>
   <script type="text/javascript">
-    new QWebIRCInterface("ircui", QMochaUI);
+    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.MochaUI);
   </script>
 </head>
 <body scroll="no">
index 4416cfe68f2921d6ffb3f773956fac5fbea3353d..bfbf99c5b8b3ab38102bfb971dc179d8a00eeb3e 100644 (file)
@@ -8,7 +8,7 @@
   <script type="text/javascript" src="js/qwebirc.js"></script>
   <script type="text/javascript" src="js/qui.js"></script>
   <script type="text/javascript">
-    new QWebIRCInterface("ircui", QUI);
+    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.QUI);
   </script>
 </head>
 <body height="100%">
index b93348f3c77539be8cd9ff52314e53e36fd35c5d..517495aafeb9b1c76d42d7d42d32d576853ae3aa 100644 (file)
@@ -6,6 +6,7 @@
   <link rel="stylesheet" href="css/colours.css" type="text/css">
   <link rel="stylesheet" href="css/qui.css" type="text/css">
   <script type="text/javascript" src="js/mootools-1.2-core.js"></script>
+  <script type="text/javascript" src="js/debug/qwebirc.js"></script>
   <script type="text/javascript" src="js/debug/version.js"></script>
   <script type="text/javascript" src="js/debug/jslib.js"></script>
   <script type="text/javascript" src="js/debug/irc/ircconnection.js"></script>
@@ -25,7 +26,7 @@
   <script type="text/javascript" src="js/debug/ui/qui.js"></script>
   <script type="text/javascript" src="js/debug/qwebircinterface.js"></script>
   <script type="text/javascript">
-    new QWebIRCInterface("ircui", QUI);
+    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.QUI);
   </script>
 </head>
 <body style="height: 100%; margin: 0; overflow: hidden;">
index e4dd7beae803708645096e6cbee15a1c81062c29..41bcacb7e7129dfa5808335cc86b98d81ad5ee1d 100644 (file)
@@ -8,7 +8,7 @@
   <script type="text/javascript" src="js/qwebirc.js"></script>
   <script type="text/javascript" src="js/swmui.js"></script>
   <script type="text/javascript">
-    new QWebIRCInterface("ircui", SWMUI);
+    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.SWMUI);
   </script>
 </head>
 <body>
index f7d996f7c6d0ce421e9bfb13584af8f74de34ee5..52a501e1cdfda76e003db2ff82e450020344b339 100644 (file)
@@ -5,6 +5,7 @@
   <link rel="stylesheet" href="css/colours.css" type="text/css">
   <link rel="stylesheet" href="css/swmui.css" type="text/css">
   <script type="text/javascript" src="js/mootools-1.2-core.js"></script>
+  <script type="text/javascript" src="js/debug/qwebirc.js"></script>
   <script type="text/javascript" src="js/debug/version.js"></script>
   <script type="text/javascript" src="js/debug/jslib.js"></script>
   <script type="text/javascript" src="js/debug/irc/ircconnection.js"></script>
   <script type="text/javascript" src="js/debug/ui/theme.js"></script>
   <script type="text/javascript" src="js/debug/ui/genericlogin.js"></script>
   <script type="text/javascript" src="js/debug/ui/embedwizard.js"></script>
-  <script type="text/javascript" src="js/debug/ui/swmlayout.js"></script>
   <script type="text/javascript" src="js/debug/ui/swmui.js"></script>
+  <script type="text/javascript" src="js/debug/ui/swmlayout.js"></script>
   <script type="text/javascript" src="js/debug/qwebircinterface.js"></script>
   <script type="text/javascript">
-    new QWebIRCInterface("ircui", SWMUI);
+    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.SWMUI);
   </script>
 </head>
 <body>
index 8adb04988b737d3d59e34304e660bca31c1897f1..b6b9c1798bf6f7596f87c1281e364dd14cce82f1 100644 (file)
@@ -8,7 +8,7 @@
   <script type="text/javascript" src="js/qwebirc.js"></script>
   <script type="text/javascript" src="js/uglyui.js"></script>
   <script type="text/javascript">
-    new QWebIRCInterface("ircui", UglyUI);
+    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.UglyUI);
   </script>
 </head>
 <body>
index ac5c562871095a9a412687ba66f019ff0d1654e7..0641ee717c28b00cebf5aedfc4a722287d9ab67c 100644 (file)
@@ -5,6 +5,7 @@
   <link rel="stylesheet" href="css/colours.css" type="text/css">
   <link rel="stylesheet" href="css/uglyui.css" type="text/css">
   <script type="text/javascript" src="js/mootools-1.2-core.js"></script>
+  <script type="text/javascript" src="js/debug/qwebirc.js"></script>
   <script type="text/javascript" src="js/debug/version.js"></script>
   <script type="text/javascript" src="js/debug/jslib.js"></script>
   <script type="text/javascript" src="js/debug/irc/ircconnection.js"></script>
@@ -24,7 +25,7 @@
   <script type="text/javascript" src="js/debug/ui/uglyui.js"></script>
   <script type="text/javascript" src="js/debug/qwebircinterface.js"></script>
   <script type="text/javascript">
-    new QWebIRCInterface("ircui", UglyUI);
+    var ui = new qwebirc.ui.Interface("ircui", qwebirc.ui.UglyUI);
   </script>
 </head>
 <body>