]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/qwebircinterface.js
cloak testing
[irc/quakenet/qwebirc.git] / js / qwebircinterface.js
index f4d608c5f153f55ca62d65be6368f02d263de88d..c1eb3c281b579f93f47303bf937387a6ef5bd2cb 100644 (file)
@@ -30,12 +30,21 @@ qwebirc.ui.Interface = new Class({
     nickValidation: null,
     helpURL: null,
     dynamicBaseURL: "/",
-    staticBaseURL: "/"
+    staticBaseURL: "/",
+    cloak: false
   },
   initialize: function(element, ui, options) {
     this.setOptions(options);
     var extractHost = function() {
-      var uri = document.location.origin + document.location.pathname;
+      var uri = document.location.href;
+
+      /* IE6 doesn't have document.origin ... */
+      var start = uri.indexOf('?');
+      if(start != -1)
+        uri = uri.substring(0, start);
+      var start = uri.indexOf('#');
+      if(start != -1)
+        uri = uri.substring(0, start);
 
       if(QWEBIRC_DEBUG && uri.endsWith(".html")) {
         var last = uri.lastIndexOf("/");
@@ -60,6 +69,7 @@ qwebirc.ui.Interface = new Class({
 
     window.addEvent("domready", function() {
       var callback = function(options) {
+        options.cloak = ui_.options.cloak;
         var IRC = new qwebirc.irc.IRCClient(options, ui_);
         IRC.connect();
         window.onbeforeunload = qwebirc_ui_onbeforeunload;
@@ -121,7 +131,10 @@ qwebirc.ui.Interface = new Class({
           
         if(args.contains("randomnick") && args.get("randomnick") == 1)
           inick = this.options.initialNickname;
-          
+
+        if(args.contains("cloak") && args.get("cloak") == 1)
+          this.options.cloak = true;
+
         /* we only consider autoconnecting if the nick hasn't been supplied, or it has and it's not "" */
         if(canAutoConnect && (!$defined(inick) || ($defined(inick) && (inick != "")))) {
           var p = args.get("prompt");