]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/uglyui.js
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
.exec("/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 nicks
.each(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(IRCTimestamp(new Date()) + " " + line
, e
);
108 this.lastcolour
= !this.lastcolour
;
110 var prev
= this.lines
.getScroll();
111 var prevbottom
= this.lines
.getScrollSize().y
;
112 var prevsize
= this.lines
.getSize();
113 this.lines
.appendChild(e
);
115 if(prev
.y
+ prevsize
.y
== prevbottom
)
116 this.lines
.scrollTo(prev
.x
, this.lines
.getScrollSize().y
);
119 this.tab
.setStyle("color", "red");
123 var UglyUI
= new Class({
125 initialize: function(parentElement
, theme
) {
126 this.parent(UglyUIWindow
);
128 this.parentElement
= parentElement
;
131 this.tabs
= new Element("div", {"styles": { "border": "1px solid black", "padding": "4px", "font-family": "Lucida Console" } });
132 parentElement
.appendChild(this.tabs
);
134 this.container
= new Element("div", {"styles": { "border": "1px solid black", "margin": "2px 0px 0px 0px", "height": "480px" } });
135 parentElement
.appendChild(this.container
);
137 var form
= new Element("form");
138 var inputbox
= new Element("input", {"styles": { "width": "400px", "border": "1px solid black", "margin": "2px 0px 0px 0px"} });
140 form
.addEvent("submit", function(e
) {
143 this.getActiveWindow().client
.exec(inputbox
.value
);
146 parentElement
.appendChild(form
);
147 form
.appendChild(inputbox
);