From 8aecbd15c5e9a65a69ea1c3542a66e0b1e2f05e1 Mon Sep 17 00:00:00 2001 From: Jonas Leder Date: Wed, 24 Mar 2021 23:07:40 +0100 Subject: [PATCH] fix cookie notice --- js/cookie.js | 24 ++++++++++++------------ js/script.js | 2 +- package.json | 2 +- public/internal/footer.php | 5 +---- webpack.conf.js | 1 + 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/js/cookie.js b/js/cookie.js index 1bccbe7..4b4bb45 100644 --- a/js/cookie.js +++ b/js/cookie.js @@ -1,7 +1,3 @@ -function acceptCookie(){ - document.cookie = "cookieMessageHide=1"; - checkHide(); -} function getCookie(name){ var nameEQ = name + "="; @@ -14,11 +10,15 @@ function getCookie(name){ return null } -function checkHide(){ - let cookieInfo = document.getElementsByClassName("cookieinfo")[0]; - if (getCookie("cookieMessageHide") === "1"){ - cookieInfo.style.display = "none"; - } else { - cookieInfo.style.display = "block"; - } - } \ No newline at end of file +let cookieInfo = document.querySelector(".cookieinfo"); +if (getCookie("cookieMessageHide") === "1"){ + cookieInfo.style.display = "none"; +} else { + cookieInfo.style.display = "block"; +} + +document.querySelector(".cookieinfo-close").onclick = function() { + console.log("close"); + document.cookie = "cookieMessageHide=1"; + cookieInfo.style.display = "none"; +} diff --git a/js/script.js b/js/script.js index d33b42a..f1dcf14 100644 --- a/js/script.js +++ b/js/script.js @@ -1,5 +1,5 @@ -require("./burgerMenu"); require("./cookie"); +require("./burgerMenu"); require("./dialog"); require("./error"); require("./imgPreview"); diff --git a/package.json b/package.json index 6726242..f34f061 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "compile": "concurrently \"yarn css\" \"yarn js\"", "css": "sass scss/:public/css --style=compressed --no-source-map", "js": "webpack --config ./webpack.conf.js", - "watch": "concurrently \"sass --watch --style compressed scss/:public/css\" \"cd public && php -S locaLhost:1234\" \"webpack --config ./webpack.conf.js --mode development\"" + "watch": "concurrently \"sass --watch --style compressed scss/:public/css\" \"cd public && php -S locaLhost:1234\" \"webpack --config ./webpack.conf.js --mode development --watch\"" }, "devDependencies": { "@webpack-cli/init": "^1.1.3", diff --git a/public/internal/footer.php b/public/internal/footer.php index b764de2..c8e31ab 100644 --- a/public/internal/footer.php +++ b/public/internal/footer.php @@ -42,7 +42,7 @@ function getFooter(){
-
+
@@ -50,9 +50,6 @@ function getFooter(){
- EOF); diff --git a/webpack.conf.js b/webpack.conf.js index 14fcff3..b235b74 100644 --- a/webpack.conf.js +++ b/webpack.conf.js @@ -7,6 +7,7 @@ module.exports = { output: { path: path.resolve(__dirname, "public/js"), filename: "script.js", + libraryTarget: 'window' }, mode: "production" }