1.1.2 • Published 5 years ago

cookie-consent-gdpr-api v1.1.2

Weekly downloads
142
License
ISC
Repository
github
Last release
5 years ago

Description

Get your website’s usage of cookies compliant with the European GDPR mandatory rules. Non-compliant organizations can risk fines up to 4% of the organization’s global yearly sales.

This tool will help you to easily implement cookies bar and allow you to rapidly customize its features.

See the examples bellow:

Developer example | Production example

 

Including the library

CSS (include in the head):
<link rel="stylesheet" href="path-to-library/dist/cookie.min.css" /> 
Javascript (include at the end of the body):
<script src="path-to-library/dist/cookie.min.js"></script>

 

How to use

Insert the following code after adding the js library at the end of the body just like below:
var cookie_data = {
    lang: "en",
    logo_url: "https://plan4privacy.eu/site/site/img/logo.svg"
};

initializeCookies(cookie_data);

 

In the example above there are two options:

OptionTypeDefaultDescription
langstringenDefines the language in which you want to display the text.
logo_urlstringnullThis is the path to the logo of the company. It must be absolute.

 

The list of available languages is the following :

  • en (English);
  • es (Spanish);
  • pt (Portuguese);

 

You'll not need more than this to initialize, but if you're not satisfied with the styles there are options that you can use to change them to.

 

Styles

Before showing every option of the styles, here is a full example of the code :
var cookie_data = {
	lang: "en",
	logo_url: "https://plan4privacy.eu/site/site/img/logo.svg",
	styles: {
		stickyFooter: {
			bgColor: "#d0d1d0",
			textColor: "#000000",
			definitionsButton: {
				textColor: "#007e9c",
				borderColor: "transparent",
				hoverTextColor: "#007e9c",
				hoverBorderColor: "#007e9c"
			},
			acceptButton: {
				bgColor: "#007e9c",
				bgHoverColor: "transparent",
				borderColor: "#007e9c",
				hoverBorderColor: "#007e9c",
				textColor: "white",
				hoverTextColor: "#007e9c"
			}
		},
		modal: {
			closeButtonColor: "#000",
			header: {
				bgColor: "#ffffff",
				bottomBorderColor: "#d0d1d0"
			},
			middle: {
				bgColor: "#ffffff",
				navBar: {
					linkTextColor: "#6d6d6d",
					linkBorderColor: "transparent",
					linkActiveTextColor: "#000000",
					linkActiveBorderColor: "#007e9c"
				},
				details: {
					titleColor: "#000000",
					textColor: "#000000",
					checkSymbolColor: "#bc5592"
				}
			},
			footer: {
				bgColor: "#fff",
				provider: {
					textColor: "#000000",
					linkColor: "#007e9c",
					hoverLinkColor: "#007e9c",
					linkBorderColor: "transparent",
					hoverLinkBorderColor: "#007e9c"
				},
				acceptButton: {
					bgColor: "#007e9c",
					bgHoverColor: "transparent",
					borderColor: "#007e9c",
					hoverBorderColor: "#007e9c",
					textColor: "#fff",
					hoverTextColor: "#007e9c"
				}
			}
		}
	}
};

initializeCookies(cookie_data);

 

As you can see the styles are divided in various sections, lets get through them one by one:

 

stickyFooter
OptionTypeDefaultDescription
bgColorstringnullDefines the background of the footer
textColorstringnullDefines the color of the text which is at the left side of the stickyFooter
stickyFooter.definitionsButton
OptionTypeDefaultDescription
textColorstringnullInitial color of the definitions button
borderColorstringnullInitial color of the border of the the definitions button
hoverTextColorstringnullColor of the definitions button when it's hovered
hoverBorderColorstringnullColor of the border of the definitions buttons when it's hovered
stickyFooter.acceptButton
OptionTypeDefaultDescription
bgColorstringnullInitial background color of the accept button
bgHoverColorstringnullBackground color when the accept button is hovered
borderColorstringnullInitial border color of the accept button
hoverBorderColorstringnullBorder color when the accept button is hovered
textColorstringnullInitial text color of the accept button
hoverTextColorstringnullText color of the accept button
modal
OptionTypeDefaultDescription
closeButtonColorstringnullColor of the close button "X" in the top right corner of the modal
modal.header
OptionTypeDefaultDescription
bgColorstringnullInitial background color of the header
bottomBorderColorstringnullInital bottom border color of the header
modal.middle
OptionTypeDefaultDescription
bgColorstringnullInitial background color of the middle
modal.middle.navBar
OptionTypeDefaultDescription
linkTextColorstringnullInitial text color of the links of the nav bar
linkBorderColorstringnullInitial bottom border color of the links of the nav bar
linkActiveTextColorstringnullText color of the links of the nav bar when it's active
linkActiveBorderColorstringnullBotttom border color of the links of the nav bar when it's active
modal.middle.details
OptionTypeDefaultDescription
titleColorstringnullInitial color of the titles in the left side of the middle content
textColorstringnullInitial color of the text on the left side of the middle content
checkSymbolColorstringnullInitial color of the check symbol on the left side of the middle content
modal.footer
OptionTypeDefaultDescription
bgColorstringnullInitial background color of the footer
modal.footer.provider
OptionTypeDefaultDescription
textColorstringnullInitial provider text color
linkColorstringnullInitial provider link color
hoverLinkColorstringnullProvider link color when it's hovered
linkBorderColorstringnullInitial provider link border color
hoverLinkBorderColorstringnullProvider link border color when it's hovered
modal.footer.acceptButton
OptionTypeDefaultDescription
bgColorstringnullInitial modal accept button background color
bgHoverColorstringnullModal accept button background color when it's hovered
borderColorstringnullInitial modal accept button border color
hoverBorderColorstringnullModal accept button border color when it's hovered
textColorstringnullInitial modal accept button text color
hoverTextColorstringnullModal accept button text color when it´s hovered
1.1.2

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago