23 lines
783 B
JavaScript
23 lines
783 B
JavaScript
|
document.addEventListener("DOMContentLoaded", function(event) {
|
||
|
function setOptOutText(element) {
|
||
|
_paq.push([function() {
|
||
|
element.checked = !this.isUserOptedOut();
|
||
|
element.disabled = false;
|
||
|
(document.querySelector ? document.querySelector('label[for=optout] strong') : document.getElementById('optoutlabel')).innerHTML = this.isUserOptedOut()
|
||
|
? 'You are currently opted out. Click here to opt in.'
|
||
|
: 'You are currently opted in. Click here to opt out.';
|
||
|
}]);
|
||
|
}
|
||
|
|
||
|
var optOut = document.getElementById("optout");
|
||
|
optOut.addEventListener("click", function() {
|
||
|
if (this.checked) {
|
||
|
_paq.push(['forgetUserOptOut']);
|
||
|
} else {
|
||
|
_paq.push(['optUserOut']);
|
||
|
}
|
||
|
setOptOutText(optOut);
|
||
|
});
|
||
|
setOptOutText(optOut);
|
||
|
});
|