Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/novicell/novicell-cookie-info
- Owner: Novicell
- License: mit
- Created: 2017-04-10T18:57:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-01T06:59:52.000Z (about 6 years ago)
- Last Synced: 2023-12-25T16:28:18.595Z (11 months ago)
- Topics: cookie, novicell-cookie-info, warning
- Language: JavaScript
- Size: 15.6 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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**
```htmlCookies?
```
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:
```javascriptdocument.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`:
```javascriptdocument.addEventListener("DOMContentLoaded", function() {
novicell.cookieInfo.init();
novicell.cookieInfo.extentions.test();
...
});
```