theme: undefined,
baseURL: null,
hue: null,
+ uiOptionsArg: null,
dynamicBaseURL: "/",
staticBaseURL: "/"
},
if(this.options.searchURL) {
var args = qwebirc.util.parseURI(String(document.location));
this.options.hue = this.getHueArg(args);
+
+ if($defined(args["uio"]))
+ this.options.uiOptionsArg = args["uio"];
+
var url = args["url"];
var chans, nick = args["nick"];
this.parent(parentElement, windowClass, uiName, options);
this.tabCompleter = new qwebirc.ui.TabCompleterFactory(this);
- this.uiOptions = new qwebirc.ui.DefaultOptionsClass(this);
+ this.uiOptions = new qwebirc.ui.DefaultOptionsClass(this, options.uiOptionsArg);
this.customWindows = {};
var ev;
d.setSubWindow(ew);
},
embeddedWindow: function() {
- this.addCustomWindow("Embedding wizard", qwebirc.ui.EmbedWizard, "embeddedwizard", {baseURL: this.options.baseURL});
+ this.addCustomWindow("Embedding wizard", qwebirc.ui.EmbedWizard, "embeddedwizard", {baseURL: this.options.baseURL, uiOptions: this.uiOptions, optionsCallback: function() {
+ this.optionsWindow();
+ }.bind(this)});
},
optionsWindow: function() {
this.addCustomWindow("Options", qwebirc.ui.OptionsPane, "optionspane", this.uiOptions);
qwebirc.ui.EmbedWizard = new Class({
Implements: [Options, Events],
options: {
- parent: null,
+ uiOptions: null,
+ optionsCallback: null,
baseURL: "http://webchat.quakenet.org/"
},
initialize: function(parent, options) {
- this.setOptions(options);
+ /* for some unknown reason setOptions doesn't work... */
+ this.options.uiOptions = options.uiOptions;
+ this.options.baseURL = options.baseURL;
+ this.options.optionsCallback = options.optionsCallback;
+
this.create(parent);
this.addSteps();
},
};
this.welcome = this.newStep({
- "title": "Welcome!",
+ "title": "Add webchat to your website",
"first": "This wizard will help you create an embedded client by asking you questions then giving you the code to add to your website.<br/><br/>You can use the <b>Next</b> and <b>Back</b> buttons to navigate through the wizard; click <b>Next</b> to continue."
});
middle: promptdiv,
"hint": "You need to display the dialog if you want the user to be able to set their nickname before connecting."
});
+
+ var changeOptions = new Element("input");
+ changeOptions.type = "submit";
+ changeOptions.value = "Alter current look and feel";
+ changeOptions.addEvent("click", this.options.optionsCallback);
+
+ this.lookandfeel = this.newStep({
+ "title": "Alter look and feel?",
+ "first": "The look and feel will be copied from the current settings.",
+ middle: changeOptions
+ });
var autoconnect = this.newRadio(promptdiv, "Connect without displaying the dialog.", "prompt", true);
this.connectdialogr = this.newRadio(promptdiv, "Show the connect dialog.", "prompt");
if(this.chanBox.value != "" && !this.choosenick.checked)
this.steps.push(this.connectdialog);
+ this.steps.push(this.lookandfeel);
this.steps.push(this.finish);
},
showStep: function() {
if(connectdialog)
URL.push("prompt=1");
+ var uioptions = this.options.uiOptions.serialise();
+ if(uioptions != "")
+ URL.push("uio=" + uioptions);
+
return this.options.baseURL + (URL.length>0?"?":"") + URL.join("&");
}
});
return [true];
}
+/**
+ * Note that options are settable by the uioptions url arg by default unless you specifiy
+ * settableByURL...
+ */
qwebirc.config.DEFAULT_OPTIONS = [
[1, "BEEP_ON_MENTION", "Beep when nick mentioned or on query activity (requires Flash)", true, {
enabled: function() {
[2, "DEDICATED_MSG_WINDOW", "Send privmsgs to dedicated messages window", false],
[4, "DEDICATED_NOTICE_WINDOW", "Send notices to dedicated message window", false],
[3, "NICK_OV_STATUS", "Show status (@/+) before nicknames in channel lines", true],
- [5, "ACCEPT_SERVICE_INVITES", "Automatically join channels when invited by Q", true],
- [6, "USE_HIDDENHOST", "Hide your hostmask when authed to Q (+x)", true],
+ [5, "ACCEPT_SERVICE_INVITES", "Automatically join channels when invited by Q", true, {
+ settableByURL: false
+ }],
+ [6, "USE_HIDDENHOST", "Hide your hostmask when authed to Q (+x)", true, {
+ settableByURL: false
+ }],
[8, "LASTPOS_LINE", "Show a last position indicator for each window", true, {
enabled: qwebirc.ui.supportsFocus
}],
this.default_ = enabledResult[1];
} else {
this.enabled = true;
- }
+ }
+
+ if($defined(extras) && $defined(extras.settableByURL)) {
+ this.settableByURL = extras.settableByURL;
+ } else {
+ this.settableByURL = true;
+ }
},
setSavedValue: function(x) {
if(this.enabled)
}
});
+qwebirc.ui.SuppliedArgOptions = new Class({
+ Extends: qwebirc.ui.CookieOptions,
+ initialize: function(ui, arg) {
+ var p = {};
+
+ if($defined(arg) && arg != "") {
+ var decoded = qwebirc.util.b64Decode(arg);
+ if(decoded)
+ p = qwebirc.util.parseURI("?" + decoded);
+ }
+
+ this.parsedOptions = p;
+ this.parent(ui);
+ },
+ _get: function(x) {
+ if(x.settableByURL !== true)
+ return this.parent(x);
+
+ var opt = this.parsedOptions[x.optionId];
+ if(!$defined(opt))
+ return this.parent(x);
+
+ return opt;
+ },
+ serialise: function() {
+ var result = [];
+ this.getOptionList().forEach(function(x) {
+ if(x.settableByURL && x.default_ != x.value)
+ result.push(x.optionId + "=" + x.value);
+ }.bind(this));
+
+ return qwebirc.util.b64Encode(result.join("&")).replaceAll("=", "");
+ }
+});
+
qwebirc.ui.DefaultOptionsClass = new Class({
- Extends: qwebirc.ui.CookieOptions
+ Extends: qwebirc.ui.SuppliedArgOptions
});