Try using cookieconsent

This commit is contained in:
RabsRincon
2018-07-03 12:49:08 +02:00
parent 491c6e0dfc
commit 0d8216b407
7 changed files with 107 additions and 33 deletions
+1
View File
@@ -24,6 +24,7 @@
"clipboard": "^1.7.1",
"compiler-opt-info": "0.0.4",
"compression": "^1.7.1",
"cookieconsent": "^3.0.6",
"cross-env": "^5.1.3",
"denodeify": "^1.2.1",
"es6-promise": "^4.1.1",
-1
View File
@@ -45,6 +45,5 @@ we make use of your browser's localStorage, where we place:</p>
and you can set most browsers to prevent them from being placed.
If you do this, however, you may have to manually adjust some preferences every time you visit a site
and some services and functionalities may not work.</p>
<p>You can easily accept or reject the use of cookies and related technologies on this site by choosing one of the following options:</p>
</body>
</html>
+2
View File
@@ -1,3 +1,5 @@
@import url("~cookieconsent/build/cookieconsent.min.css");
/* TEMP HACK: https://github.com/Microsoft/monaco-editor/issues/349 */
.quick-open-tree .row {
margin-left: 0;
+70 -21
View File
@@ -27,6 +27,7 @@ require("monaco-loader")().then(function () {
require('bootstrap');
require('bootstrap-slider');
require('cookieconsent');
var analytics = require('analytics');
var sharing = require('sharing');
@@ -76,6 +77,70 @@ require("monaco-loader")().then(function () {
});
}
function setupButtons() {
var alertSystem = new Alert();
window.cookieconsent.initialise({
palette: {
popup: {
background: "#eaf7f7",
text: "#5c7291"
},
button: {
background: "#56cbdb",
text: "#ffffff"
}
},
theme: "edgeless",
type: "opt-in",
content: {
href: "#",
message: "Compiler Explorer uses cookies & related technologies to provide a better service.",
dismiss: 'Do NOT allow cookies',
header: 'This is amazing, isnt it?'
},
law: {
regionalLaw: false
},
location: {
services: []
},
cookie: {
domain: '.localhost:10240'
},
elements: {
messagelink: '<span id="cookieconsent:desc" class="cc-message">' +
'{{message}} <a aria-label="learn more about cookies" tabindex="0" class="cc-link cookies" ' +
'href="{{href}}">{{link}}</a></span>',
link: '<a aria-label="learn more about cookies" tabindex="0" class="cc-link cookies" href="{{href}}">' +
'{{link}}</a>'
},
// fn(status, old)
onStatusChange: function () {
// The user selected an option, act accordingly
}
});
$('#ui-reset').click(function () {
local.remove('gl');
window.location.reload();
});
$('#thanks-to').click(function () {
alertSystem.alert("Special thanks to", $(require('./thanks.html')));
});
$('#changes').click(function () {
alertSystem.alert("Changelog", $(require('./changelog.html')));
});
var openCookiePolicy = function () {
alertSystem.alert("Cookies & related technologies policy", $(require('./cookies.html')));
};
$('#cookies').click(openCookiePolicy);
$('.cookies').click(openCookiePolicy);
$('#privacy').click(function () {
alertSystem.alert("Privacy policy", $(require('./privacy.html')));
});
}
function start() {
analytics.initialise();
@@ -105,7 +170,8 @@ require("monaco-loader")().then(function () {
});
var hashPart = null;
var linkablePopups = ['#thanks-to', '#changes', '#cookies', '#setting'];
// Which buttons act as a linkable popup
var linkablePopups = ['#thanks-to', '#changes', '#cookies', '#setting', '#privacy'];
if (linkablePopups.indexOf(window.location.hash) > -1) {
hashPart = window.location.hash;
window.location.hash = "";
@@ -178,32 +244,15 @@ require("monaco-loader")().then(function () {
});
}
var alertSystem = new Alert();
setupAdd($('#add-diff'), function () {
return Components.getDiff();
});
setupAdd($('#add-editor'), function () {
return Components.getEditor();
});
$('#ui-reset').click(function () {
local.remove('gl');
window.location.reload();
});
$('#thanks-to').click(function () {
alertSystem.alert("Special thanks to", $(require('./thanks.html')));
});
$('#changes').click(function () {
alertSystem.alert("Changelog", $(require('./changelog.html')));
});
$('#cookies').click(function () {
alertSystem.ask("Cookies & related technologies", $(require('./cookies.html')), {
yesHtml: 'I consent',
yesClass: 'consent-cookie-yes',
noHtml: 'I DO NOT consent',
noClass: 'consent-cookie-no'
});
});
setupButtons();
if (hashPart) {
var element = $(hashPart);
if (element) element.click();
+25
View File
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<style>
</style>
<body>
<h1>What data do we store?</h1>
<p>None. We're not on the business of collecting user data.</p>
<h2>What do you collect?</h2>
<ul>
<li>Anonymized usage analytics</li>
<li>Anonymized server logs, which we keep around for X (TODO: Update) days, and then get deleted</li>
</ul>
<h2>What don't you store?</h2>
<ul>
<li>We don't store your code anywhere. Google URL Shortener only stores relations between short keys and their corresponding long url.
All the data needed is encoded on the URLs. We plan to evetually stop relying on Google for the URL shortening service, which will force us
to securely store the code you choose to create short urls for.</li>
<li>We don't store personal information, nor anything that could identify you between sessions / services</li>
</ul>
<h3>I don't trust you</h3>
<p>The page code is hosted on GitHub, both the <a href="https://github.com/mattgodbolt/compiler-explorer" target="_blank">client/server code <sup class="glyphicon glyphicon-new-window opens-new-window" title="Opens in a new window"></sup></a>
and <a href="https://github.com/mattgodbolt/compiler-explorer-image" target="_blank">the behind the scenes code that powers it <sup class="glyphicon glyphicon-new-window opens-new-window" title="Opens in a new window"></sup></a></p>
</body>
</html>
+5 -11
View File
@@ -63,20 +63,14 @@ html(lang="en")
li#changes: a(href="#") Changelog
if sharingEnabled
li#socialshare
li.dropdown
a.dropdown-toggle(href="#" data-toggle="dropdown") Policies#[b.caret]
ul.dropdown-menu.menu-other
li#cookies: a(href="#") Cookie policy
li#privacy: a(href="#") Privacy policy
#root
.navbar-fixed-bottom
.container-fluid
p
| This page uses cookie/localStorage technology to store your page state, including code, editor settings and window layout.
a#cookies(href="#")
| Find out more on how we use cookie/localStorage technology and how you can change your settings
a(href="#")
| I consent
a(href="#")
| I DO NOT consent
include templates.pug
+4
View File
@@ -1033,6 +1033,10 @@ cookie@0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
cookieconsent@^3.0.6:
version "3.0.6"
resolved "https://registry.yarnpkg.com/cookieconsent/-/cookieconsent-3.0.6.tgz#147afa3e594e7b1a7826e49cb322aa0beee7b987"
cookiejar@2.0.x:
version "2.0.6"
resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.0.6.tgz#0abf356ad00d1c5a219d88d44518046dd026acfe"