+
+qwebirc.ui.QuakeNetUI = new Class({
+ Extends: qwebirc.ui.NewLoginUI,
+ urlDispatcher: function(name, window) {
+ if(name == "qwhois") {
+ return ["span", function(auth) {
+ this.client.exec("/MSG Q whois #" + auth);
+ }.bind(window)];
+ }
+ return this.parent(name, window);
+ },
+ logout: function() {
+ if(!qwebirc.auth.loggedin())
+ return;
+ if(confirm("Log out?")) {
+ for(var client in this.clients) {
+ this.clients[client].quit("Logged out");
+ };
+
+ /* HACK */
+ var foo = function() { document.location = qwebirc.global.dynamicBaseURL + "auth?logout=1"; };
+ foo.delay(500);
+ }
+ }
+});
+
+qwebirc.ui.RootUI = qwebirc.ui.QuakeNetUI;
+
+qwebirc.ui.RequestTransformHTML = function(options) {
+ var HREF_ELEMENTS = {
+ "IMG": 1
+ };
+
+ var update = options.update;
+ var onSuccess = options.onSuccess;
+
+ var fixUp = function(node) {
+ if(node.nodeType != 1)
+ return;
+
+ var tagName = node.nodeName.toUpperCase();
+ if(HREF_ELEMENTS[tagName]) {
+ var attr = node.getAttribute("transform_attr");
+ var value = node.getAttribute("transform_value");
+ if($defined(attr) && $defined(value)) {
+ node.removeAttribute("transform_attr");
+ node.removeAttribute("transform_value");
+ node.setAttribute(attr, qwebirc.global.staticBaseURL + value);
+ }
+ }
+
+ for(var i=0;i<node.childNodes.length;i++)
+ fixUp(node.childNodes[i]);
+ };
+
+ delete options["update"];
+ options.onSuccess = function(tree, elements, html, js) {
+ var container = new Element("div");
+ container.set("html", html);
+ fixUp(container);
+ update.empty();
+
+ while(container.childNodes.length > 0) {
+ var x = container.firstChild;
+ container.removeChild(x);
+ update.appendChild(x);
+ }
+ onSuccess();
+ };
+
+ return new Request.HTML(options);
+};
+