From aa3a5d3808793ecc5ddb40a5a7207f08d5813fb5 Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Mon, 1 Feb 2021 09:29:04 +0100 Subject: [PATCH] Lint fixes. --- assets/js/cookieconsent.js | 62 +++++++++---------- .../cookieconsent/_cookieconsent.scss | 28 ++++----- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/assets/js/cookieconsent.js b/assets/js/cookieconsent.js index fa087bd..8f6e284 100644 --- a/assets/js/cookieconsent.js +++ b/assets/js/cookieconsent.js @@ -1,38 +1,38 @@ (function () { - 'use strict'; + 'use strict'; - if (typeof window.Cookies !== 'undefined') { - const cookieconsent = document.querySelector('.cookieconsent'); + if (typeof window.Cookies !== 'undefined') { + const cookieconsent = document.querySelector('.cookieconsent'); - if (window.Cookies.get('cookieconsent') === undefined && cookieconsent) { - cookieconsent.classList.add('js-cookieconsent-open'); - } - - const cookie_buttons = Array.prototype.slice.call( - document.querySelectorAll('button[data-consent]') - ); - const sitedomain = window.location.hostname.split('.').slice(-2); - const cookiedomain = sitedomain.join('.'); - let cookie_options = []; - cookie_options['domain'] = cookiedomain; - cookie_options['sameSite'] = 'strict'; - cookie_options['expires'] = 365; - if (window.location.protocol === 'https:') { - cookie_options['secure'] = true; - } - - cookie_buttons.forEach(function (button) { - button.addEventListener('click', function () { - if (button.getAttribute('data-consent') == 'true') { - window.Cookies.set('cookieconsent', 'accept', cookie_options); - } - else { - window.Cookies.set('cookieconsent', 'decline', cookie_options); - } - cookieconsent.classList.remove('js-cookieconsent-open'); - }) - }); + if (typeof window.Cookies.get('cookieconsent') === 'undefined' && cookieconsent) { + cookieconsent.classList.add('js-cookieconsent-open'); } + const cookie_buttons = Array.prototype.slice.call( + document.querySelectorAll('button[data-consent]') + ); + const sitedomain = window.location.hostname.split('.').slice(-2); + const cookiedomain = sitedomain.join('.'); + let cookie_options = []; + cookie_options['domain'] = cookiedomain; + cookie_options['sameSite'] = 'strict'; + cookie_options['expires'] = 365; + if (window.location.protocol === 'https:') { + cookie_options['secure'] = true; + } + + cookie_buttons.forEach(function (button) { + button.addEventListener('click', function () { + if (button.getAttribute('data-consent') === 'true') { + window.Cookies.set('cookieconsent', 'accept', cookie_options); + } + else { + window.Cookies.set('cookieconsent', 'decline', cookie_options); + } + cookieconsent.classList.remove('js-cookieconsent-open'); + }); + }); + } + })(); diff --git a/assets/sass/components/cookieconsent/_cookieconsent.scss b/assets/sass/components/cookieconsent/_cookieconsent.scss index dbaa057..92d2ca8 100644 --- a/assets/sass/components/cookieconsent/_cookieconsent.scss +++ b/assets/sass/components/cookieconsent/_cookieconsent.scss @@ -1,20 +1,20 @@ // Cookieconsent .cookieconsent { - @include type-layout(s, 1); - position: sticky; - bottom: 0; - width: 100%; - color: $warning; - background-color: $warning-bg; - border-top: 4px solid $warning-border; - text-align: center; - transform: translateY(100vh); - transition: all 130ms ease-in; + @include type-layout(s, 1); + position: sticky; + bottom: 0; + width: 100%; + color: $warning; + background-color: $warning-bg; + border-top: 4px solid $warning-border; + text-align: center; + transform: translateY(100vh); + transition: all 130ms ease-in; - a { - color: inherit; - } + a { + color: inherit; + } } .button { @@ -28,5 +28,5 @@ } .js-cookieconsent-open { - transform: translateY(0); + transform: translateY(0); }