Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/themefisher/liva-hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsomratpro <abdulmonnafsomrat@gmail.com>2020-10-18 10:44:01 +0300
committersomratpro <abdulmonnafsomrat@gmail.com>2020-10-18 10:44:01 +0300
commit9574a64e8034ad102dbe2573e7d791d5ddb6e7a1 (patch)
treed18dc037db715805a2609dc375b784965fe25d7f
parent8b05730ab0f6a0d5d1458cf473a7933f76baa10e (diff)
added js-cookies
-rw-r--r--exampleSite/config.toml7
-rw-r--r--layouts/partials/footer.html46
2 files changed, 52 insertions, 1 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 1a555bc..5ea304a 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -107,6 +107,13 @@ enable = true
title = "Join Our Newsletter"
content = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero"
+
+# cookies
+[params.cookies]
+enable = true
+expire_days = 2
+
+
############################# social site ########################
[[params.social]]
title = "facebook"
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 08d353e..262156e 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -100,4 +100,48 @@
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', '{{ .Site.Params.googleAnalitycsID }}', 'auto');
ga('send', 'pageview');
-</script> \ No newline at end of file
+</script>
+
+
+<!-- cookie -->
+{{ if site.Params.cookies.enable }}
+<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.1/js.cookie.min.js"></script>
+<div id="js-cookie-box" class="cookie-box cookie-box-hide">
+ This site uses cookies. By continuing to use this website, you agree to their use. <span id="js-cookie-button" class="btn btn-sm btn-primary ml-2">I Accept</span>
+</div>
+<script>
+ (function ($) {
+ const cookieBox = document.getElementById('js-cookie-box');
+ const cookieButton = document.getElementById('js-cookie-button');
+ if (!Cookies.get('cookie-box')) {
+ cookieBox.classList.remove('cookie-box-hide');
+ cookieButton.onclick = function () {
+ Cookies.set('cookie-box', true, {
+ expires: {{ site.Params.cookies.expire_days }}
+ });
+ cookieBox.classList.add('cookie-box-hide');
+ };
+ }
+ })(jQuery);
+</script>
+
+<!-- cookie style -->
+<style>
+.cookie-box {
+ position: fixed;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ text-align: center;
+ z-index: 9999;
+ padding: 1rem 2rem;
+ background: rgb(71, 71, 71);
+ transition: all .75s cubic-bezier(.19, 1, .22, 1);
+ color: #fdfdfd;
+}
+
+.cookie-box-hide {
+ display: none;
+}
+</style>
+{{ end }} \ No newline at end of file