Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/novicell/novicell-cookie-info

Cookie information popup used to show a short text about cookies for the website.
https://github.com/novicell/novicell-cookie-info

cookie novicell-cookie-info warning

Last synced: 2 days ago
JSON representation

Cookie information popup used to show a short text about cookies for the website.

Awesome Lists containing this project

README

        

# Novicell Cookie Info
**Cookie information dialog used to show a short text about, the use of cookies for the website, due to european laws.**

## Usage

Written in pure Vanilla JS, it has *no dependencies*. It ships with a sample LESS file, for easy implementation with the [novicell-frontend setup](https://github.com/Novicell/novicell-frontend). Use the styles for inspiration and then make your own styles.

### Install with npm

```bash
npm install novicell-cookie-info --save
```

## Setup

First make some HTML using the these id's, for the JS to work:

**Markup**
```html

Cookies?

```

Then include the js file in your js bundle or in your HTML:

**JS bundle**
```javascript
scripts: [
vendorPath + "novicell-cookie-info/js/novicell.cookieinfo.js"
...
]
```

**HTML**
```html

```

Then call the `init`-method from your `master.js`-file:
```javascript

document.addEventListener("DOMContentLoaded", function() {
novicell.cookieInfo.init();
...
});
```

## Withdraw consent

If you need to withdraw the cookie consent, you can call the `declineCookieInfo` like this:

```html
Withdraw your consent of cookies, on this webpage
```

## Extension

When extending the script, make sure to make a singleton for the `novicell` and the `novicell.cookieInfo` objects before adding your own methods.

```javascript
'use strict';

var novicell = novicell || {};
novicell.cookieInfo = novicell.cookieInfo || {};
novicell.cookieInfo.extentions = novicell.cookieInfo.extentions || new function () {
this.test = function() {
console.log('test');
};
}();
```
Next you need to include your js-files in your js bundle or in your HTML, and then call the `init`-method from your `master.js`.
Make sure to load you:

**JS bundle**
```javascript
scripts: [
vendorPath + "novicell-cookie-info/js/novicell.cookieinfo.js"
projectPath + "/components/novicell.cookieinfo.extentions.js"
...
]
```

**HTML**
```html


```

Then call the `test`-method from your `master.js`:
```javascript

document.addEventListener("DOMContentLoaded", function() {
novicell.cookieInfo.init();
novicell.cookieInfo.extentions.test();
...
});
```