]>
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
);
22 w
.addLine("", "Copyright (C) 2008 Chris Porter. All rights reserved.");
23 w
.addLine("", "http://webchat.quakenet.org/");
24 w
.addLine("", "This is BETA quality software, please report bugs to slug@quakenet.org");
28 newWindow: function(client
, type
, name
) {
29 var identifier
= name
;
30 if(type
== WINDOW_STATUS
)
33 var w
= this.windows
[client
][identifier
] = new this.windowClass(this, client
, type
, name
, identifier
);
34 this.windowArray
.push(w
);
38 getActiveWindow: function() {
41 __setActiveWindow: function(window
) {
44 selectWindow: function(window
) {
46 this.active
.deselect();
47 window
.select(); /* calls setActiveWindow */
49 __closed: function(window
) {
51 this.active
= undefined;
52 if(this.windowArray
.length
== 1) {
53 this.windowArray
= [];
55 var index
= this.windowArray
.indexOf(window
);
57 this.selectWindow(this.windowArray
[1]);
59 this.selectWindow(this.windowArray
[index
- 1]);
62 this.windowArray
= this.windowArray
.erase(window
);
66 delete this.windows
[window
.client
][window
.identifier
];
68 loginBox: function(callback
, initialNickname
, initialChannels
) {
70 this shouldn't be called by overriding classes!
71 some form of user input MUST be received before an
72 IRC connection is made, else users are going to get
73 tricked into getting themselves glined
76 var nick
= prompt("Nickname:", initialNickname
);
82 var chans
= prompt("Channels (seperate by comma):", initialChannels
);
83 callback({"nickname": nick
, "autojoin": chans
});