forked from leowinterde/TS3ServerStatusViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathts3ssv.js
28 lines (23 loc) · 956 Bytes
/
ts3ssv.js
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
// https://github.com/LeoWinterDE/TS3ServerStatusViewer
function ts3ssvconnect(id, channel)
{
var id = "ts3ssv-" + id;
var hostport = document.getElementById(id + "-hostport").value;
var nickname = document.getElementById(id + "-nickname");
var password = document.getElementById(id + "-password");
var command = "ts3server://" + hostport.replace(":", "?port=");
var dateExpire = new Date;
dateExpire.setMonth(dateExpire.getMonth()+1);
if(channel != null){
command += "&cid=" + channel;
}
if(nickname != null && nickname.value != ""){
command += "&nickname=" + escape(nickname.value);
document.cookie = id + "-nickname=" + escape(nickname.value) + "; expires=" + dateExpire.toGMTString();
}
if(password != null && password.value != ""){
command += "&password=" + escape(password.value);
document.cookie = id + "-password=" + escape(password.value) + "; expires=" + dateExpire.toGMTString();
}
(window.open(command)).close();
}