forked from wiesner-philipp/simple-dash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
76 lines (67 loc) · 2.48 KB
/
index.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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Loading...</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" type="text/css" href="common/css/fontawesome-all.min.css" />
<link rel="stylesheet" type="text/css" href="common/css/main.css" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
</head>
<body id="homepage">
<div id="wrapper">
<div id="itemlist">
<a title="Loading..."><i class="fa-spin fas fa-spinner fa-fw"></i></a>
</div>
</div>
<script src="common/js/trianglify.min.js"></script>
<script>
var request = new XMLHttpRequest();
request.overrideMimeType("application/json");
request.open("GET", 'config.json');
request.onload = function () {
if (request.status >= 200 && request.status < 400) {
var config = JSON.parse(this.response);
console.log(config);
document.title = config.title;
var itemlistHTML = '';
for (var i = 0; i < config.items.length; i++) {
var item = config.items[i];
itemlistHTML += '<a href="'+item.link+'" title="'+item.alt+'"><i class="'+item.icon+' fa-fw"></i></a>';
}
document.getElementById("itemlist").innerHTML = itemlistHTML;
} else {
var error_text = "Error: "+request.status;
console.error(error_text);
document.title = error_text;
}
}
request.send(null);
function addTriangleTo(target) {
var dimensions = target.getClientRects()[0];
var pattern = Trianglify({
width: dimensions.width,
height: dimensions.height
});
target.style['background-image'] = 'url(' + pattern.png() + ')';
target.style['background-size'] = 'cover';
target.style['-webkit-background-size'] = 'cover';
target.style['-moz-background-size'] = 'cover';
target.style['-o-background-size'] = 'cover';
}
var resizeTimer;
window.addEventListener("resize", function () {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
addTriangleTo(homepage);
}, 400);
})
addTriangleTo(homepage);
</script>
</body>
</html>