Skip to content

Commit

Permalink
Adjust onInitialise action
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikdro authored May 24, 2018
1 parent 5af73f2 commit 0b3784d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Resources/Private/Templates/FusionObjects/Initialize.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
<![CDATA[
var settings =]]>{settings -> f:format.raw()}<![CDATA[;

settings.onInitialise = function () {
settings.onInitialise = function (status) {
var type = this.options.type;
var didConsent = this.hasConsented();
if (type === 'opt-in' && didConsent) {
document.dispatchEvent(new CustomEvent("kd-cookieconsent", {detail: "enable-cookies"}));
if (type === 'opt-in') {
if (status === 'allow') {
document.dispatchEvent(new CustomEvent("kd-cookieconsent", {detail: "enable-cookies"}));
} else {
document.dispatchEvent(new CustomEvent("kd-cookieconsent", {detail: "disable-cookies"}));
}
}
if (type === 'opt-out' && !didConsent) {
document.dispatchEvent(new CustomEvent("kd-cookieconsent", {detail: "disable-cookies"}));
Expand Down

0 comments on commit 0b3784d

Please sign in to comment.