]> jfr.im git - irc/quakenet/qwebirc.git/blame - js/ui/baseui.js
iframes should not have borders -- breaks page layout
[irc/quakenet/qwebirc.git] / js / ui / baseui.js
CommitLineData
3e66d49c
CP
1qwebirc.ui.WINDOW_STATUS = 0x01;
2qwebirc.ui.WINDOW_QUERY = 0x02;
3qwebirc.ui.WINDOW_CHANNEL = 0x04;
4qwebirc.ui.WINDOW_CUSTOM = 0x08;
5qwebirc.ui.WINDOW_CONNECT = 0x10;
8c3e644b 6qwebirc.ui.WINDOW_MESSAGES = 0x20;
3e66d49c 7
e20e5a6b 8qwebirc.ui.CUSTOM_CLIENT = "custom";
ffb5ea9a 9qwebirc.ui.DEFAULT_HUE = 210; /* nice blue */
9e769c12 10
e20e5a6b 11qwebirc.ui.BaseUI = new Class({
2cad083e 12 Implements: [Events],
a59dc700 13 initialize: function(parentElement, windowClass, uiName, options) {
2cad083e 14 this.options = options;
a59dc700 15
ea29e3d7
CP
16 this.windows = new QHash();
17 this.clients = new QHash();
18 this.windows.put(qwebirc.ui.CUSTOM_CLIENT, new QHash());
9e769c12
CP
19 this.windowArray = [];
20 this.windowClass = windowClass;
21 this.parentElement = parentElement;
22 this.parentElement.addClass("qwebirc");
23 this.parentElement.addClass("qwebirc-" + uiName);
e8db8558 24 this.firstClient = false;
e20e5a6b 25 this.commandhistory = new qwebirc.irc.CommandHistory();
ffbb638d 26 this.clientId = 0;
eb271d86
CP
27
28 this.windowFocused = true;
85449eee
CP
29
30 if(Browser.Engine.trident) {
31 var checkFocus = function() {
32 var hasFocus = document.hasFocus();
33 if(hasFocus != this.windowFocused) {
34 this.windowFocused = hasFocus;
35 this.focusChange(hasFocus);
36 }
37 }
38
39 checkFocus.periodical(100, this);
40 } else {
41 var blur = function() { if(this.windowFocused) { this.windowFocused = false; this.focusChange(false); } }.bind(this);
42 var focus = function() { if(!this.windowFocused) { this.windowFocused = true; this.focusChange(true); } }.bind(this);
43
44 /* firefox requires both */
45
46 document.addEvent("blur", blur);
47 window.addEvent("blur", blur);
48 document.addEvent("focus", focus);
49 window.addEvent("focus", focus);
50 }
e87f9924
CP
51
52 qwebirc.util.__log = function(x) {
53 if(QWEBIRC_DEBUG) {
54 if(typeof console != "undefined")
55 console.log(x);
56 this.getActiveWindow().addLine(null, x);
57 }
58 }.bind(this);
9e769c12
CP
59 },
60 newClient: function(client) {
ea29e3d7 61 client.id = String(this.clientId++);
96f28062 62 client.hilightController = new qwebirc.ui.HilightController(client);
fc38a626 63 client.addEvent("signedOn", function() {
f2c48132 64 this.poller = new qwebirc.xdomain.Poller(this.oobMessage.bind(this));
fc38a626
CP
65 this.fireEvent("signedOn", client);
66 }.bind(this));
ea29e3d7
CP
67 this.windows.put(client.id, new QHash());
68 this.clients.put(client.id, client);
e20e5a6b 69 var w = this.newWindow(client, qwebirc.ui.WINDOW_STATUS, "Status");
9e769c12 70 this.selectWindow(w);
e8db8558
CP
71 if(!this.firstClient) {
72 this.firstClient = true;
e20e5a6b 73 w.addLine("", "qwebirc v" + qwebirc.VERSION);
6d3d46b5 74 w.addLine("", "Copyright (C) 2008-2017 Chris Porter and the qwebirc project.");
2dfab0e1
CP
75 w.addLine("", "http://www.qwebirc.org");
76 w.addLine("", "Licensed under the GNU General Public License, Version 2.");
e8db8558 77 }
9e769c12
CP
78 return w;
79 },
ffbb638d
CP
80 getClientId: function(client) {
81 if(client == qwebirc.ui.CUSTOM_CLIENT) {
82 return qwebirc.ui.CUSTOM_CLIENT;
83 } else {
84 return client.id;
85 }
86 },
fd3734d4 87 getWindowIdentifier: function(client, type, name) {
f74802c5
CP
88 if(type == qwebirc.ui.WINDOW_MESSAGES)
89 return "-M";
e20e5a6b 90 if(type == qwebirc.ui.WINDOW_STATUS)
f74802c5 91 return "";
fd3734d4
CP
92
93 if(client == qwebirc.ui.CUSTOM_CLIENT) /* HACK */
94 return "_" + name;
95
96 return "_" + client.toIRCLower(name);
f74802c5
CP
97 },
98 newWindow: function(client, type, name) {
99 var w = this.getWindow(client, type, name);
100 if($defined(w))
101 return w;
9e769c12 102
fd3734d4 103 var wId = this.getWindowIdentifier(client, type, name);
ea29e3d7
CP
104 var w = new this.windowClass(this, client, type, name, wId);
105 this.windows.get(this.getClientId(client)).put(wId, w);
9e769c12
CP
106 this.windowArray.push(w);
107
108 return w;
109 },
f74802c5 110 getWindow: function(client, type, name) {
ea29e3d7 111 var c = this.windows.get(this.getClientId(client));
f74802c5
CP
112 if(!$defined(c))
113 return null;
114
69fbfa6d 115 return c.get(this.getWindowIdentifier(client, type, name));
f74802c5 116 },
9e769c12
CP
117 getActiveWindow: function() {
118 return this.active;
119 },
1d42a76f
CP
120 getActiveIRCWindow: function(client) {
121 if(!this.active || this.active.type == qwebirc.ui.WINDOW_CUSTOM) {
ea29e3d7 122 return this.windows.get(this.getClientId(client)).get(this.getWindowIdentifier(client, qwebirc.ui.WINDOW_STATUS));
1d42a76f
CP
123 } else {
124 return this.active;
125 }
126 },
9e769c12
CP
127 __setActiveWindow: function(window) {
128 this.active = window;
129 },
5aa173fb
CP
130 renameWindow: function(window, name) {
131 if(this.getWindow(window.client, window.type, name))
132 return null;
133
134 var clientId = this.getClientId(window.client);
135 var index = this.windowArray.indexOf(window);
136 if(index == -1)
137 return null;
138
ea29e3d7 139 this.windows.get(clientId).remove(window.identifier);
5aa173fb
CP
140
141 var window = this.windowArray[index];
142 window.name = name;
143 window.identifier = this.getWindowIdentifier(window.client, window.type, window.name);
144
ea29e3d7 145 this.windows.get(clientId).put(window.identifier, this.windowArray[index]);
5aa173fb
CP
146
147 if(window.active)
148 this.updateTitle(window.name + " - " + this.options.appTitle);
149
150 window.rename(window.name);
151 return window;
152 },
9e769c12
CP
153 selectWindow: function(window) {
154 if(this.active)
155 this.active.deselect();
156 window.select(); /* calls setActiveWindow */
326478c2
CP
157 this.updateTitle(window.name + " - " + this.options.appTitle);
158 },
159 updateTitle: function(text) {
160 document.title = text;
9e769c12 161 },
ff4befd8
CP
162 nextWindow: function(direction) {
163 if(this.windowArray.length == 0 || !this.active)
164 return;
165
166 if(!direction)
167 direction = 1;
168
169 var index = this.windowArray.indexOf(this.active);
170 if(index == -1)
171 return;
172
173 index = index + direction;
174 if(index < 0) {
175 index = this.windowArray.length - 1;
176 } else if(index >= this.windowArray.length) {
177 index = 0;
178 }
179
180 this.selectWindow(this.windowArray[index]);
181 },
182 prevWindow: function() {
183 this.nextWindow(-1);
184 },
9e769c12
CP
185 __closed: function(window) {
186 if(window.active) {
187 this.active = undefined;
188 if(this.windowArray.length == 1) {
189 this.windowArray = [];
190 } else {
191 var index = this.windowArray.indexOf(window);
6f2e4a37
CP
192 if(index == -1) {
193 return;
194 } else if(index == 0) {
9e769c12
CP
195 this.selectWindow(this.windowArray[1]);
196 } else {
197 this.selectWindow(this.windowArray[index - 1]);
198 }
9e769c12
CP
199 }
200 }
201
404cfb58 202 this.windowArray = this.windowArray.erase(window);
ea29e3d7 203 this.windows.get(this.getClientId(window.client)).remove(window.identifier);
eb9b087b 204 },
eb9b087b
CP
205 /*
206 this shouldn't be called by overriding classes!
66de775f 207 they should implement their own!
eb9b087b
CP
208 some form of user input MUST be received before an
209 IRC connection is made, else users are going to get
210 tricked into getting themselves glined
211 */
66de775f 212 loginBox: function(callback, initialNickname, initialChannels, autoConnect, autoNick) {
e89c812f
CP
213 this.postInitialize();
214
e3f97d79 215 this.addCustomWindow("Connect", qwebirc.ui.ConnectPane, "connectpane", {
13afa38f
CP
216 initialNickname: initialNickname, initialChannels: initialChannels, autoConnect: autoConnect, callback: callback, autoNick: autoNick,
217 uiOptions: this.options
e89c812f 218 }, qwebirc.ui.WINDOW_CONNECT);
eb271d86
CP
219 },
220 focusChange: function(newValue) {
221 var window_ = this.getActiveWindow();
222 if($defined(window_))
223 window_.focusChange(newValue);
c22afc5d 224 },
c22afc5d
CP
225 oobMessage: function(message) {
226 var c = message.splitMax(" ", 2);
227 if(c.length != 2)
228 return;
229
230 var command = c[0];
231 if(command != "CMD")
232 return;
233
234 var d = c[1].splitMax(" ", 2);
235 if(d.length != 2)
236 return;
237
238 var command = d[0];
239 var args = d[1];
240 if(command == "SAY") {
241 var w = this.getActiveIRCWindow();
44c29df2 242 if($defined(w) && (w.type == qwebirc.ui.WINDOW_CHANNEL || w.type == qwebirc.ui.WINDOW_QUERY)) {
c22afc5d
CP
243 w.client.exec("/SAY " + args);
244 return;
245 }
246 }
9e769c12
CP
247 }
248});
381fddfd 249
e20e5a6b
CP
250qwebirc.ui.StandardUI = new Class({
251 Extends: qwebirc.ui.BaseUI,
381fddfd
CP
252 initialize: function(parentElement, windowClass, uiName, options) {
253 this.parent(parentElement, windowClass, uiName, options);
3184781b 254
09f39d2e
CP
255 this.UICommands = this.__build_menu_items(options);
256
ffb5ea9a
CP
257 this.__styleValues = {hue: qwebirc.ui.DEFAULT_HUE, saturation: 0, lightness: 0, textHue: null, textSaturation: null, textLightness: null};
258 if($defined(this.options.hue)) this.__styleValues.hue = this.options.hue;
3184781b 259 this.tabCompleter = new qwebirc.ui.TabCompleterFactory(this);
c0f2f367 260 this.uiOptions = new qwebirc.ui.DefaultOptionsClass(this, options.uiOptionsArg);
ea29e3d7 261 this.customWindows = new QHash();
ffb5ea9a 262
6f8a20df
CP
263 if($defined(this.options.saturation)) this.__styleValues.saturation = this.options.saturation;
264 if($defined(this.options.lightness)) this.__styleValues.lightness = this.options.lightness;
69d01d1d
CP
265 if($defined(this.options.tsaturation)) this.__styleValues.textSaturation = this.options.tsaturation;
266 if($defined(this.options.tlightness)) this.__styleValues.textLightness = this.options.tlightness;
ffb5ea9a
CP
267
268 if($defined(this.options.hue)) { /* overridden in url */
269 /* ugh... this will go away when we add proper options for hue/sat/light for text and background */
270 this.uiOptions.setValueByPrefix("STYLE_HUE", this.__styleValues.hue);
271 } else {
272 this.__styleValues.hue = this.uiOptions.STYLE_HUE; /* otherwise copy from serialised store */
273 }
274 this.__styleValues.textHue = $defined(this.options.thue) ? this.options.thue : this.__styleValues.hue;
275
83d21243 276 document.addEvent("keydown", this.__handleHotkey.bind(this));
20157c51 277 },
09f39d2e
CP
278 __build_menu_items: function(options) {
279 var r = [];
280 var seenAbout = null;
281
282 for(var i=0;i<qwebirc.ui.UI_COMMANDS_P1.length;i++)
283 r.push([true, qwebirc.ui.UI_COMMANDS_P1[i]]);
284 for(var i=0;i<options.customMenuItems.length;i++)
285 r.push([false, options.customMenuItems[i]]);
286 for(var i=0;i<qwebirc.ui.UI_COMMANDS_P2.length;i++)
287 r.push([true, qwebirc.ui.UI_COMMANDS_P2[i]]);
288
289 var r2 = []
290 for(var i=0;i<r.length;i++) {
291 var preset = r[i][0], c = r[i][1];
292
293 if(c[0] == "About qwebirc") { /* HACK */
294 if(!preset) {
295 seenAbout = c;
296 continue;
297 } else if(seenAbout) {
298 c = seenAbout;
299 preset = false;
300 }
301 }
302
303 if(preset) {
304 r2.push([c[0], this[c[1] + "Window"].bind(this)]);
305 } else {
306 r2.push([c[0], (function(c) { return function() {
307 this.addCustomWindow(c[0], qwebirc.ui.URLPane, "urlpane", {url: c[1]});
308 }.bind(this); }).call(this, c)]);
309 }
310 }
311
312 return r2;
313 },
20157c51 314 __handleHotkey: function(x) {
20157c51 315 var success = false;
710fd882 316 if(!x.alt && !x.control && !x.shift && !x.meta) {
83d21243
CP
317 if((x.key == "backspace" || x.key == "/") && !this.getInputFocused(x)) {
318 success = true;
319 }
710fd882
CP
320 } else if(!x.alt || x.control || x.meta) {
321 /* do nothing */
83d21243 322 } else if(x.key == "a" || x.key == "A") {
20157c51
CP
323 var highestNum = 0;
324 var highestIndex = -1;
325 success = true;
83d21243 326
20157c51
CP
327 for(var i=0;i<this.windowArray.length;i++) {
328 var h = this.windowArray[i].hilighted;
329 if(h > highestNum) {
330 highestIndex = i;
331 highestNum = h;
381fddfd 332 }
20157c51
CP
333 }
334 if(highestIndex > -1)
335 this.selectWindow(this.windowArray[highestIndex]);
710fd882 336 } else if((x.key >= '0' && x.key <= '9') && !x.shift) {
20157c51
CP
337 success = true;
338
339 number = x.key - '0';
340 if(number == 0)
341 number = 10
424608ac 342
20157c51
CP
343 number = number - 1;
344
345 if(number >= this.windowArray.length)
346 return;
381fddfd 347
20157c51 348 this.selectWindow(this.windowArray[number]);
710fd882 349 } else if((x.key == "left" || x.key == "up") && !x.shift) {
20157c51
CP
350 this.prevWindow();
351 success = true;
710fd882 352 } else if((x.key == "right" || x.key == "down") && !x.shift) {
20157c51
CP
353 this.nextWindow();
354 success = true;
355 }
710fd882 356
83d21243 357 if(success) {
20157c51 358 new Event(x).stop();
83d21243
CP
359 x.preventDefault();
360 }
20157c51
CP
361 },
362 getInputFocused: function(x) {
deebe19a
CP
363 if($$("input").indexOf(x.target) == -1 && $$("textarea").indexOf(x.target) == -1)
364 return false;
365 return true;
841a451d 366 },
8af49135
CP
367 newCustomWindow: function(name, select, type) {
368 if(!type)
e20e5a6b 369 type = qwebirc.ui.WINDOW_CUSTOM;
e89c812f 370
e20e5a6b 371 var w = this.newWindow(qwebirc.ui.CUSTOM_CLIENT, type, name);
8af49135 372 w.addEvent("close", function(w) {
ea29e3d7 373 this.windows.get(qwebirc.ui.CUSTOM_CLIENT).remove(w.identifier);
8af49135
CP
374 }.bind(this));
375
376 if(select)
377 this.selectWindow(w);
6c19eb8f 378
8af49135
CP
379 return w;
380 },
e89c812f 381 addCustomWindow: function(windowName, class_, cssClass, options, type) {
ebb21d2e
CP
382 if(!$defined(options))
383 options = {};
384
ea29e3d7
CP
385 if(this.customWindows.contains(windowName)) {
386 this.selectWindow(this.customWindows.get(windowName));
8af49135 387 return;
841a451d 388 }
8af49135 389
e89c812f 390 var d = this.newCustomWindow(windowName, true, type);
ea29e3d7 391 this.customWindows.put(windowName, d);
ebb21d2e
CP
392
393 d.addEvent("close", function() {
ea29e3d7 394 this.customWindows.remove(windowName);
8af49135
CP
395 }.bind(this));
396
ebb21d2e 397 if(cssClass)
e1a91a8a 398 d.lines.addClass("qwebirc-" + cssClass);
ebb21d2e
CP
399
400 var ew = new class_(d.lines, options);
8af49135 401 ew.addEvent("close", function() {
ebb21d2e 402 d.close();
8af49135 403 }.bind(this));
17f40fd9
CP
404
405 d.setSubWindow(ew);
841a451d 406 },
ebb21d2e 407 embeddedWindow: function() {
bcd2d24f 408 this.addCustomWindow("Add webchat to your site", qwebirc.ui.EmbedWizard, "embeddedwizard", {baseURL: this.options.baseURL, uiOptions: this.uiOptions, optionsCallback: function() {
c0f2f367
CP
409 this.optionsWindow();
410 }.bind(this)});
ebb21d2e
CP
411 },
412 optionsWindow: function() {
413 this.addCustomWindow("Options", qwebirc.ui.OptionsPane, "optionspane", this.uiOptions);
414 },
e1a91a8a 415 aboutWindow: function() {
09f39d2e 416 this.addCustomWindow("About qwebirc", qwebirc.ui.AboutPane, "aboutpane", this.uiOptions);
b35116e2 417 },
391f51ff
CP
418 feedbackWindow: function() {
419 this.addCustomWindow("Feedback", qwebirc.ui.FeedbackPane, "feedbackpane", this.uiOptions);
420 },
144ee52f 421 urlDispatcher: function(name, window) {
8af49135 422 if(name == "embedded")
925fc357 423 return ["a", this.embeddedWindow.bind(this)];
ebb21d2e
CP
424
425 if(name == "options")
426 return ["a", this.optionsWindow.bind(this)];
8af49135 427
5f2808af
CP
428 /* doesn't really belong here */
429 if(name == "whois") {
430 return ["span", function(nick) {
cbef082a
CP
431 if(this.uiOptions.QUERY_ON_NICK_CLICK) {
432 window.client.exec("/QUERY " + nick);
433 } else {
434 window.client.exec("/WHOIS " + nick);
435 }
436 }.bind(this)];
5f2808af
CP
437 }
438
8af49135 439 return null;
3184781b 440 },
710fd882
CP
441 tabComplete: function(element, backwards) {
442 this.tabCompleter.tabComplete(element, backwards);
3184781b
CP
443 },
444 resetTabComplete: function() {
445 this.tabCompleter.reset();
4dd199c3
CP
446 },
447 setModifiableStylesheet: function(name) {
34d18f7b 448 this.__styleSheet = new qwebirc.ui.style.ModifiableStylesheet(qwebirc.global.staticBaseURL + "css/" + (QWEBIRC_DEBUG ? "debug/" : "") + name + qwebirc.FILE_SUFFIX + ".mcss");
6f8a20df 449 this.setModifiableStylesheetValues({});
4dd199c3 450 },
6f8a20df 451 setModifiableStylesheetValues: function(values) {
ffb5ea9a 452 for (var k in values)
6f8a20df 453 this.__styleValues[k] = values[k];
ffb5ea9a
CP
454
455 if (!$defined(this.__styleSheet))
4dd199c3 456 return;
656385a2 457
ffb5ea9a
CP
458 var back = {hue: this.__styleValues.hue, lightness: this.__styleValues.lightness, saturation: this.__styleValues.saturation};
459 var front;
460 if (!$defined(this.__styleValues.textHue) && !$defined(this.__styleValues.textLightness) && !$defined(this.__styleValues.textSaturation)) {
656385a2 461 front = back;
ffb5ea9a
CP
462 } else {
463 front = {hue: Number(this.__styleValues.textHue), lightness: Number(this.__styleValues.textLightness), saturation: Number(this.__styleValues.textSaturation)}
464 }
656385a2
CP
465 var colours = {
466 back: back,
467 front: front
468 };
469
6f8a20df
CP
470 this.__styleSheet.set(function() {
471 var mode = arguments[0];
472 if(mode == "c") {
656385a2 473 var t = colours[arguments[2]];
6f8a20df 474 var x = new Color(arguments[1]);
656385a2 475 var c = x.setHue(t.hue).setSaturation(x.hsb[1] + t.saturation).setBrightness(x.hsb[2] + t.lightness);
6f8a20df
CP
476 if(c == "255,255,255") /* IE confuses white with transparent... */
477 c = "255,255,254";
478
479 return "rgb(" + c + ")";
480 } else if(mode == "o") {
481 return this.uiOptions[arguments[1]] ? arguments[2] : arguments[3];
482 }
483 }.bind(this));
8af49135 484 }
381fddfd 485});
6f2e4a37 486
326478c2 487qwebirc.ui.NotificationUI = new Class({
e20e5a6b 488 Extends: qwebirc.ui.StandardUI,
fb71087a
CP
489 initialize: function(parentElement, windowClass, uiName, options) {
490 this.parent(parentElement, windowClass, uiName, options);
491
326478c2
CP
492 this.__beeper = new qwebirc.ui.Beeper(this.uiOptions);
493 this.__flasher = new qwebirc.ui.Flasher(this.uiOptions);
f63006ab
CP
494 this.__notifier = new qwebirc.ui.Notifier(this.uiOptions);
495
326478c2 496 this.cancelFlash = this.__flasher.cancelFlash.bind(this.__flasher);
fb71087a 497 },
f63006ab
CP
498 beep: function() {
499 this.__beeper.beep();
500 },
501 notify: function(title, message, callback) {
502 this.__beeper.beep();
503 this.__flasher.flash();
504 this.__notifier.notify(title, message, callback);
505 },
127631e0
CP
506 setBeepOnMention: function(value) {
507 if(value)
326478c2
CP
508 this.__beeper.soundInit();
509 },
f63006ab
CP
510 setNotifications: function(value) {
511 this.__notifier.setEnabled(value);
512 },
326478c2
CP
513 updateTitle: function(text) {
514 if(this.__flasher.updateTitle(text))
515 this.parent(text);
eb271d86
CP
516 },
517 focusChange: function(value) {
518 this.parent(value);
519 this.__flasher.focusChange(value);
f63006ab 520 this.__notifier.focusChange(value);
1211ddcd 521 }
fb71087a
CP
522});
523
5f2808af 524qwebirc.ui.QuakeNetUI = new Class({
e89c812f 525 Extends: qwebirc.ui.NotificationUI,
2cd9e32d
CP
526 urlDispatcher: function(name, window) {
527 if(name == "qwhois") {
7cb09779 528 return ["span", function(auth) {
13afa38f
CP
529 if($defined(this.parentObject.options.accountWhoisCommand))
530 this.client.exec(this.parentObject.options.accountWhoisCommand + auth);
925fc357
CP
531 }.bind(window)];
532 }
144ee52f 533 return this.parent(name, window);
ffbb638d
CP
534 },
535 logout: function() {
536 if(!qwebirc.auth.loggedin())
537 return;
538 if(confirm("Log out?")) {
ea29e3d7
CP
539 this.clients.each(function(k, v) {
540 v.quit("Logged out");
541 }, this);
4b9f894d
CP
542
543 /* HACK */
fbe5af77 544 var foo = function() { document.location = qwebirc.global.dynamicBaseURL + "auth?logout=1"; };
4b9f894d 545 foo.delay(500);
ffbb638d 546 }
2cd9e32d
CP
547 }
548});
144ee52f
CP
549
550qwebirc.ui.RootUI = qwebirc.ui.QuakeNetUI;
fbe5af77
CP
551
552qwebirc.ui.RequestTransformHTML = function(options) {
553 var HREF_ELEMENTS = {
554 "IMG": 1
555 };
556
557 var update = options.update;
558 var onSuccess = options.onSuccess;
559
560 var fixUp = function(node) {
561 if(node.nodeType != 1)
562 return;
563
564 var tagName = node.nodeName.toUpperCase();
565 if(HREF_ELEMENTS[tagName]) {
566 var attr = node.getAttribute("transform_attr");
567 var value = node.getAttribute("transform_value");
568 if($defined(attr) && $defined(value)) {
569 node.removeAttribute("transform_attr");
570 node.removeAttribute("transform_value");
571 node.setAttribute(attr, qwebirc.global.staticBaseURL + value);
572 }
573 }
574
575 for(var i=0;i<node.childNodes.length;i++)
576 fixUp(node.childNodes[i]);
577 };
578
579 delete options["update"];
580 options.onSuccess = function(tree, elements, html, js) {
581 var container = new Element("div");
582 container.set("html", html);
583 fixUp(container);
584 update.empty();
585
586 while(container.childNodes.length > 0) {
587 var x = container.firstChild;
588 container.removeChild(x);
589 update.appendChild(x);
590 }
591 onSuccess();
592 };
593
594 return new Request.HTML(options);
595};
596