]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/baseui.js
3 var WINDOW_CHANNEL
= 3;
6 Implements: [Events
, Options
],
8 appTitle: "QuakeNet Web IRC",
10 initialize: function(parentElement
, windowClass
, uiName
, options
) {
11 this.setOptions(options
);
14 this.windowArray
= [];
15 this.windowClass
= windowClass
;
16 this.parentElement
= parentElement
;
17 this.parentElement
.addClass("qwebirc");
18 this.parentElement
.addClass("qwebirc-" + uiName
);
19 this.firstClient
= false;
21 newClient: function(client
) {
22 this.windows
[client
] = {}
23 var w
= this.newWindow(client
, WINDOW_STATUS
, "Status");
25 if(!this.firstClient
) {
26 this.firstClient
= true;
27 w
.addLine("", "qwebirc v" + QWEBIRC_VERSION
);
28 w
.addLine("", "Copyright (C) 2008 Chris Porter. All rights reserved.");
29 w
.addLine("", "http://webchat.quakenet.org/");
30 w
.addLine("", "This is BETA quality software, please report bugs to slug@quakenet.org");
34 newWindow: function(client
, type
, name
) {
35 var identifier
= name
;
36 if(type
== WINDOW_STATUS
)
39 var w
= this.windows
[client
][identifier
] = new this.windowClass(this, client
, type
, name
, identifier
);
40 this.windowArray
.push(w
);
44 getActiveWindow: function() {
47 __setActiveWindow: function(window
) {
50 selectWindow: function(window
) {
52 this.active
.deselect();
53 window
.select(); /* calls setActiveWindow */
54 document
.title
= window
.name
+ " - " + this.options
.appTitle
;
56 __closed: function(window
) {
58 this.active
= undefined;
59 if(this.windowArray
.length
== 1) {
60 this.windowArray
= [];
62 var index
= this.windowArray
.indexOf(window
);
64 this.selectWindow(this.windowArray
[1]);
66 this.selectWindow(this.windowArray
[index
- 1]);
69 this.windowArray
= this.windowArray
.erase(window
);
73 delete this.windows
[window
.client
][window
.identifier
];
75 loginBox: function(callback
, initialNickname
, initialChannels
) {
77 this shouldn't be called by overriding classes!
78 some form of user input MUST be received before an
79 IRC connection is made, else users are going to get
80 tricked into getting themselves glined
83 var nick
= prompt("Nickname:", initialNickname
);
89 var chans
= prompt("Channels (seperate by comma):", initialChannels
);
90 callback({"nickname": nick
, "autojoin": chans
});