]>
jfr.im git - irc/quakenet/qwebirc.git/blob - static/js/ui/uglyui.js
76274bd03344895e303abe4e25d383d6f7105809
1 var UglyUIWindow
= new Class({
4 initialize: function(parentObject
, client
, type
, name
) {
5 this.parent(parentObject
, client
, type
, name
);
7 this.outerContainer
= new Element("div", { "styles": { "display": "none", "font-family": "Lucida Console" } });
8 parentObject
.container
.appendChild(this.outerContainer
);
10 if(type
== WINDOW_CHANNEL
) {
11 this.nicklist
= new Element("div", {"styles": { "border-left": "1px solid black", "width": "125px", "float": "right", "height": "480px", "clear": "both", "overflow": "auto", "background": "white"} });
12 this.outerContainer
.appendChild(this.nicklist
);
15 var innerContainer
= new Element("div", {"styles": { "height": "480px" }});
16 this.outerContainer
.appendChild(innerContainer
);
18 if(type
== WINDOW_CHANNEL
) {
19 this.topic
= new Element("div", {"styles": { "background": "#fef", "height": "20px" } });
20 innerContainer
.appendChild(this.topic
);
23 this.lines
= new Element("div", {"styles": { "height": "460px", "overflow": "auto", "word-wrap": "break-word" }});
24 innerContainer
.appendChild(this.lines
);
26 this.tab
= new Element("span", {"styles": { "border": "1px black solid", "padding": "2px", "cursor": "default", "margin-right": "2px", "background": "#eee", "clear": "both" } });
27 this.tab
.appendText(name
);
28 this.tab
.addEvent("click", function() {
29 parentObject
.selectWindow(this);
32 parentObject
.tabs
.appendChild(this.tab
);
34 if(type
!= WINDOW_STATUS
) {
35 tabclose
= new Element("span", {"styles": { "border": "1px black solid", "margin-left": "5px", "padding": "2px", "font-size": "0.5em" } });
36 tabclose
.addEvent("click", function(e
) {
39 if(type
== WINDOW_CHANNEL
)
40 this.client
.dispatch("/PART " + name
);
44 tabclose
.set("text", "X");
45 this.tab
.appendChild(tabclose
);
48 updateNickList: function(nicks
) {
51 var n
= this.nicklist
;
53 n
.removeChild(n
.firstChild
);
55 forEach(nicks
, function(nick
) {
56 var e
= new Element("div");
58 e
.appendChild(document
.createTextNode(nick
));
61 updateTopic: function(topic
) {
67 t
.removeChild(t
.firstChild
);
74 this.outerContainer
.setStyle("display", "block");
75 this.tab
.setStyle("background", "#dff");
76 this.tab
.setStyle("color", "");
78 deselect: function() {
81 this.outerContainer
.setStyle("display", "none");
82 this.tab
.setStyle("background", "#eee");
87 this.parentObject
.container
.removeChild(this.outerContainer
);
88 this.parentObject
.tabs
.removeChild(this.tab
);
90 addLine: function(type
, line
, colour
) {
91 this.parent(type
, line
, colour
);
96 } else if(this.lastcolour
) {
102 var e
= new Element("div", { "styles": { "background": c
} });
104 line
= this.parentObject
.theme
.message(type
, line
);
106 colourise(timestamp() + " " + line
, e
);
107 this.lines
.appendChild(e
);
109 this.lastcolour
= !this.lastcolour
;
113 var UglyUI
= new Class({
115 initialize: function(parentElement
, theme
) {
116 this.parent(UglyUIWindow
);
118 this.parentElement
= parentElement
;
121 this.tabs
= new Element("div", {"styles": { "border": "1px solid black", "padding": "4px", "font-family": "Lucida Console" } });
122 parentElement
.appendChild(this.tabs
);
124 this.container
= new Element("div", {"styles": { "border": "1px solid black", "margin": "2px 0px 0px 0px", "height": "480px" } });
125 parentElement
.appendChild(this.container
);
127 var form
= new Element("form");
128 var inputbox
= new Element("input", {"styles": { "width": "400px", "border": "1px solid black", "margin": "2px 0px 0px 0px"} });
130 form
.addEvent("submit", function(e
) {
133 this.getActiveWindow().client
.dispatch(inputbox
.value
);
136 parentElement
.appendChild(form
);
137 form
.appendChild(inputbox
);