This repository has been archived by the owner on Mar 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwantedReasons.html
69 lines (55 loc) · 2.39 KB
/
wantedReasons.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
<!doctype html>
<html lang="de">
<head>
<title>Wanted Reasons | UCA</title>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=chrome">
<link rel="shortcut icon" href="common/img/UCLogo_new.png" type="image/x-icon">
<link rel="stylesheet" href="common/css/master.css">
<link rel="stylesheet" href="common/css/font.css">
<script src="common/js/master.js" async></script>
</head>
<body>
<nav id="nav"></nav>
<video autoplay muted loop id="backgroundVideo">
<source src="common/img/UnicacityAddonWebsiteBackground.mp4" type="video/mp4">
</video>
<div class="wantedReasons">
<p class="text-50-700">Wanted Reasons</p>
<div id="content"></div>
</div>
<div id="footer"></div>
</body>
</html>
<script>
async function fetchAndDisplayContent() {
try {
const response = await fetch('https://rettichlp.de:8443/unicacityaddon/v1/dhgpsklnag2354668ec1d905xcv34d9bdee4b877/wantedreason');
const json = await response.json();
let count = 0;
const contentElement = document.getElementById("content");
json.forEach(entry => {
const reason = entry.reason.replace("-", " ");
const points = entry.points;
const color = count++ % 2 === 1 ? "rgba(0, 0, 0, 0.5)" : "";
const wantedReasonsFlexBar = document.createElement('div');
wantedReasonsFlexBar.classList.add('wantedReasons-flexBar');
wantedReasonsFlexBar.style.backgroundColor = color;
wantedReasonsFlexBar.style.padding = '0 10px';
const reasonElement = document.createElement('div');
reasonElement.classList.add('text-20-300');
reasonElement.textContent = reason;
const pointsElement = document.createElement('div');
pointsElement.classList.add('text-20-300');
pointsElement.textContent = points;
wantedReasonsFlexBar.appendChild(reasonElement);
wantedReasonsFlexBar.appendChild(pointsElement);
contentElement.appendChild(wantedReasonsFlexBar);
});
} catch (error) {
console.error('Cannot fetch data:', error);
}
}
</script>