Cookie Consent
A Vanilla JS plugin which meets General Data Protection Regulations (GDPR)
Installing
bower install rc-consent
npm install rc-consent
Parameters
- formIds = array of ids for add listen event on form submit. Each input checkbox with name category set the consent status.
- clickSelector = string selector for add listen event on click. This selector can be use on button click accept consent current status by add a cookie with a hash value of the current statuses.
- cookie = object contain the name, days, domain and path of the stored cookie.
- defaultStatus = object of the default status key is the category and value is boolean.
Methods
- hasConsented = Check consented and with param category check only this category.
- setConsent = set the consent param accept object of status or dom element and search checkbox checked.
- setForm = set the form input checkbox. The name of the input is the name of the category.
- getStatus = return object status.
- setStatus = set the status param object of each status.
- clearStatus = Clear all status to default status
- getDefaultStatus = return the default status
- destroy = destroy events
Provider Callbacks
- onInitialise = Call on provider initialize
- onAllow = Call on method setConsent
- onRevoke = Call on method setConsent
- onStatusChange = Call on method setConsent
Events
- rccSetConsent = is a listner for setConsent.
Usage/Example Form
//Simple example jQuery with modal foundation { "use strict"; var $consentModal = ; var $consentModalInstance = $consentModal; //Check has consented ; //On Submit close modal ; //Init form field on Modal Open $consentModal; }jQuery rcc;
AngularJS
AngularJS Module See AngularJS Provider