From 975a4ecffcc4fc1bfcc3cd1b421226da1aa74945 Mon Sep 17 00:00:00 2001 From: Deborah Barnard Date: Thu, 24 Nov 2022 13:24:54 +0000 Subject: [PATCH] move all my code into an override --- docs/_extra/javascript/extra.js | 47 -------- overrides/partials/javascripts/consent.html | 116 ++++++++++++++++++++ 2 files changed, 116 insertions(+), 47 deletions(-) create mode 100644 overrides/partials/javascripts/consent.html diff --git a/docs/_extra/javascript/extra.js b/docs/_extra/javascript/extra.js index 8bb2b78ad..e69de29bb 100644 --- a/docs/_extra/javascript/extra.js +++ b/docs/_extra/javascript/extra.js @@ -1,47 +0,0 @@ -// If the user has accepted cookies, set the n8n-consent cookie -// This means if they then go to the main website, they won't be prompted again -let docsConsent = __md_get("__consent") -let d = new Date(); -d.setTime(d.getTime() + 5 * 24 * 60 * 60 * 1000); -let n8nCookie = {'consent': true}; -// When user clicks Accept on the consent form, page reloads and this sets -// If it breaks, check the page reload is still happening -if (docsConsent && docsConsent.analytics === true) { - document.cookie = `n8n-consent=${JSON.stringify(n8nCookie)};expires=${d.toUTCString()};path=/;domain=.n8n.io`; -} - -// If the user already has the n8n-consent cookie, accept cookies in docs as well -let getn8nCookie = getCookie("n8n-consent"); -console.log(getn8nCookie); -if(getn8nCookie) { - var parsedn8nCookie = JSON.parse(getn8nCookie); -} - -console.log("one"); -console.log(parsedn8nCookie); -console.log("two"); -console.log(parsedn8nCookie.consent); - -if(parsedn8nCookie && parsedn8nCookie.consent === true) { - console.log("in if"); - __md_set("__consent", {"analytics": true}); - var el = document.querySelector("[data-md-component=consent]"); - el.hidden = true; -} - -// Function to help with extracting cookies by name -function getCookie(cname) { - let name = cname + "="; - let decodedCookie = decodeURIComponent(document.cookie); - let ca = decodedCookie.split(';'); - for(let i = 0; i + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. +--> + + + + + + + +