X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/f54cfe1febcd4fe11ef7da13e068f5f14d5cbdfc..fbe5af7709ff70c49b70817793fc39664ddca96b:/js/qwebircinterface.js diff --git a/js/qwebircinterface.js b/js/qwebircinterface.js index 2ea6ac1..381ecbd 100644 --- a/js/qwebircinterface.js +++ b/js/qwebircinterface.js @@ -1,3 +1,11 @@ +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; +} + qwebirc.ui.Interface = new Class({ Implements: [Options], options: { @@ -10,16 +18,21 @@ qwebirc.ui.Interface = new Class({ searchURL: true, theme: undefined, baseURL: null, - hue: null + hue: null, + dynamicBaseURL: "/", + staticBaseURL: "/" }, initialize: function(element, ui, options) { + qwebirc.global = {dynamicBaseURL: options.dynamicBaseURL, staticBaseURL: options.staticBaseURL}; /* HACK */ + this.setOptions(options); window.addEvent("domready", function() { var callback = function(options) { var IRC = new qwebirc.irc.IRCClient(options, ui_); IRC.connect(); - window.addEvent("beforeunload", function() { + window.onbeforeunload = qwebirc_ui_onbeforeunload; + window.addEvent("unload", function() { IRC.quit("Page closed"); }); };