function qwebirc_ui_onbeforeunload(e) { /* IE sucks */
- var message = "This action will close all active IRC connections.";
- var e = e || window.event;
- if(e)
- e.returnValue = message;
- return message;
+ if(qwebirc.connected) {
+ var message = "This action will close all active IRC connections.";
+ var e = e || window.event;
+ if(e)
+ e.returnValue = message;
+ return message;
+ }
}
qwebirc.ui.Interface = new Class({
hue: null,
saturation: null,
lightness: null,
+ thue: null,
+ tsaturation: null,
+ tlightness: null,
uiOptionsArg: null,
nickValidation: null,
dynamicBaseURL: "/",
},
initialize: function(element, ui, options) {
this.setOptions(options);
+ var extractHost = function(uri) {
+ 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(uri.substr(uri.length - 1) != "/")
+ uri = uri + "/";
+
+ return uri;
+ };
+
+ options.baseURL = extractHost(document.location.href);
/* HACK */
qwebirc.global = {
dynamicBaseURL: options.dynamicBaseURL,
staticBaseURL: options.staticBaseURL,
+ baseURL: options.baseURL,
nicknameValidator: $defined(options.nickValidation) ? new qwebirc.irc.NicknameValidator(options.nickValidation) : new qwebirc.irc.DummyNicknameValidator()
};
+
window.addEvent("domready", function() {
var callback = function(options) {
var IRC = new qwebirc.irc.IRCClient(options, ui_);
if(this.options.searchURL) {
var args = qwebirc.util.parseURI(String(document.location));
- this.options.hue = this.getHueArg(args);
- this.options.saturation = this.getSaturationArg(args);
- this.options.lightness = this.getLightnessArg(args);
+ this.options.hue = this.getHueArg(args, "");
+ this.options.saturation = this.getSaturationArg(args, "");
+ this.options.lightness = this.getLightnessArg(args, "");
+
+ this.options.thue = this.getHueArg(args, "t");
+ this.options.tsaturation = this.getSaturationArg(args, "t");
+ this.options.tlightness = this.getLightnessArg(args, "t");
if($defined(args["uio"]))
this.options.uiOptionsArg = args["uio"];
var details = ui_.loginBox(callback, inick, ichans, autoConnect, usingAutoNick);
}.bind(this));
},
- getHueArg: function(args) {
- var hue = args["hue"];
+ getHueArg: function(args, t) {
+ var hue = args[t + "hue"];
if(!$defined(hue))
return null;
hue = parseInt(hue);
return null;
return hue;
},
- getSaturationArg: function(args) {
- var saturation = args["saturation"];
+ getSaturationArg: function(args, t) {
+ var saturation = args[t + "saturation"];
if(!$defined(saturation))
return null;
saturation = parseInt(saturation);
return null;
return saturation;
},
- getLightnessArg: function(args) {
- var lightness = args["lightness"];
+ getLightnessArg: function(args, t) {
+ var lightness = args[t + "lightness"];
if(!$defined(lightness))
return null;
lightness = parseInt(lightness);