]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/baseui.js
3 var WINDOW_CHANNEL
= 3;
5 var UIWindow
= new Class({
7 initialize: function(parentObject
, client
, type
, name
, identifier
) {
8 this.parentObject
= parentObject
;
13 this.identifier
= identifier
;
15 updateNickList: function(nicks
) {
17 updateTopic: function(topic
) {
20 this.parentObject
.__closed(this);
21 this.fireEvent("close", this);
25 this.parentObject
.__setActiveWindow(this);
27 deselect: function() {
30 addLine: function(type
, line
, colour
) {
32 errorMessage: function(message
) {
33 this.addLine("", message
, "red");
38 initialize: function(parentElement
, windowClass
, uiName
) {
40 this.windowArray
= [];
41 this.windowClass
= windowClass
;
42 this.parentElement
= parentElement
;
43 this.parentElement
.addClass("qwebirc");
44 this.parentElement
.addClass("qwebirc-" + uiName
);
45 this.firstClient
= false;
47 newClient: function(client
) {
48 this.windows
[client
] = {}
49 var w
= this.newWindow(client
, WINDOW_STATUS
, "Status");
51 if(!this.firstClient
) {
52 this.firstClient
= true;
53 w
.addLine("", "qwebirc v" + QWEBIRC_VERSION
+ " -- Copyright (C) 2008 Chris Porter. All rights reserved.");
54 w
.addLine("", "http://webchat.quakenet.org/");
58 newWindow: function(client
, type
, name
) {
59 var identifier
= name
;
60 if(type
== WINDOW_STATUS
)
63 var w
= this.windows
[client
][identifier
] = new this.windowClass(this, client
, type
, name
, identifier
);
64 this.windowArray
.push(w
);
68 getActiveWindow: function() {
71 __setActiveWindow: function(window
) {
74 selectWindow: function(window
) {
76 this.active
.deselect();
77 window
.select(); /* calls setActiveWindow */
79 __closed: function(window
) {
81 this.active
= undefined;
82 if(this.windowArray
.length
== 1) {
83 this.windowArray
= [];
85 var index
= this.windowArray
.indexOf(window
);
87 this.selectWindow(this.windowArray
[1]);
89 this.selectWindow(this.windowArray
[index
- 1]);
92 this.windowArray
= this.windowArray
.erase(window
);
96 delete this.windows
[window
.client
][window
.identifier
];
98 loginBox: function(callback
) {
100 this shouldn't be called by overriding classes!
101 some form of user input MUST be received before an
102 IRC connection is made, else users are going to get
103 tricked into getting themselves glined
106 var nick
= prompt("Nickname:");
112 var chans
= prompt("Channels (seperate by comma):", "#quakenetX");
113 callback({"nickname": nick
, "autojoin": chans
});