HotFix: Decline allow

This commit is contained in:
José Luis Garrido Labrador
2018-10-24 12:36:07 +02:00
parent db1858772b
commit 5c66845c28
3 changed files with 27 additions and 16 deletions

View File

@@ -53,29 +53,29 @@
<script> <script>
window.addEventListener("load", function(){ window.addEventListener("load", function(){
window.cookieconsent.initialise({ window.cookieconsent.initialise({
onInitialise: function (status) { "onInitialise": function (status) {
var type = this.options.type;
var didConsent = this.hasConsented();
if (type == 'opt-in' && didConsent) {
}
if (type == 'opt-out' && !didConsent) {
deleteCookies();
}
},
"onStatusChange": function(status, chosenBefore) {
var type = this.options.type; var type = this.options.type;
var didConsent = this.hasConsented(); var didConsent = this.hasConsented();
if (type == 'opt-in' && didConsent) { if (type == 'opt-in' && didConsent) {
// enable cookies // enable cookies
} }
if (type == 'opt-out' && !didConsent) { if (type == 'opt-out' && !didConsent) {
// disable cookies deleteCookies();
} }
}, },
onStatusChange: function(status, chosenBefore) { "onRevokeChoice": function() {
var type = this.options.type;
var didConsent = this.hasConsented();
if (type == 'opt-in' && didConsent) {
// enable cookies
}
if (type == 'opt-out' && !didConsent) {
// disable cookies
}
},
onRevokeChoice: function() {
var type = this.options.type; var type = this.options.type;
if (type == 'opt-in') { if (type == 'opt-in') {
// disable cookies // disable cookies

View File

@@ -154,6 +154,10 @@ function onScroll() {
//From https://stackoverflow.com/questions/35297919/javascript-select-all-text-inside-a-pre-code-block-on-double-click //From https://stackoverflow.com/questions/35297919/javascript-select-all-text-inside-a-pre-code-block-on-double-click
window.onload = function(){ window.onload = function(){
if(!comprobarCookie('cookieconsent_status') || obtenerCookie('cookieconsent_status')=='deny'){
deleteCookies();
}
document.body.addEventListener('dblclick', function(e){ document.body.addEventListener('dblclick', function(e){
var target = e.target || e.srcElement; var target = e.target || e.srcElement;
if (target.className.indexOf("highlight") !== -1 || target.parentNode.className.indexOf("highlight") !== -1){ if (target.className.indexOf("highlight") !== -1 || target.parentNode.className.indexOf("highlight") !== -1){
@@ -175,3 +179,10 @@ window.onload = function(){
}); });
}; };
function deleteCookies() {
var theCookies = document.cookie.split(';');
for (var i = 0 ; i < theCookies.length; i++) {
document.cookie = theCookies[i].split('=')[0] + '=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
}

View File

@@ -1,5 +1,5 @@
<?php <?php
if(isset($_COOKIE['cookieconsent_status'])) { if(isset($_COOKIE['cookieconsent_status']) and $_COOKIE['cookieconsent_status']!="deny") {
session_start(); //Start session in app, before loading vars ($_SESSION) session_start(); //Start session in app, before loading vars ($_SESSION)
} }