diff --git a/_assets/javascripts/cookie.js b/_assets/javascripts/cookie.js new file mode 100644 index 0000000..0629d63 --- /dev/null +++ b/_assets/javascripts/cookie.js @@ -0,0 +1,45 @@ +function createCookie(name, value, days) { + var expires = ""; + if (days) { + var date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + expires = "; expires=" + date.toUTCString(); + } + document.cookie = name + "=" + value + expires + "; path=/"; +} +function readCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for (var i = 0; i < ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') c = c.substring(1, c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); + } + return null; +} +function eraseCookie(name) { + createCookie(name, "", -1); +} + +$(document).ready(function() { + if (readCookie('cookie-notice-dismissed') == 'true') { + console.log("GDPR Consent Dismiss"); + } else { + document.getElementById('cookie-notice').style.display = 'block'; + } + + document.getElementById('cookie-notice-accept').addEventListener("click", function() { + createCookie('cookie-notice-dismissed', 'true', 31); + _paq.push(['rememberConsentGiven']); + document.getElementById('cookie-notice').style.display = 'none'; + location.reload(); + }); + + document.getElementById('cookie-notice-dismiss').addEventListener("click", function() { + createCookie('cookie-notice-dismissed', 'true', 31); + _paq.push(['forgetConsentGiven']); + _paq.push(['optUserOut']); + document.getElementById('cookie-notice').style.display = 'none'; + location.reload(); + }); +}); diff --git a/_assets/javascripts/main.js b/_assets/javascripts/main.js index 79e1beb..ac92c13 100644 --- a/_assets/javascripts/main.js +++ b/_assets/javascripts/main.js @@ -3,6 +3,7 @@ // require bootstrap // require bootstrap-sprockets //= require morphext +//= require cookie /* Set the width of the side navigation to 250px */ function openNav() { diff --git a/_assets/javascripts/matomo.js b/_assets/javascripts/matomo.js new file mode 100644 index 0000000..7947b0e --- /dev/null +++ b/_assets/javascripts/matomo.js @@ -0,0 +1,18 @@ +var _paq = window._paq || []; +/* tracker methods like "setCustomDimension" should be called before "trackPageView" */ +_paq.push(['requireConsent']); +_paq.push(['trackPageView']); +_paq.push(['enableLinkTracking']); +(function() { + var u = "//analytics.unitoo.it/"; + _paq.push(['setTrackerUrl', u + 'matomo.php']); + _paq.push(['setSiteId', '1']); + var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0]; + g.type = 'text/javascript'; g.async = true; g.defer = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s); +})(); + +jQuery(document).ready(function($) { + $("a[href^='mailto:']").on("click", function(e) { + _paq.push(['trackGoal', 1]); + }); +}); diff --git a/_assets/stylesheets/_cookie.scss b/_assets/stylesheets/_cookie.scss new file mode 100644 index 0000000..8a16e33 --- /dev/null +++ b/_assets/stylesheets/_cookie.scss @@ -0,0 +1,29 @@ +#cookie-notice { + padding: 0.5rem 1rem; + display: none; + text-align: center; + position: fixed; + bottom: 0; + width: calc(100% - 2rem); + background: #222; + color: rgba(255,255,255,0.8); + + a { + display: inline-block; + cursor: pointer; + margin-left: 0.5rem; + } + + @media (max-width: 767px) { + span { + display: block; + padding-top: 3px; + margin-bottom: 1rem; + } + + a { + position: relative; + bottom: 4px; + } + } +} diff --git a/_assets/stylesheets/_layout.scss b/_assets/stylesheets/_layout.scss index 3ad8523..4c1477f 100644 --- a/_assets/stylesheets/_layout.scss +++ b/_assets/stylesheets/_layout.scss @@ -38,6 +38,12 @@ background-color: #222; border-top: 3px dashed $body-bg; box-shadow: 0px 250px #222; + + li.list-inline-item { + img { + margin-top: -3px; + } + } } // .footer-heading { @@ -431,3 +437,15 @@ aside.aside { background-position: center; background-image: asset_url('header-radio.webp'); } + +.min-height-500 { + min-height: 500px !important; +} + +.fix-icon-mt { + margin-top: -3px; +} + +.border-thicker { + border-width: 2px; +} diff --git a/_assets/stylesheets/main.scss b/_assets/stylesheets/main.scss index b8b66c2..c28ca59 100644 --- a/_assets/stylesheets/main.scss +++ b/_assets/stylesheets/main.scss @@ -45,4 +45,4 @@ $on-laptop: 800px; } // Import partials from `sass_dir` (defaults to `_sass`) -@import 'base', 'layout', 'sidebar';//, 'syntax-highlighting'; +@import 'base', 'layout', 'sidebar', 'cookie';//, 'syntax-highlighting'; diff --git a/_includes/bottom.html b/_includes/bottom.html index 9468611..c435cb2 100644 --- a/_includes/bottom.html +++ b/_includes/bottom.html @@ -1,28 +1,2 @@ {% asset main.js %} - - - - - - - - +{% asset matomo.js defer %} diff --git a/_includes/cookie-consent.html b/_includes/cookie-consent.html index b3f21df..0d22e05 100644 --- a/_includes/cookie-consent.html +++ b/_includes/cookie-consent.html @@ -1,55 +1,6 @@ - -
- + diff --git a/_includes/footer.html b/_includes/footer.html index 6f21632..7945421 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -33,7 +33,7 @@ {%- capture alt_mastodon_logo %} {%- t meta.alt.mastodon_logo %} {%- endcapture %} - {% asset mastodon width=20 style="margin-top: -3px;" alt="{{ alt_mastodon_logo }}" %} + {% asset mastodon width=20 alt="{{ alt_mastodon_logo }}" %}