From 11fd2b8440a79fe4fa1c5c9e16704bc9f79dd54b Mon Sep 17 00:00:00 2001 From: Sheogorath <sheogorath@shivering-isles.com> Date: Fri, 16 Apr 2021 03:29:12 +0200 Subject: [PATCH] Optimize FLOC banner integration This patch reworks various aspects for the FLOC banner to be simpler to copy and easier on SEO. Search engines don't like hidden content. Therefore moving the HTML from the template to the JS that was used to make it show up, makes a lot of sense. The usage of `insertAdjacentHTML()` can be considere safe, since no dynamic content is injected. It improves the commit 7896142b66a57de4a960487bc3ea5fcec187d2e2 why holds all basic reasoning behind implementing this banner in first place. --- _includes/floc-warning.html | 1 - _layouts/default.html | 1 - _sass/uno.scss | 5 ----- assets/js/main.js | 4 +--- 4 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 _includes/floc-warning.html diff --git a/_includes/floc-warning.html b/_includes/floc-warning.html deleted file mode 100644 index 83e002e4..00000000 --- a/_includes/floc-warning.html +++ /dev/null @@ -1 +0,0 @@ -<div class="cohort-victim-info">Your browser implements <a href="https://www.eff.org/deeplinks/2021/03/googles-floc-terrible-idea" target="_blank" rel="noopener noreferrer">Google's FLOC</a> standard and spies on you. Good Luck!</div> diff --git a/_layouts/default.html b/_layouts/default.html index cb24a8b7..c092eac6 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -3,7 +3,6 @@ {% include head.html %} <body> - {% include floc-warning.html %} {% include header.html %} <div class="content-wrapper"> diff --git a/_sass/uno.scss b/_sass/uno.scss index cb948eb4..cc65c82d 100644 --- a/_sass/uno.scss +++ b/_sass/uno.scss @@ -812,12 +812,7 @@ i { } .cohort-victim-info { - display: none; -} - -.cohort-victim-info.visible { display: block; - // position: absolute; left: 0; z-index: 1000; background: yellow; diff --git a/assets/js/main.js b/assets/js/main.js index ca0df5b7..1fbd5be2 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -56,8 +56,6 @@ ready(function() { // fun little project to call out floc victims if (typeof document.interestCohort === 'function') { - document.querySelectorAll('.cohort-victim-info').forEach(function(selected) { - toggleClass(selected, 'visible') - }) + document.getElementsByTagName('body')[0].insertAdjacentHTML('afterbegin',`<div class="cohort-victim-info">Your browser implements <a href="https://www.eff.org/deeplinks/2021/03/googles-floc-terrible-idea" target="_blank" rel="noopener noreferrer">Google's FLOC</a> standard and spies on you. Good Luck!</div>`) } }) -- GitLab