Closed ghost closed 3 years ago
Unfortunately no ... what would you like to achieve?
Access the items under settings_modal
to be able to access the details introduced in the cookie_tables
for each category from the method onAccept/onChange
A (crap) way to achieve it as it is now, is with document.getElementById('.....')
and getting the IDs cookieconsent uses when it generates the table in L261: var _createCookieConsentHTML = function(never_accepted, conf_params)
Does it make sense to add a method to cookieconsent that return conf_params
?
Something like cookieconsent.myConfig()
If you simply want to know the content of the modals, you could initialize the plugin using an external object like so:
let languages = {
en: {
consent_modal: {
title : "I use cookies",
description : 'Your cookie consent message here',
primary_btn: {
text: 'Accept',
role: 'accept_all'
},
secondary_btn: {
text : 'Reject',
role : 'accept_necessary'
}
},
settings_modal : {
...
}
}
};
const cc = initCookieConsent();
cc.run({
autorun: true,
....,
onAccept: function(){
console.log(`title=${languages.en.consent_modal.title}`);
},
languages: languages
});
If your intention was to be able to modify the data of the modals (modify the html markup inside them), this can't be done. You'll need to manually obtain references to existing elements using methods like document.getElmentById
.
Is possible to access the information set to configure the cc.run({ from onAccept function?
Something like: