From: Chris Porter Date: Mon, 13 Feb 2012 01:46:47 +0000 (+0000) Subject: Merge. X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/commitdiff_plain/129b197fb5b6c23f2b12f1aa78a149df9357eb1f?hp=-c Merge. --- 129b197fb5b6c23f2b12f1aa78a149df9357eb1f diff --combined js/irc/ircclient.js index 354e41a,a26ae86..dc8a097 --- a/js/irc/ircclient.js +++ b/js/irc/ircclient.js @@@ -242,8 -242,6 +242,8 @@@ qwebirc.irc.IRCClient = new Class( this.exec("/AUTOJOIN"); } + + this.ui.signedOn(); }, userJoined: function(user, channel) { var nick = user.hostToNick(); @@@ -525,6 -523,7 +525,7 @@@ } this.tracker = undefined; + qwebirc.connected = false; this.newServerLine("DISCONNECT", {"m": message}); }, nickOnChanHasPrefix: function(nick, channel, prefix) { @@@ -567,6 -566,7 +568,7 @@@ this.parent(key, value); }, connected: function() { + qwebirc.connected = true; this.newServerLine("CONNECT"); }, serverError: function(message) { @@@ -669,22 -669,5 +671,22 @@@ }, 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; + } }); diff --combined js/qwebirc.js index f5981c4,03e8b80..8e4b085 --- a/js/qwebirc.js +++ b/js/qwebirc.js @@@ -1,4 -1,4 +1,4 @@@ - 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; diff --combined js/qwebircinterface.js index 7be8fa7,1d7f249..44ea44c --- a/js/qwebircinterface.js +++ b/js/qwebircinterface.js @@@ -1,9 -1,11 +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; + 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({ @@@ -31,31 -33,14 +33,31 @@@ }, 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_);