]>
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 this.scrolleddown
= true;
14 //new CommandHistory();
16 updateNickList: function(nicks
) {
18 updateTopic: function(topic
) {
21 if($defined(this.scrolltimer
)) {
22 $clear(this.scrolltimer
);
23 this.scrolltimer
= null;
26 this.parentObject
.__closed(this);
27 this.fireEvent("close", this);
31 this.parentObject
.__setActiveWindow(this);
33 this.setHilighted(false);
35 this.scrollToBottom();
37 deselect: function() {
38 if(!this.parentObject
.singleWindow
)
39 this.scrolleddown
= this.scrolledDown();
40 if($defined(this.scrolltimer
)) {
41 $clear(this.scrolltimer
);
42 this.scrolltimer
= null;
47 addLine: function(type
, line
, colour
, element
) {
48 if(!this.active
&& !this.hilighted
)
49 this.setHilighted(true);
51 line
= this.parentObject
.theme
.message(type
, line
);
53 Colourise(IRCTimestamp(new Date()) + " " + line
, element
, this.client
.exec
);
55 this.scrollAdd(element
);
57 errorMessage: function(message
) {
58 this.addLine("", message
, "red");
60 setHilighted: function(state
) {
61 this.hilighted
= state
;
63 scrolledDown: function() {
67 var parent
= this.lines
;
69 var prev
= parent
.getScroll();
70 var prevbottom
= parent
.getScrollSize().y
;
71 var prevsize
= parent
.getSize();
73 return prev
.y
+ prevsize
.y
== prevbottom
;
75 scrollToBottom: function() {
76 var parent
= this.lines
;
77 var scrollparent
= parent
;
79 if($defined(this.scroller
))
80 scrollparent
= this.scroller
;
82 scrollparent
.scrollTo(parent
.getScroll().x
, parent
.getScrollSize().y
);
84 scrollAdd: function(element
) {
85 var parent
= this.lines
;
87 /* scroll in bursts, else the browser gets really slow */
88 if($defined(element
)) {
89 var sd
= this.scrolledDown();
90 parent
.appendChild(element
);
93 $clear(this.scrolltimer
);
94 this.scrolltimer
= this.scrollAdd
.delay(50, this, [null]);
97 this.scrollToBottom();
98 this.scrolltimer
= null;
101 historyExec: function(line
) {
102 this.commandhistory
.addLine(line
);
103 this.client
.exec(line
);