Skip to content

Commit

Permalink
#13 Cookie consent
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Whalley committed Feb 20, 2022
1 parent ab2fb2d commit d11f065
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 181 deletions.
17 changes: 17 additions & 0 deletions assets/scss/common/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,21 @@ $input-btn-focus-width: 0;
height: 3rem;
width: 3rem;
font-size: 1.5rem;
}

// Cookie consent
.cookie-banner {
position: fixed;
bottom: 40px;
left: 10%;
right: 10%;
width: 80%;
padding: 5px 14px;
display: flex;
align-items: center;
justify-content: space-between;
background-color: rgba(186, 194, 175, 0.932);
border-radius: 5px;
box-shadow: 0 0 2px 1px rgb(0, 83, 18);
z-index: 9999;
}
34 changes: 34 additions & 0 deletions content/en/docs/MMEX/cookiepolicy/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: "Cookie Policy"
description: "Cookie Policy"
lead: ""
date: 2022-02-20
draft: false
images: []
menu:
docs:
parent: "MMEX"
toc: true
---

Please read this cookie policy carefully before using our website.

## What are cookies?

Cookies are simple text files that are stored on your computer or mobile device by a website’s server. Each cookie is unique to your web browser. It will contain some anonymous information such as a unique identifier, website’s domain name, and some digits and numbers.

## What types of cookies do we use?

### Necessary cookies

Necessary cookies allow us to offer you the best possible experience when accessing and navigating through our website and using its features.

### Analytical cookies

These cookies enable us and third-party services to collect aggregated data for statistical purposes on how our visitors use the website. These cookies do not contain personal information such as names and email addresses and are used to help us improve your user experience of the website.

## How to delete cookies?

If you want to restrict or block the cookies that are set by our website, you can do so through your browser setting. Alternatively, you can visit [Internet Cookies](https://www.internetcookies.org), which contains comprehensive information on how to do this on a wide variety of browsers and devices. You will find general information about cookies and details on how to delete cookies from your device.

{{< alert context="info" text="This policy was last modified on 2022-02-20" />}}
4 changes: 2 additions & 2 deletions content/en/docs/MMEX/privacy/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ We implement a variety of security measures to maintain the safety of your perso

## Do we use cookies?

We do not use cookies.
See our [Cookie Policy](../cookiepolicy/)

## Do we disclose any information to outside parties?

Expand Down Expand Up @@ -68,4 +68,4 @@ By using our site, you consent to our websites privacy policy.

If we decide to change our privacy policy, we will post those changes on this page, and/or update the Privacy Policy modification date below.

*This policy was last modified on 2014-05-23*
{{< alert context="info" text="This policy was last modified on 2022-02-20" />}}
9 changes: 0 additions & 9 deletions data/consent.yml

This file was deleted.

2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
{{ block "sidebar-prefooter" . }}{{ end }}
{{ block "sidebar-footer" . }}{{ end }}
{{ partial "footer/footer.html" . }}
{{ partial "footer/consent.html" . }}
{{ partial "footer/script-footer.html" . }}
{{ partial "index/platform.html" . }}
<!-- {{ partial "consent.html" . }} -->
</body>
</html>
166 changes: 0 additions & 166 deletions layouts/partials/consent.html

This file was deleted.

4 changes: 4 additions & 0 deletions layouts/partials/footer/consent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div id="cookieconsent" class="cookie-banner" style="display: none">
<p>By using our website, you agree to our <a href="/docs/mmex/cookiepolicy">cookie policy</a>. We use cookies to give you the best online experience.</a></p>
<button id="cookieclose" class="btn btn-primary">Got it!</button>
</div>
3 changes: 2 additions & 1 deletion layouts/partials/footer/script-footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@
{{ if and (.Site.Params.options.flexSearch) (eq .Section "docs") -}}
<script src="{{ $index.Permalink }}" integrity="{{ $index.Data.Integrity }}" crossorigin="anonymous" defer></script>
{{ end -}}
{{ end -}}
{{ end -}}
<script src="/js/cookieconsent.js"></script>
7 changes: 7 additions & 0 deletions layouts/partials/head/gtag.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.GoogleAnalytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ .Site.GoogleAnalytics }}');
</script>
2 changes: 1 addition & 1 deletion layouts/partials/head/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
{{ block "head/stylesheet" . }}{{ partial "head/stylesheet.html" . }}{{ end }}
{{ block "head/seo" . }}{{ partial "head/seo.html" . }}{{ end }}
{{ block "head/favicons" . }}{{ partial "head/favicons.html" . }}{{ end }}
{{ template "_internal/google_analytics.html" . }}
{{ if ne .Site.GoogleAnalytics "" }}{{ partial "head/gtag.html" . }}{{ end }}
</head>
4 changes: 3 additions & 1 deletion layouts/partials/index/platform.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .IsHome -}}
<script>
// Determine build details

Expand Down Expand Up @@ -54,4 +55,5 @@
document.getElementById('download-os').innerHTML = iconHtml;
document.getElementById('download-os').setAttribute('href', url);
}
</script>
</script>
{{ end -}}
10 changes: 10 additions & 0 deletions static/js/cookieconsent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(localStorage.getItem('cookieSeen') != 'shown')
{
document.getElementById("cookieconsent").style.display = 'block';
}

document.getElementById("cookieclose").onclick = function()
{
document.getElementById("cookieconsent").style.display = 'none';
localStorage.setItem('cookieSeen','shown')
};

0 comments on commit d11f065

Please sign in to comment.