1.0.6 • Published 3 years ago

@john_sear/cookie-banner v1.0.6

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
3 years ago

Cookie Banner

Based on https://gist.github.com/BlackScorp/d7390fead02103c9ab4ea174a8a9b9c0
Thanks to BlackScorp :-)

This JavaScript can be used, to show a Cookie Banner regarding the ePrivacy Directive since 2002.

Usage

Simply add <cookie-banner></cookie-banner> html tag inside body in your HTML Document and include the cookie-banner.js;

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Web Component - Cookie Banner</title>
</head>
<body>

<cookie-banner></cookie-banner>
<script>
  /** Optional Settings */
  const cookieBannerOptions = {
    title             : 'This is the Project Title',
    text              : 'This is the special Text',
    additionalCookies : ['Statistics', 'Marketing', 'Foo', 'Bar']
  };
</script>
<script defer src="js/cookie-banner.js"></script>
</body>
</html>

Optional Settings

Can be optionally set before including the cookie-banner.js into your document.

See Usage example before.

NameTypeDefaultDescription
titleStringAccept CookiesUsed as Banner Title
textStringCookies are always usedUsed as Banner Text, i.e. description
requiredNameBooleanRequiredUse "Required" cookie (if no additional cookies set, this will be always true)
additionalCookiesArray[]Containing the Names for additional Cookies (if empty "Required" cookie will always be shown)
acceptAllTextStringAccept AllText for the "accept all" button
acceptSelectedTextStringAccept SelectedText for the "accept selected" button
additionalStylesString''Additional Styles
1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago