-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Initial configuration for cookie consent
- Loading branch information
Showing
7 changed files
with
84 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Cookie Consent Demo</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
|
||
<link href="https://fonts.googleapis.com/css2?family=Inter&display=swap" rel="stylesheet" /> | ||
<link rel="stylesheet" href="../dist/cookieconsent.css"> | ||
</head> | ||
<body> | ||
|
||
<h1>LMC Cookie Consent Manager Demo</h1> | ||
|
||
<script defer src="../dist/index.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import 'vanilla-cookieconsent'; | ||
|
||
import { config as configEn } from './languages/en'; | ||
|
||
const defaultOptions = { currentLang: 'en', themeCss: '', config: {}} | ||
|
||
const LmcCookieConsentManager = (options = defaultOptions) => { | ||
const { | ||
currentLang, | ||
themeCss, | ||
config, | ||
} = options; | ||
|
||
const cookieconsent = window.initCookieConsent(); | ||
|
||
cookieconsent.run({ | ||
current_lang: currentLang, | ||
theme_css: themeCss, | ||
cookie_name: 'lmc_ccm', | ||
cookie_expiration : 365, | ||
gui_options: { | ||
consent_modal : { | ||
layout : 'bar', // box/cloud/bar | ||
position : 'bottom center', // bottom/middle/top + left/right/center | ||
transition: 'slide' // zoom/slide | ||
}, | ||
}, | ||
onAccept: () => { | ||
alert('Cookie Consent Accepted'); | ||
}, | ||
languages: { | ||
en: configEn, | ||
}, | ||
// override default config if necessary | ||
...config, | ||
}); | ||
}; | ||
|
||
export default LmcCookieConsentManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import LmcCookieConsent from './LmcCookieConsentManager'; | ||
|
||
window.addEventListener('load', function(){ | ||
LmcCookieConsentManager(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import LmcCookieConsentManager from './LmcCookieConsentManager'; | ||
|
||
(function() { | ||
const init = 'initLmcCookieConsentManager'; | ||
/** | ||
* Make LmcCookieConsent object accessible globally | ||
*/ | ||
if(typeof window[init] !== 'function'){ | ||
window[init] = LmcCookieConsentManager | ||
} | ||
})(); |
This file was deleted.
Oops, something went wrong.