]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/panes/options.js
use home-made string hashset/map instead of js default
[irc/quakenet/qwebirc.git] / js / ui / panes / options.js
index 512c0fd170ca5f02880030e9683cb74bd980382e..879dc2b79d81d8a75830d80259b6dd927ee73312 100644 (file)
@@ -46,11 +46,12 @@ qwebirc.config.DEFAULT_OPTIONS = [
     return {class_: qwebirc.config.HueOption, default_: 210};
   }, {
     applyChanges: function(value, ui) {
-      ui.setModifiableStylesheetValues(value, 0, 0);
+      ui.setModifiableStylesheetValues({hue: value});
     }
   }],
   [12, "QUERY_ON_NICK_CLICK", "Query on nickname click in channel", false],
-  [13, "SHOW_NICKLIST", "Show nickname list in channels", true]
+  [13, "SHOW_NICKLIST", "Show nickname list in channels", true],
+  [14, "SHOW_TIMESTAMPS", "Show timestamps", true] /* we rely on the hue update */
 ];
 
 qwebirc.config.DefaultOptions = null;
@@ -436,14 +437,18 @@ qwebirc.ui.CookieOptions = new Class({
 qwebirc.ui.SuppliedArgOptions = new Class({
   Extends: qwebirc.ui.CookieOptions,
   initialize: function(ui, arg) {
-    var p = {};
+    var p = new QHash();
     
     if($defined(arg) && arg != "" && arg.length > 2) {
       var checksum = arg.substr(arg.length - 2, 2);
       var decoded = qwebirc.util.b64Decode(arg.substr(0, arg.length - 2));
       
-      if(decoded && (new qwebirc.util.crypto.MD5().digest(decoded).slice(0, 2) == checksum))
-        p = qwebirc.util.parseURI("?" + decoded);
+      if(decoded && (new qwebirc.util.crypto.MD5().digest(decoded).slice(0, 2) == checksum)) {
+        var p2 = qwebirc.util.parseURI("?" + decoded);
+        p2.each(function(k, v) {
+          p.put(k, JSON.decode(v, true));
+        });
+      }
     }
     
     this.parsedOptions = p;
@@ -453,7 +458,7 @@ qwebirc.ui.SuppliedArgOptions = new Class({
     if(x.settableByURL !== true)
       return this.parent(x);
 
-    var opt = this.parsedOptions[x.optionId];
+    var opt = this.parsedOptions.get(String(x.optionId));
     if(!$defined(opt))
       return this.parent(x);
       
@@ -463,7 +468,7 @@ qwebirc.ui.SuppliedArgOptions = new Class({
     var result = [];
     this.getOptionList().forEach(function(x) {
       if(x.settableByURL && x.default_ != x.value)
-        result.push(x.optionId + "=" + x.value);
+        result.push(x.optionId + "=" + JSON.encode(x.value));
     }.bind(this));
     
     var raw = result.join("&");