]>
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
= false;
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
, parent
, scrollparent
) {
48 if(!this.active
&& !this.hilighted
)
49 this.setHilighted(true);
52 line
= this.parentObject
.theme
.message(type
, line
);
54 Colourise(IRCTimestamp(new Date()) + " " + line
, element
);
56 this.scrollAdd(element
);
58 errorMessage: function(message
) {
59 this.addLine("", message
, "red");
61 setHilighted: function(state
) {
62 this.hilighted
= state
;
64 __scrolledDown: function() {
68 var parent
= this.lines
;
70 var prev
= parent
.getScroll();
71 var prevbottom
= parent
.getScrollSize().y
;
72 var prevsize
= parent
.getSize();
73 //alert("1: " + (prev.y + prevsize.y) + " 2:" + prevbottom);
74 return prev
.y
+ prevsize
.y
== prevbottom
;
76 __scrollToBottom: function() {
77 var parent
= this.lines
;
78 var scrollparent
= parent
;
80 if($defined(this.scroller
))
81 scrollparent
= this.scroller
;
83 scrollparent
.scrollTo(parent
.getScroll().x
, parent
.getScrollSize().y
);
85 scrollAdd: function(element
) {
86 var parent
= this.lines
;
88 /* scroll in bursts, else the browser gets really slow */
89 if($defined(element
)) {
90 var sd
= this.__scrolledDown();
91 parent
.appendChild(element
);
94 $clear(this.scrolltimer
);
95 this.scrolltimer
= this.scrollAdd
.delay(50, this, [null]);
98 this.__scrollToBottom();
99 this.scrolltimer
= null;
102 historyExec: function(line
) {
103 this.commandhistory
.addLine(line
);
104 this.client
.exec(line
);