]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/baseuiwindow.js
1 var UIWindow
= new Class({
3 initialize: function(parentObject
, client
, type
, name
, identifier
) {
4 this.parentObject
= parentObject
;
9 this.identifier
= identifier
;
10 this.hilighted
= false;
11 this.scrolltimer
= null;
13 updateNickList: function(nicks
) {
15 updateTopic: function(topic
) {
18 if($defined(this.scrolltimer
)) {
19 $clear(this.scrolltimer
);
20 this.scrolltimer
= null;
23 this.parentObject
.__closed(this);
24 this.fireEvent("close", this);
28 this.parentObject
.__setActiveWindow(this);
30 this.setHilighted
.pass(false, this);
32 deselect: function() {
35 addLine: function(type
, line
, colour
, element
, parent
, scrollparent
) {
36 if(!this.active
&& !this.hilighted
)
37 this.setHilighted
.pass(true, this);
40 line
= this.parentObject
.theme
.message(type
, line
);
42 Colourise(IRCTimestamp(new Date()) + " " + line
, element
);
44 this.scrollAdd(element
);
46 errorMessage: function(message
) {
47 this.addLine("", message
, "red");
49 setHilighted: function(state
) {
50 this.hilighted
= state
;
52 scrollAdd: function(element
) {
53 var parent
= this.lines
;
54 var scrollparent
= parent
;
56 if($defined(this.scroller
))
57 scrollparent
= this.scroller
;
59 var prev
= parent
.getScroll();
60 var prevbottom
= parent
.getScrollSize().y
;
61 var prevsize
= parent
.getSize();
63 /* scroll in bursts, else the browser gets really slow */
64 if($defined(element
)) {
65 parent
.appendChild(element
);
66 if(this.scrolltimer
|| (prev
.y
+ prevsize
.y
== prevbottom
)) {
68 $clear(this.scrolltimer
);
69 this.scrolltimer
= this.scrollAdd
.delay(10, this, [null, null]);
72 scrollparent
.scrollTo(prev
.x
, parent
.getScrollSize().y
);
73 this.scrolltimer
= null;