From 211647d1b0e8cb36b778e8ac2a4c46834cc31e5b Mon Sep 17 00:00:00 2001 From: Hai-Nam Nguyen Date: Thu, 9 Dec 2021 10:04:35 +0100 Subject: [PATCH] Documentation about possible customization without hacking code --- README.md | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6be9baf..d2ad4bc 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,9 @@ tarteaucitron.init({ ``` -# Create custom service +# Customization + +## Create custom service ```js tarteaucitron.services.mycustomservice = { "key": "mycustomservice", @@ -88,7 +90,38 @@ tarteaucitron.services.mycustomservice = { }; ``` -## Thanks to the sponsors 😊 +## Events + +The following events are available: +* `tac.root_available`: the root element with panel has been created, services will be loaded +* {SERVICE_KEY}`.added` for each enabled service +* {SERVICE_KEY}`.loaded` for each enabled service +* `tac.open_alert` +* `tac.close_alert` +* `tac.open_panel` +* `tac.close_panel` + +## Customize text + +To change a translation, use `tarteaucitronCustomText` variable. It will be merge with the translation shipping with TAC. This variable must be defined before the initialization. For example: +```js +tarteaucitronCustomText = { + 'support': { + 'title': 'Support client', + }, + 'close': 'Enregistrer et fermer', +}; +tarteaucitron.init(...); +``` + +There is a special case for engagement text. By the default, the engagement text is _{SERVICE_NAME} is disabled._, however you can change it per service. For example: +```js +tarteaucitronCustomText = { + 'engage-twitter': 'Follow us on Twitter!' +}; +``` + +# Thanks to the sponsors 😊 | Be the first sponsor! | |:---:|