]>
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;
12 this.commandhistory
= this.parentObject
.commandhistory
;
13 //new CommandHistory();
15 updateNickList: function(nicks
) {
17 updateTopic: function(topic
) {
20 if($defined(this.scrolltimer
)) {
21 $clear(this.scrolltimer
);
22 this.scrolltimer
= null;
25 this.parentObject
.__closed(this);
26 this.fireEvent("close", this);
30 this.parentObject
.__setActiveWindow(this);
32 this.setHilighted(false);
34 deselect: function() {
37 addLine: function(type
, line
, colour
, element
, parent
, scrollparent
) {
38 if(!this.active
&& !this.hilighted
)
39 this.setHilighted(true);
42 line
= this.parentObject
.theme
.message(type
, line
);
44 Colourise(IRCTimestamp(new Date()) + " " + line
, element
);
46 this.scrollAdd(element
);
48 errorMessage: function(message
) {
49 this.addLine("", message
, "red");
51 setHilighted: function(state
) {
52 this.hilighted
= state
;
54 scrollAdd: function(element
) {
55 var parent
= this.lines
;
56 var scrollparent
= parent
;
58 if($defined(this.scroller
))
59 scrollparent
= this.scroller
;
61 var prev
= parent
.getScroll();
62 var prevbottom
= parent
.getScrollSize().y
;
63 var prevsize
= parent
.getSize();
65 /* scroll in bursts, else the browser gets really slow */
66 if($defined(element
)) {
67 parent
.appendChild(element
);
68 if(this.scrolltimer
|| (prev
.y
+ prevsize
.y
== prevbottom
)) {
70 $clear(this.scrolltimer
);
71 this.scrolltimer
= this.scrollAdd
.delay(50, this, [null, null]);
74 scrollparent
.scrollTo(prev
.x
, parent
.getScrollSize().y
);
75 this.scrolltimer
= null;
78 historyExec: function(line
) {
79 this.commandhistory
.addLine(line
);
80 this.client
.exec(line
);