-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.html
80 lines (74 loc) · 2.8 KB
/
site.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
<!DOCTYPE html>
<html>
<head>
<title id="pagetitle"></title>
<link rel="stylesheet" href="style.css">
<link id="ati57" rel="apple-touch-icon" sizes="57x57" href="">
<link id="ati72" rel="apple-touch-icon" sizes="72x72" href="">
<link id="ati114" rel="apple-touch-icon" sizes="114x114" href="">
<link id="ati144" rel="apple-touch-icon" sizes="144x144" href="">
<link id="pageicon" rel="icon" type="image/png" href="">
<script>
if (localStorage.id === undefined) {
localStorage.id = 'zzz';
}
var params = window.location.search.split('&');
params[0] = params[0].slice(1, params[0].length);
//params[0] => website
//params[1] => title
//params[2] => icon
//params[3] => id
//check for http or https
var protoString = params[0].split('');
if (protoString[8] + protoString[9] + protoString[10] + protoString[11] != 'http') {
console.log('website=http://' + params[0].slice(8, params[0].length));
params[0] = 'website=http://' + params[0].slice(8, params[0].length);
console.log('NO PROTOCOL GIVEN');
}
if (params[2] === "autoicon=on") {
var icon = "https://www.google.com/s2/favicons?domain_url=" + params[0].slice(8, params[0].length);
}
for (var loop = 0; loop < params.length; loop++) {
var cur = params[loop].split('');
for (var i = 0; i < cur.length; i++) {
if (cur[i] === '%') {
var hexString = cur[i + 1] + cur[i + 2];
cur.splice(i, 3, String.fromCharCode(parseInt('0x' + hexString)))
}
if (cur[i] === '+') {
cur[i] = ' ';
}
}
cur = cur.join('').split('=')[1];
params[loop] = cur;
}
if (params[2] != "on") {
var icon = params[2];
}
document.getElementById("pagetitle").innerHTML = params[1];
document.getElementById("pageicon").href = icon;
document.getElementById("ati144").href = icon;
document.getElementById("ati114").href = icon;
document.getElementById("ati72").href = icon;
document.getElementById("ati57").href = icon;
if (localStorage.id.split(',').indexOf(params[3]) != -1) {
window.location = params[0];
}
else if (document.cookie.split(',').indexOf(params[3]) != -1) {
window.location = params[0];
}
function added() {
var lArray = localStorage.id.split(',');
lArray.push(params[3]);
localStorage.id = lArray.join(',');
location.reload();
}
</script>
</head>
<body>
<h1>Add this page to your home screen</h1>
<h2>Next, click the button below:</h2>
<a id="done" onclick="added()" class="button">I have added this to my home screen</a>
<script></script>
</body>
</html>