]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/baseui.js
3 var WINDOW_CHANNEL
= 3;
6 initialize: function(parentElement
, windowClass
, uiName
) {
9 this.windowClass
= windowClass
;
10 this.parentElement
= parentElement
;
11 this.parentElement
.addClass("qwebirc");
12 this.parentElement
.addClass("qwebirc-" + uiName
);
13 this.firstClient
= false;
15 newClient: function(client
) {
16 this.windows
[client
] = {}
17 var w
= this.newWindow(client
, WINDOW_STATUS
, "Status");
19 if(!this.firstClient
) {
20 this.firstClient
= true;
21 w
.addLine("", "qwebirc v" + QWEBIRC_VERSION
+ " -- Copyright (C) 2008 Chris Porter. All rights reserved.");
22 w
.addLine("", "http://webchat.quakenet.org/");
26 newWindow: function(client
, type
, name
) {
27 var identifier
= name
;
28 if(type
== WINDOW_STATUS
)
31 var w
= this.windows
[client
][identifier
] = new this.windowClass(this, client
, type
, name
, identifier
);
32 this.windowArray
.push(w
);
36 getActiveWindow: function() {
39 __setActiveWindow: function(window
) {
42 selectWindow: function(window
) {
44 this.active
.deselect();
45 window
.select(); /* calls setActiveWindow */
47 __closed: function(window
) {
49 this.active
= undefined;
50 if(this.windowArray
.length
== 1) {
51 this.windowArray
= [];
53 var index
= this.windowArray
.indexOf(window
);
55 this.selectWindow(this.windowArray
[1]);
57 this.selectWindow(this.windowArray
[index
- 1]);
60 this.windowArray
= this.windowArray
.erase(window
);
64 delete this.windows
[window
.client
][window
.identifier
];
66 loginBox: function(callback
, initialNickname
, initialChannels
) {
68 this shouldn't be called by overriding classes!
69 some form of user input MUST be received before an
70 IRC connection is made, else users are going to get
71 tricked into getting themselves glined
74 var nick
= prompt("Nickname:", initialNickname
);
80 var chans
= prompt("Channels (seperate by comma):", initialChannels
);
81 callback({"nickname": nick
, "autojoin": chans
});