added cookie info to actaddmanual too
This commit is contained in:
parent
b444258f77
commit
f8154dc051
6 changed files with 41 additions and 32 deletions
|
@ -30,7 +30,11 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="sidebar"></div>
|
<div id="sidebar"></div>
|
||||||
<div id="entries"></div>
|
<div id="entries">
|
||||||
|
<!-- Cookie notification -->
|
||||||
|
<script src="../scripts/cookies.js"></script>
|
||||||
|
<script src="../scripts/cookieinfo.js"></script>
|
||||||
|
</div>
|
||||||
<script src="index.js"></script>
|
<script src="index.js"></script>
|
||||||
|
|
||||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
||||||
|
|
|
@ -26,6 +26,12 @@ body {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.alert {
|
||||||
|
width: 90%;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
#entries {
|
#entries {
|
||||||
margin-left: 300px;
|
margin-left: 300px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/prettify.js"></script>
|
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/prettify.js"></script>
|
||||||
|
<script src="scripts/cookies.js"></script>
|
||||||
<script src="scripts/main.js"></script>
|
<script src="scripts/main.js"></script>
|
||||||
|
|
||||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
|
@ -79,7 +80,7 @@
|
||||||
<!-- Content -->
|
<!-- Content -->
|
||||||
<div class="container main">
|
<div class="container main">
|
||||||
<!-- Cookie notification -->
|
<!-- Cookie notification -->
|
||||||
<script src="scripts/cookies.js"></script>
|
<script src="scripts/cookieinfo.js"></script>
|
||||||
|
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<!-- NOBLOG -->
|
<!-- NOBLOG -->
|
||||||
|
|
15
scripts/cookieinfo.js
Normal file
15
scripts/cookieinfo.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
if (getCookie("notification") !== "true") {
|
||||||
|
let notif = "";
|
||||||
|
notif += '<div class="alert alert-danger alert-dismissible fade show" role="alert">';
|
||||||
|
notif += "This site uses cookies to store information about your browsing activity.";
|
||||||
|
notif += "<br>For more information, check out the <a href=\"#privacy\">privacy policy</a>.";
|
||||||
|
notif += "<br>Have a nice day!";
|
||||||
|
notif += '<button type="button" class="close" data-dismiss="alert" id="notif-close">';
|
||||||
|
notif += '<span>×</span>';
|
||||||
|
notif += '</button></div>';
|
||||||
|
document.write(notif);
|
||||||
|
|
||||||
|
$("#notif-close").on("click", function () {
|
||||||
|
setCookie("notification", "true", 365);
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,15 +1,14 @@
|
||||||
if (cookieNotification) {
|
function getCookie(key) {
|
||||||
let notif = "";
|
let c = document.cookie;
|
||||||
notif += '<div class="alert alert-danger alert-dismissible fade show" role="alert">';
|
if (!c)
|
||||||
notif += "This site uses cookies to store information about your browsing activity.";
|
return undefined;
|
||||||
notif += "<br>For more information, check out the <a href=\"#privacy\">privacy policy</a>.";
|
let start = c.indexOf(key + "=") + key.length + 1;
|
||||||
notif += "<br>Have a nice day!";
|
let end = c.indexOf(";", start);
|
||||||
notif += '<button type="button" class="close" data-dismiss="alert" id="notif-close">';
|
return c.substring(start, end < 0 ? c.length : end);
|
||||||
notif += '<span>×</span>';
|
}
|
||||||
notif += '</button></div>';
|
|
||||||
document.write(notif);
|
function setCookie(key, value, days) {
|
||||||
|
var date = new Date();
|
||||||
$("#notif-close").on("click", function () {
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||||
setCookie("notification", "true", 365);
|
document.cookie = key + "=" + value + "; expires=" + date.toUTCString();
|
||||||
});
|
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
let dark = getCookie("dark") === "true";
|
let dark = getCookie("dark") === "true";
|
||||||
let cookieNotification = getCookie("notification") !== "true";
|
|
||||||
let pride = new Date().getMonth() == 5;
|
let pride = new Date().getMonth() == 5;
|
||||||
|
|
||||||
if (dark) {
|
if (dark) {
|
||||||
|
@ -40,18 +39,3 @@ $(function () {
|
||||||
|
|
||||||
PR.prettyPrint();
|
PR.prettyPrint();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getCookie(key) {
|
|
||||||
let c = document.cookie;
|
|
||||||
if (!c)
|
|
||||||
return undefined;
|
|
||||||
let start = c.indexOf(key + "=") + key.length + 1;
|
|
||||||
let end = c.indexOf(";", start);
|
|
||||||
return c.substring(start, end < 0 ? c.length : end);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCookie(key, value, days) {
|
|
||||||
var date = new Date();
|
|
||||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
||||||
document.cookie = key + "=" + value + "; expires=" + date.toUTCString();
|
|
||||||
}
|
|
Loading…
Reference in a new issue