aw-thirds
v1.1.1
Published
<div align="center">
Downloads
339
Readme
AW Studio - AW Thirds
AW Thirds is a library developed by AW Studio for the compliance of RGPD.
Build commands
On production use files (JS) only from dist/
folder, there will be the most stable versions.
$ yarn install
And build production version of AW Cookie:
$ yarn run prod
The result is available in dist/
folder.
To developpement version, you can use:
$ yarn start
it will build and serve project in a node server on http://localhost:3002
Usage
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Your page title</title>
<script src="aw-thirds.js"></script>
<script>
AwCookie.initialize()
</script>
</head>
<body>
<!-- Your HTML content -->
</body>
</html>
Options
{
// `lang` localisation file used
lang: 'fr',
// `mode` choose display mode: simple-banner / forced-choice / all-accepted
mode: 'simple-banner',
// `linkToDetails` path to disclaimer cookies explanations
linkToDetails: '#',
// `imageBtn` change the default image of disclamer button
imageBtn: null,
// `services` define services used in the website
services: {}
// `i18n` overlap default translations - check i18n section to details
i18n: {}
// `db` active dark pattern position links (not good at all !)
dp: false // darkPattern
}
API
| Function | Description |
| --- | --- |
| initialize(options)
| initilize the AW Cookie librar with options
|
| openParameters()
| open the cookie manager panel |
| allowService(service)
| allow the specific service
|
| denyService(service)
| deny the specific service
|
Events
Bind events with the .on()
and .off()
methods.
const listener = function listener(event) {
console.log('eventName happened', event)
}
// bind event listener
AwCookie.on(eventName, listener);
// unbind event listener
AwCookie.on(eventName, listener);
| eventName | eventReturn | Description |
| --- | --- | --- |
| ready
| | triggered when librairy is ready |
| {serviceName}
| status
:boolean | triggered after a service status change, and catch his new status
|
i18n
panel: { // translations of the cookie manager panel
close_cross: '',
close_button: '',
title: '',
content: '',
concerned: '',
button_allow: '',
button_deny: '',
button_all_allow: '',
button_all_deny: '',
disclamer: '',
button_ok_sr: '',
button_parameters_sr: '',
button_deny_sr: '',
button_allow_sr: ''
},
disclamer: { // translations of the disclamer bar
content: '',
accepted: '',
toggle_button: '',
button_open: '',
button_close: '',
button_ok: '',
button_deny: '',
button_allow: '',
button_parameters: '',
button_ok_sr: '',
button_parameters_sr: '',
button_deny_sr: '',
button_allow_sr: ''
},
forced: { // translations of the forced popin
title: '',
content: '',
button_all_deny: '',
button_all_params: '',
button_all_allow: ''
},
categories: { // translations of services catégories
social: '',
analytic: '',
ads: '',
video: '',
support: '',
api: ''
},