|
10 | 10 | <!-- Google AdSense -->
|
11 | 11 | <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3309273645696464"
|
12 | 12 | 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> |
13 | 35 | </head>
|
14 | 36 | <body>
|
15 | 37 | <nav>
|
@@ -45,9 +67,31 @@ <h1>Welcome to Our School SMP!</h1>
|
45 | 67 | <p>Powered by School SMP</p>
|
46 | 68 | </footer>
|
47 | 69 |
|
| 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 | + |
48 | 77 | <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 |
49 | 92 | window.onload = function () {
|
50 | 93 | showProfileBar(); // Display profile bar if logged in
|
| 94 | + checkCookieConsent(); // Check cookie consent status |
51 | 95 | };
|
52 | 96 |
|
53 | 97 | if ('serviceWorker' in navigator) {
|
|
0 commit comments