this.exec("/AUTOJOIN");
}
+
+ this.ui.signedOn();
},
userJoined: function(user, channel) {
var nick = user.hostToNick();
}
this.tracker = undefined;
+ qwebirc.connected = false;
this.newServerLine("DISCONNECT", {"m": message});
},
nickOnChanHasPrefix: function(nick, channel, prefix) {
this.parent(key, value);
},
connected: function() {
+ qwebirc.connected = true;
this.newServerLine("CONNECT");
},
serverError: function(message) {
},
channelCreationTime: function(channel, time) {
this.newTargetOrActiveLine(channel, "CHANNELCREATIONTIME", {c: channel, m: qwebirc.irc.IRCDate(new Date(time * 1000))});
- }
+ },
+ qwebircImage: function(target, url) {
+ var w;
+ if(target == "-STATUS") {
+ w = this.statusWindow;
+ } else {
+ w = this.getWindow(target);
+ }
+
+ if(!w)
+ w = this.getActiveWindow();
+
+ var img = new Element("img", {src: qwebirc.global.dynamicBaseURL + "image?filename=" + url});
+ var d = new Element("div", {styles: {"paddingTop": "2px", "paddingBottom": "2px", "paddingLeft": "9px"}});
+ d.appendChild(img);
+ w.scrollAdd(d);
+ return true;
+ }
});
- var qwebirc = {ui: {themes: {}, style: {}}, irc: {}, util: {crypto: {}}, config: {}, auth: {}, sound: {}, xdomain: {}};
-var qwebirc = {ui: {themes: {}, style: {}}, irc: {}, util: {crypto: {}}, config: {}, auth: {}, sound: {}, connected: false};
++var qwebirc = {ui: {themes: {}, style: {}}, irc: {}, util: {crypto: {}}, config: {}, auth: {}, sound: {}, connected: false, xdomain: {}};
if(typeof QWEBIRC_BUILD != "undefined") {
qwebirc.BUILD = QWEBIRC_BUILD;
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({
},
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_);