Lint fixes.

This commit is contained in:
Fredrik Jonsson 2021-02-01 09:29:04 +01:00
commit aa3a5d3808
2 changed files with 44 additions and 44 deletions

View file

@ -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');
});
});
}
})();

View file

@ -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);
}