-
Notifications
You must be signed in to change notification settings - Fork 0
/
joingroupchat.html
131 lines (108 loc) · 4.32 KB
/
joingroupchat.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JWChat - Join group chat</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script src="shared.js" language="JavaScript1.2"></script>
<script src="switchStyle.js"></script>
<script language="JavaScript1.2">
<!--
var jid;
var srcW; // the source window with necessary data
function doSub() {
var nick = (document.forms[0].nick.value!='')?document.forms[0].nick.value:srcW.roster.nick;
if (document.forms[0].group.value == '') {
alert("Please enter a channel/group to join");
return false;
}
if (document.forms[0].server.value == '') {
alert("Please enter a server name");
return false;
}
var pass = document.forms[0].pass.value;
var group = document.forms[0].group.value+"@"+document.forms[0].server.value;
srcW.openGroupchat(group,nick,pass);
window.close();
return false;
}
function bookmark_selected(el) {
var bookmark = srcW.bookmarks[el.options[el.selectedIndex].value];
document.forms[0].nick.value = bookmark.nick;
document.forms[0].group.value = bookmark.jid.substring(0,bookmark.jid.indexOf('@'));
document.forms[0].server.value = bookmark.jid.substring(bookmark.jid.indexOf('@')+1);
if (typeof(bookmark.pass) != 'undefined')
document.forms[0].pass.value = bookmark.pass;
return false;
}
function updateBookmarks() {
var bookmark_selector = document.getElementById('bookmark_selector');
var optidx = 1;
// clear list - don't remove first
for (var i=1; i<bookmark_selector.options.length; i++)
bookmark_selector.options[i] = null;
// fill from global arr
if (srcW.bookmarks) {
for (var i=0; i<srcW.bookmarks.length; i++)
bookmark_selector.options[optidx++] = new Option(srcW.bookmarks[i].name,i);
}
}
var srw;
function openSearchRooms() {
if (!srw || srw.closed)
srw = open("searchrooms.html","srw"+makeWindowName(srcW.jid),"width=400,height=300,resizable=yes");
srw.focus();
return false;
}
function init() {
// determine source window
if (opener.top.roster)
srcW = opener.top;
if (typeof(srcW.DEFAULTCONFERENCESERVER) != 'undefined' && srcW.DEFAULTCONFERENCESERVER != '')
document.forms[0].server.value = srcW.DEFAULTCONFERENCESERVER;
if (typeof(srcW.DEFAULTCONFERENCEROOM) != 'undefined' && srcW.DEFAULTCONFERENCEROOM != '')
document.forms[0].group.value = srcW.DEFAULTCONFERENCEROOM;
document.forms[0].nick.value = srcW.nick;
updateBookmarks();
}
function cleanUp() {
if (srw && !srw.closed)
srw.close();
}
function keyPressed(e) {
if (e.keyCode == 13)
return doSub();
if (e.keyCode == 27)
window.close();
return true;
}
onkeydown = keyPressed;
onload = init;
onunload = cleanUp;
//-->
</script>
<script for="document" event="onkeydown()" language="JScript">
<!--
if (window.event)
return keyPressed(window.event);
//-->
</script>
</head>
<body style="margin:8px;">
<form name="sub" onsubmit="return doSub();">
<table border="0" width="100%">
<tr><td colspan="2">Search for Rooms <button onClick="return openSearchRooms();">Open Search</button></td></tr>
<tr><td colspan="2"><hr noshade size="1"></td></tr>
<tr><td>Bookmark</td><td><select id="bookmark_selector" onChange="return bookmark_selected(this);"><option value=""> - Choose Bookmark - </option></select> <button onClick="return srcW.openEditBookmarks();">Edit</button></td></tr>
<tr><td colspan="2"><hr noshade size="1"></td></tr>
<tr style="display:none;"><td nowrap>Nickname</td><td width="100%"><input type="text" name="nick" size="32" style="width:100%;"></td></tr>
<tr><td nowrap>Room</td><td width="100%"><input type="text" name="group" size="32" style="width:100%;"></td></tr>
<tr style="display:none;"><td nowrap>Server</td><td width="100%"><input type="text" name="server" size="32" style="width:100%;"></td></tr>
<tr style="display:none;"><td nowrap>Password</td><td width="100%"><input type="text" name="pass" size="32" style="width:100%;"></td></tr>
</table>
<hr noshade size="1" size="100%">
<div align="right" id="buttonbox">
<button type="button" onClick="window.close();">Cancel</button> <button type="submit">Join</button>
</div>
</form>
</body>
</html>