Skip to content

Commit 75cec4a

Browse files
authored
Index.html Cookie Banner
1 parent daa0639 commit 75cec4a

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

JavaDiscord/index.html

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-T3DK8F7FPD"></script>
5+
<script>
6+
window.dataLayer = window.dataLayer || [];
7+
function gtag(){dataLayer.push(arguments);}
8+
gtag('js', new Date());
9+
10+
gtag('config', 'G-T3DK8F7FPD');
11+
</script>
412
<meta charset="UTF-8">
513
<meta http-equiv="X-UA-Compatible" content="IE=edge">
614
<meta name="description" content="With over 2,000 Members and 20,000 Messages sent each month, join one of the biggest Java Communities to help, get help and discuss programming in Java."/>
@@ -52,6 +60,19 @@ <h1>HELP.<br>CODE.<br>LEARN.</h1>
5260
<p>&copy 2021 JavaDiscord | JavaDiscord is not affiliated, associated, or endorsed with/by Discord or Oracle</p>
5361
</div>
5462
</footer>
63+
<!-- Cookie-Banner -->
64+
<div class="cookie-container">
65+
<div class="cookie-content">
66+
<h2 id="cookie-policy">Cookie policy</h2>
67+
<p>
68+
We are using cookies to analyse traffic on this website.
69+
You accept the use of cookies by closing or dismissing this message, scrolling the page, clicking a link/button or by continuing to browse in any way.
70+
</p>
71+
</div>
72+
<div class="cookie-links">
73+
<a href="#" id="got-it-btn" class="cookie-btn">Got it!</a>
74+
</div>
75+
</div>
5576
<!-- JS -->
5677
<script type="text/javascript">
5778
// Hamburger menu
@@ -69,6 +90,21 @@ <h1>HELP.<br>CODE.<br>LEARN.</h1>
6990
var navbar = document.getElementById("navbar");
7091
navbar.classList.toggle("navbar-scrolling", window.scrollY > 0);
7192
});
93+
94+
// Cookie
95+
const cookieContainer = document.querySelector(".cookie-container");
96+
const cookieButton = document.querySelector(".cookie-btn");
97+
98+
cookieButton.addEventListener("click", () => {
99+
cookieContainer.classList.remove("active");
100+
localStorage.setItem("cookieContainerDisplayed", "true");
101+
});
102+
103+
setTimeout(() => {
104+
if (!localStorage.getItem("cookieContainerDisplayed")) {
105+
cookieContainer.classList.add("active")
106+
}
107+
}, 1000);
72108
</script>
73109
</body>
74-
</html>
110+
</html>

0 commit comments

Comments
 (0)