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
132
133
134
135
136
137
|
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="styles/icofont.css">
<link rel="icon" sizes="32x32" href="images/wc-icon-32.png">
<link rel="icon" sizes="48x48" href="images/wc-icon-48.png">
<link rel="icon" sizes="96x96" href="images/wc-icon-96.png">
<link rel="icon" sizes="144x144" href="images/wc-icon-144.png">
<link rel="icon" sizes="288x288" href="images/wc-icon-288.png">
<link rel="stylesheet" type="text/css" href="styles/home/base.css">
<link rel="stylesheet" type="text/css" href="styles/home/desktop.css">
<link rel="stylesheet" type="text/css" href="styles/home/mobile.css">
<link rel="stylesheet" type="text/css" href="styles/input.css">
<link id="theme" rel="stylesheet" type="text/css" href="styles/themes/colors-base.css">
<script src="scripts/gui/input.js"></script>
<script src="scripts/cookie.js"></script>
<script src="scripts/theme.js"></script>
<title>WebCards</title>
</head>
<body>
<div class="content">
<p style="font-size: 30px; font-weight: normal;">Web<span style="color: #0084ff; font-weight: bold;">Cards</span></p>
<div id="options">
</div>
<button id="conn" onclick="connect()">Connect</button>
<div id="prev" class="prev">
</div>
<a style="border: none; padding: 0; display: contents; margin: 0;" href="http://vanilla-js.com/"><img src="images/vanilla.png"></a>
</div>
<script>
var prev = Cookies.getCookie("prevAddr");
var prevEl = document.getElementById("prev");
function hasAddr(url) {
let urls = prev.split(",");
for(let i in urls)
{
if(urls[i] == url)
return true;
}
return false;
}
function addAddr(url) {
if(hasAddr(url))
return;
if(prev != "")
prev = prev + "," + url;
else
prev = url;
Cookies.setYearCookie("prevAddr", prev);
}
function delAddr(el, btn) {
let url = el.innerText;
let urls = prev.split(",");
urls.splice(urls.indexOf(url), 1);
Cookies.setCookie("prevAddr", urls.join());
el.remove();
btn.remove();
prev = Cookies.getCookie("prevAddr");
}
let urls = prev.split(",");
for(let i in urls) {
if(urls[i] == "")
continue;
let a = document.createElement("a");
a.innerText = urls[i];
a.href = "client.html?s=" + urls[i] + "&g=-1";
let b = document.createElement("button");
b.innerText = "X";
b.onclick = delAddr.bind(null, a, b);
prevEl.appendChild(a);
prevEl.append(b);
}
</script>
<script>
const Options = [
{
type: "select",
args: [["wss://", "ws://"], ["WSS", "WS"]],
title: "Protocol"
},
{
type: "text",
args: ["localhost", ""],
title: "Server URL"
},
{
type: "number",
args: [4040],
title: "Server Port"
}
];
var optionsEL = document.getElementById("options");
var options = new Settings(Options);
options.putSettings(optionsEL);
function connect() {
let serverParts = options.getSettings();
let concat = serverParts[0] + serverParts[1] + ":" + serverParts[2];
addAddr(concat);
//c.setAttribute("href", url);
window.location = "client.html?s=" + concat + "&g=-1";
}
</script>
</body>
</html>
|