]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/qui.js
1 var QUIWindow
= new Class({
4 initialize: function(parentObject
, client
, type
, name
) {
5 this.parent(parentObject
, client
, type
, name
);
7 this.tab
= new Element("span");
8 this.tab
.addClass("tab");
10 this.tab
.appendText(name
);
11 this.tab
.addEvent("click", function() {
12 parentObject
.selectWindow(this);
15 parentObject
.tabs
.appendChild(this.tab
);
17 if(type
!= WINDOW_STATUS
) {
18 tabclose
= new Element("span");
19 tabclose
.addClass("tabclose");
20 tabclose
.addEvent("click", function(e
) {
23 if(type
== WINDOW_CHANNEL
)
24 this.client
.exec("/PART " + name
);
28 tabclose
.set("text", "X");
29 this.tab
.appendChild(tabclose
);
32 this.parentObject
.reflow();
34 this.window
= new Element("div");
35 this.window
.addClass("window");
36 parentObject
.container
.appendChild(this.window
);
38 this.lines
= new Element("div");
39 this.lines
.addClass("lines");
40 this.window
.appendChild(this.lines
);
42 var formdiv
= new Element("div");
43 this.window
.appendChild(formdiv
);
45 var form
= new Element("form");
46 var inputbox
= new Element("input");
47 formdiv
.addClass("input");
49 form
.addEvent("submit", function(e
) {
52 this.client
.exec(inputbox
.value
);
55 formdiv
.appendChild(form
);
56 form
.appendChild(inputbox
);
60 var bottompos
= formdiv
.getSize().y
;
62 if(type
== WINDOW_CHANNEL
) {
63 this.nicklist
= new Element("div");
64 this.nicklist
.addClass("nicklist");
65 this.nicklist
.setStyle("bottom", (bottompos
- 1) + "px");
67 this.window
.appendChild(this.nicklist
);
68 rightpos
= this.nicklist
.getSize().x
;
70 this.topic
= new Element("div");
71 this.topic
.addClass("topic");
72 this.topic
.set("html", " ");
73 this.topic
.setStyle("right", rightpos
+ "px");
74 this.window
.appendChild(this.topic
);
76 toppos
= this.topic
.getSize().y
;
79 this.lines
.setStyle("top", toppos
+ "px");
80 this.lines
.setStyle("bottom", bottompos
+ "px");
81 this.lines
.setStyle("right", rightpos
+ "px");
82 this.lines
.addClass("lines");
84 updateNickList: function(nicks
) {
87 var n
= this.nicklist
;
89 n
.removeChild(n
.firstChild
);
91 nicks
.each(function(nick
) {
92 var e
= new Element("div");
94 e
.appendChild(document
.createTextNode(nick
));
97 updateTopic: function(topic
) {
103 t
.removeChild(t
.firstChild
);
110 this.window
.removeClass("tab-invisible");
111 this.tab
.removeClass("tab-unselected");
112 this.tab
.addClass("tab-selected");
114 deselect: function() {
117 this.window
.addClass("tab-invisible");
118 this.tab
.removeClass("tab-selected");
119 this.tab
.addClass("tab-unselected");
124 this.parentObject
.container
.removeChild(this.window
);
125 this.parentObject
.tabs
.removeChild(this.tab
);
127 addLine: function(type
, line
, colour
) {
128 var e
= new Element("div");
131 e
.setStyles({"background": colour
});
132 } else if(this.lastcolour
) {
133 e
.addClass("linestyle1");
135 e
.addClass("linestyle2");
137 this.lastcolour
= !this.lastcolour
;
139 this.parent(type
, line
, colour
, e
);
141 setHilighted: function(state
) {
145 this.tab
.addClass("tab-highlighted");
147 this.tab
.removeClass("tab-highlighted");
152 var QUI
= new Class({
154 initialize: function(parentElement
, theme
) {
155 this.parent(parentElement
, QUIWindow
, "qui");
157 this.parentElement
= parentElement
;
160 var tabheight
= this.tabs
.getSize().y
;
161 this.container
.setStyle("top", tabheight
+ "px");
163 postInitialize: function() {
164 this.outerContainer
= new Element("div");
165 this.outerContainer
.addClass("outercontainer");
166 this.parentElement
.appendChild(this.outerContainer
);
168 this.tabs
= new Element("div");
169 this.tabs
.addClass("tabbar");
170 this.outerContainer
.appendChild(this.tabs
);
172 var tester
= new Element("span");
173 this.tabs
.appendChild(tester
);
175 this.tabheight
= this.tabs
.getSize().y
;
176 this.tabs
.removeChild(tester
);
178 this.container
= new Element("div");
179 this.container
.addClass("container");
180 this.outerContainer
.appendChild(this.container
);
182 loginBox: function(callbackfn
, intialNickname
, initialChannels
) {
183 this.parent(function(options
) {
184 this.postInitialize();
186 }.bind(this), intialNickname
, initialChannels
);