Skip to content

Commit 5e4e051

Browse files
authored
Update index.html
1 parent 9e5a532 commit 5e4e051

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

index.html

+44
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@
1010
<!-- Google AdSense -->
1111
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3309273645696464"
1212
crossorigin="anonymous"></script>
13+
14+
<style>
15+
/* Cookie banner styling */
16+
#cookie-banner {
17+
position: fixed;
18+
bottom: 0;
19+
width: 100%;
20+
background-color: #333;
21+
color: white;
22+
text-align: center;
23+
padding: 10px;
24+
display: none;
25+
z-index: 1000;
26+
}
27+
#cookie-banner button {
28+
background-color: #4CAF50;
29+
color: white;
30+
padding: 5px 10px;
31+
border: none;
32+
cursor: pointer;
33+
}
34+
</style>
1335
</head>
1436
<body>
1537
<nav>
@@ -45,9 +67,31 @@ <h1>Welcome to Our School SMP!</h1>
4567
<p>Powered by School SMP</p>
4668
</footer>
4769

70+
<!-- Cookie consent banner -->
71+
<div id="cookie-banner">
72+
<p>We use cookies to improve your experience. By continuing to use this site, you agree to our use of cookies.
73+
<button id="accept-cookies">Accept</button>
74+
</p>
75+
</div>
76+
4877
<script>
78+
// Function to check if cookies have been accepted
79+
function checkCookieConsent() {
80+
if (!localStorage.getItem('cookiesAccepted')) {
81+
document.getElementById('cookie-banner').style.display = 'block';
82+
}
83+
}
84+
85+
// Function to handle the acceptance of cookies
86+
document.getElementById('accept-cookies').addEventListener('click', function() {
87+
localStorage.setItem('cookiesAccepted', 'true'); // Store cookie consent in localStorage
88+
document.getElementById('cookie-banner').style.display = 'none'; // Hide the banner
89+
});
90+
91+
// Check cookie consent status on page load
4992
window.onload = function () {
5093
showProfileBar(); // Display profile bar if logged in
94+
checkCookieConsent(); // Check cookie consent status
5195
};
5296

5397
if ('serviceWorker' in navigator) {

0 commit comments

Comments
 (0)