From 6bbf89731b123e097156de11980407965c3ed1bd Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 5 Sep 2017 23:54:33 +0200 Subject: [PATCH] cookie banner * closes #4 --- _src/_assets/js/ipdb.js | 26 ++++++++++++++++++++++++-- _src/_assets/scss/_cookiebanner.scss | 15 +++++++++++++++ _src/_assets/scss/ipdb.scss | 1 + package.json | 1 + 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 _src/_assets/scss/_cookiebanner.scss diff --git a/_src/_assets/js/ipdb.js b/_src/_assets/js/ipdb.js index 76e30ab..f7f5884 100644 --- a/_src/_assets/js/ipdb.js +++ b/_src/_assets/js/ipdb.js @@ -1,11 +1,11 @@ -/* global SmoothScroll */ -/* global Autogrow */ +/* global SmoothScroll, Autogrow, Cookiebanner */ /* eslint-disable spaced-comment */ //=include _dnt.js //=include _newsletter.js //=include smooth-scroll/dist/js/smooth-scroll.js //=include textarea-autogrow/textarea-autogrow.js +//=include cookie-banner/src/cookiebanner.js /* eslint-enable spaced-comment */ document.addEventListener('DOMContentLoaded', () => { @@ -25,3 +25,25 @@ document.addEventListener('DOMContentLoaded', () => { const growingTextarea = new Autogrow(textarea) } }) + +// +// Cookie banner +// +// this global variable name seem not smart, plugin requires it though +// https://github.com/dobarkod/cookie-banner +const options = { + message: 'By using this website you agree to our cookie policy.', + linkmsg: ' ', + fontFamily: 'inherit', + fontSize: '15px', + bg: 'rgba(234, 243, 245, .7)', + fg: 'inherit', + link: '#cc6bb3', + closeText: '×', + closeStyle: 'font-size:1.1rem;float:right;padding:5px;margin:-5px;margin-top:-4px', + minHeight: '18px', + moreinfo: '/privacy/', + effect: 'fade' +} + +const cookiebanner = new Cookiebanner(options); cookiebanner.run() diff --git a/_src/_assets/scss/_cookiebanner.scss b/_src/_assets/scss/_cookiebanner.scss new file mode 100644 index 0000000..0fffb1c --- /dev/null +++ b/_src/_assets/scss/_cookiebanner.scss @@ -0,0 +1,15 @@ +// Mostly styled with options in js, the rest here + +.cookiebanner { + border-top-left-radius: 1rem; + border-top-right-radius: 1rem; + + @media ($screen-sm) { + // stylelint-disable declaration-no-important + left: 30% !important; + right: 30% !important; + line-height: 18px !important; + // stylelint-enable declaration-no-important + max-width: 25rem; + } +} diff --git a/_src/_assets/scss/ipdb.scss b/_src/_assets/scss/ipdb.scss index 021c1ec..f1e1172 100644 --- a/_src/_assets/scss/ipdb.scss +++ b/_src/_assets/scss/ipdb.scss @@ -16,6 +16,7 @@ @import 'logo'; @import 'caretakers'; @import 'board'; +@import 'cookiebanner'; .content--page--markdown { padding-top: $spacer * 2; diff --git a/package.json b/package.json index 632daf7..546d008 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ ], "dependencies": { "ajaxchimp": "^1.3.0", + "cookie-banner": "github:dobarkod/cookie-banner", "jquery": "^3.2.1", "smooth-scroll": "^12.1.4", "textarea-autogrow": "^1.0.0"