GDPR plugin is a project in which an example of a pop-up modal to accept or cancel a GDPR consent.
- HTML5
- SASS/CSS
- JavaScript (ES6)
- Webpack
- npm
To run this project, install it locally using npm
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run start
# install dependencies
npm install
# build for development and provide an unminified bundle in the "dist" directory
npm run build
# serve project in the "dist" directory
npm run server
# install dependencies
npm install
# build for production with minification in the "dist" directory
npm run prod
# serve project in the "dist" directory
npm run server
# remove the "dist" directory
npm run clean
import GDPRBox from "./lib/gdpr-plugin";
/* if autoOpen is true (default value) */
new GDPRBox({
/* options */
}).init();
/* if autoOpen is false */
const gdprBox = new GDPRBox({
/* options */
});
element.addEventListener("click", function() {
gdprBox.openModal();
});
Open modal automatically. Default value: true
.
Set class to GDPR modal. Default value: "gdpr-modal"
.
Set title to modal. Default value: "GDPR consent"
.
Set text to modal. Default value:
"This web site complies with the UK Privacy and Electronic Communications Regulations and the UK DPA 2018 in its understanding of consent as it applies to the regulations. We only deploy by default essential cookies, we list and give you the user the option to opt into cookie deployment for other categories of cookies if you expand the 'Cookie settings' link. By clicking the 'Accept cookie settings' button you agree to the default privacy settings of only essential cookies, if you select do not deploy any cookies then none will be deployed. Your settings and options can only be remembered with the minimum essential cookies deployed."
Set text to submit button. Default value: "submit"
.
Set text to cancel button. Default value: "cancel"
.
Set width to modal. Default value: 600
.
Set height to modal. Default value: 300
.
Set overlay if modal appears. Default value: true
.
Set time in seconds when modal will be appear after close modal. Default value: 604800
(7 days in seconds)
Use this method if autoOpen is true. Modal will appear when browser loads.
Use this method if autoOpen is false. Modal will appear when this method calls.