-
-
Save MartinMystikJonas/163edca770fbde561a4fae9e97d43acd to your computer and use it in GitHub Desktop.
cookie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(status == cookieconsent.status.deny) { | |
$('script[cookieconsent=enabled]').each(function() { | |
console.log("Cookie disabled: " + $(this).data("cookietype")); | |
$(this).remove(); | |
}); | |
} else { | |
$('script[cookieconsent=disabled]').each(function() { | |
scriptOrigin = $(this); | |
script = scriptOrigin.clone(); | |
script.attr('type', 'text/javascript'); | |
script.attr('cookieconsent', 'enabled') | |
console.log("Cookie enabled: " + script.data("cookietype")); | |
(document.getElementsByTagName('head')[0]).appendChild(script.get(0)); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example of script execute only on allowed cookies. Notice text-plain type to prevent automatic execution.