]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/swmui.js
1 qwebirc
.ui
.SWMUI
= new Class({
2 Extends: qwebirc
.ui
.NewLoginUI
,
3 initialize: function(parentElement
, theme
) {
4 this.parent(parentElement
, qwebirc
.ui
.SWMUI
.Window
, "swmui");
6 this.parentElement
= parentElement
;
9 postInitialize: function() {
10 this.rootFrame
= new qwebirc
.ui
.SWMUI
.Frame(this.parentElement
);
12 this.tabPanel
= new qwebirc
.ui
.SWMUI
.Panel(this.rootFrame
);
13 this.tabPanel
.anchor
= qwebirc
.ui
.SWMUI
.SWM_ANCHOR_TOP
;
14 this.tabPanel
.addClass("tabs");
16 this.mainPanel
= new qwebirc
.ui
.SWMUI
.Panel(this.rootFrame
);
17 this.mainPanel
.addClass("main");
19 this.entryPanel
= new qwebirc
.ui
.SWMUI
.Panel(this.rootFrame
);
20 this.entryPanel
.anchor
= qwebirc
.ui
.SWMUI
.SWM_ANCHOR_BOTTOM
;
21 this.entryPanel
.addClass("entry");
23 var form
= new Element("form");
25 var inputbox
= new Element("input");
26 inputbox
.setStyle("border", "0px");
28 window
.addEvent("resize", function() {
29 var s
= this.entryPanel
.getInnerSize().x
;
30 inputbox
.setStyle("width", s
+ "px");
33 form
.addEvent("submit", function(e
) {
36 this.getActiveWindow().client
.exec(inputbox
.value
);
40 this.entryPanel
.appendChild(form
);
41 form
.appendChild(inputbox
);
46 showInput: function(state
) {
47 this.entryPanel
.setHidden(state
);
51 window
.fireEvent("resize");
55 qwebirc
.ui
.SWMUI
.Window
= new Class({
56 Extends: qwebirc
.ui
.Window
,
58 initialize: function(parentObject
, client
, type
, name
) {
59 this.parent(parentObject
, client
, type
, name
);
60 this.contentPanel
= new qwebirc
.ui
.SWMUI
.Panel(parentObject
.mainPanel
, true);
61 this.contentPanel
.addClass("content");
63 if(type
== qwebirc
.ui
.WINDOW_CHANNEL
) {
64 this.nickList
= new qwebirc
.ui
.SWMUI
.Panel(this.contentPanel
);
65 this.nickList
.anchor
= qwebirc
.ui
.SWMUI
.SWM_ANCHOR_RIGHT
;
66 this.nickList
.addClass("nicklist");
68 this.topic
= new qwebirc
.ui
.SWMUI
.Panel(this.contentPanel
);
69 this.topic
.anchor
= qwebirc
.ui
.SWMUI
.SWM_ANCHOR_TOP
;
70 this.topic
.addClass("topic");
73 this.xlines
= new qwebirc
.ui
.SWMUI
.Panel(this.contentPanel
);
74 this.lines
= this.xlines
.element
;
76 this.tab
= new Element("span");
77 this.tab
.addClass("tab");
79 this.tab
.appendText(name
);
80 this.tab
.addEvent("click", function() {
81 parentObject
.selectWindow(this);
84 parentObject
.tabPanel
.appendChild(this.tab
);
85 parentObject
.resize();
87 if(type
!= qwebirc
.ui
.WINDOW_STATUS
&& type
!= qwebirc
.ui
.WINDOW_CONNECT
) {
88 tabclose
= new Element("span");
89 tabclose
.addClass("tabclose");
90 tabclose
.addEvent("click", function(e
) {
93 if(type
== qwebirc
.ui
.WINDOW_CHANNEL
)
94 this.client
.exec("/PART " + name
);
98 tabclose
.set("text", "X");
99 this.tab
.appendChild(tabclose
);
102 updateNickList: function(nicks
) {
105 this.nickList
.removeAllChildren();
106 nicks
.each(function(nick
) {
107 var e
= new Element("div");
108 this.nickList
.appendChild(e
);
109 e
.appendChild(document
.createTextNode(nick
));
112 this.parentObject
.resize();
114 updateTopic: function(topic
) {
117 this.topic
.removeAllChildren();
118 Colourise(topic
, this.topic
.element
);
120 this.parentObject
.resize();
125 this.contentPanel
.setHidden(false);
126 this.parentObject
.resize();
127 this.tab
.removeClass("tab-unselected");
128 this.tab
.addClass("tab-selected");
129 this.parentObject
.showInput(this.type
== qwebirc
.ui
.WINDOW_CONNECT
|| this.type
== qwebirc
.ui
.WINDOW_CUSTOM
);
131 deselect: function() {
134 this.contentPanel
.setHidden(true);
135 this.parentObject
.resize();
136 this.tab
.removeClass("tab-selected");
137 this.tab
.addClass("tab-unselected");
142 this.parentObject
.mainPanel
.removeChild(this.contentPanel
.element
);
143 this.parentObject
.tabPanel
.removeChild(this.tab
);
145 addLine: function(type
, line
, colour
) {
146 var e
= new Element("div");
149 e
.setStyles({"background": colour
});
150 } else if(this.lastcolour
) {
151 e
.addClass("linestyle1");
153 e
.addClass("linestyle2");
156 this.lastcolour
= !this.lastcolour
;
158 this.parent(type
, line
, colour
, e
);
160 setHilighted: function(state
) {
164 this.tab
.addClass("tab-highlighted");
166 this.tab
.removeClass("tab-highlighted");