-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmassaBox.html
More file actions
72 lines (67 loc) · 2.25 KB
/
massaBox.html
File metadata and controls
72 lines (67 loc) · 2.25 KB
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
<body>
<div class="massa-box" id="massaBox">
<div class="massa-box-content">
<div class="massa-flex-content">
<a
class="massa-logo-link"
href="https://massa.net"
target="_blank"
onclick="document.getElementById('massaBox').classList.add('show-all')"
>
<div class="massa-logo">%s</div>
</a>
<a
class="massa-link massa-on-chain-text"
href="https://docs.massa.net/docs/deweb/home"
target="_blank"
>
<strong>hosted on chain</strong>
</a>
</div>
<div class="massa-flex-content">
<a class="massa-link" href="%s" target="_blank">%s</a>
<div class="deweb-version">%s</div>
</div>
</div>
<button class="hide-button" id="closeMassaBoxBtn">×</button>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
function checkIfClosed() {
const isClosed = localStorage.getItem("massaBoxClosed");
const massaBox = document.getElementById("massaBox");
if (isClosed === "true") {
return;
}
// Check if banner should be hidden based on server response
fetch(window.location.origin + "/__deweb_info")
.then(response => response.json())
.then(data => {
if (data.noBanner) {
localStorage.setItem("massaBoxClosed", "true");
} else {
massaBox.style.display = "flex";
}
})
.catch(error => {
console.log("Could not fetch deweb info:", error);
// If we can't fetch the deweb info, show the banner by default
massaBox.style.display = "flex";
});
}
// Function to close the element and save the state in local storage
function closeMassaBox() {
const massaBox = document.getElementById("massaBox");
if (massaBox) {
massaBox.style.display = "none";
localStorage.setItem("massaBoxClosed", "true");
}
}
checkIfClosed();
const closeButton = document.getElementById("closeMassaBoxBtn");
if (closeButton) {
closeButton.addEventListener("click", closeMassaBox);
}
});
</script>
</body>