From 67df3ada644af6ef34bcdcc6f707811fd0f08c47 Mon Sep 17 00:00:00 2001 From: Wolfgang Knopki <wolfgang.knopki@hft-stuttgart.de> Date: Wed, 15 Sep 2021 10:51:40 +0200 Subject: [PATCH] added cookie banner with link to HfT Datenschutz page --- css/m4lab.css | 9 +++++++++ js/headfoot.js | 26 +++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/css/m4lab.css b/css/m4lab.css index 150a0ab..d9c5c52 100644 --- a/css/m4lab.css +++ b/css/m4lab.css @@ -588,3 +588,12 @@ justify-content:space-evenly;} filter: invert(0%); color: white; } + +.cookie-banner { + position: fixed; + bottom: 0px; + left: 10%; + right: 10%; + width: 80%; + height: 20%; +} diff --git a/js/headfoot.js b/js/headfoot.js index 05e9521..5dd8e47 100755 --- a/js/headfoot.js +++ b/js/headfoot.js @@ -219,11 +219,35 @@ function foot() { containerdivrow.appendChild(m4labgrau); containerdivrow.appendChild(socialdiv); containerdivrow.appendChild(contactdiv); - + containerdiv.appendChild(containerdivrow); footerdiv.appendChild(containerdiv); + + // cookiebanner + let cookiediv = document.createElement("div"); + cookiediv.classList.add("alert", "alert-info", "alert-dismissible", "fade", "cookie-banner" ); + cookiediv.style = "text-align:center;"; + cookiediv.id="cookiediv"; + cookiediv.innerHTML="<strong>Cookie-Benachrichtigung</strong><br/> Diese Webseite nutzt technisch notwendige Session-Cookies und gegebenenfalls Cookies zur Authentifizierung. Mit der Benutzung der Webseite erklären Sie sich damit einverstanden. <br/> Weitere Informationen finden Sie in unserer <a href='https://www.hft-stuttgart.de/datenschutz'> Datenschutzerklärung </a>" + let cookiebutton = document.createElement("button"); + cookiebutton.type = "button"; + cookiebutton.classList.add("close"); + cookiebutton.setAttribute("data-dismiss", "alert"); + cookiebutton.innerHTML = "×"; + prependChild(cookiediv, cookiebutton); + + footerdiv.appendChild(cookiediv); + document.body.appendChild(footerdiv); } +function setCookieSeen(){ + if (localStorage.getItem("cookieSeen") != "shown") { + document.getElementById("cookiediv").classList.add("show"); + localStorage.setItem("cookieSeen","shown") + }; +} + head(); foot(); +setCookieSeen(); -- GitLab