From d2a9417d66b1f8314a05846b03b2997ef0024f60 Mon Sep 17 00:00:00 2001 From: Thomas Combe Date: Mon, 28 May 2018 11:55:04 +0200 Subject: [PATCH] Allow to change readme link (for custom service) --- README.md | 20 ++++++++++++++++++++ tarteaucitron.js | 15 ++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2cd12a2..e33b4a3 100644 --- a/README.md +++ b/README.md @@ -119,3 +119,23 @@ tarteaucitron.init({ }); ``` + +# Create custom service +```js +tarteaucitron.services.mycustomservice = { + "key": "mycustomservice", + "type": "social|analytic|ads|video|support", + "name": "MyCustomService", + "needConsent": true, + "cookies": ['cookie', 'cookie2'], + "readmoreLink": "/custom_read_more", // If you want to change readmore link + "js": function () { + "use strict"; + // When user allow cookie + }, + "fallback": function () { + "use strict"; + // when use deny cookie + } +}; +``` \ No newline at end of file diff --git a/tarteaucitron.js b/tarteaucitron.js index 8ce944c..0f2afda 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -413,12 +413,17 @@ var tarteaucitron = { html += '
'; html += ' ' + service.name + '
'; html += '
'; - if(service.readmore !== undefined && service.readmore === false) { - html += ' '; - html += ' ' + tarteaucitron.lang.more; - html += ' '; - html += ' - '; + var link = 'https://opt-out.ferank.eu/service/' + service.key + '/'; + if (service.readmoreLink !== undefined && service.readmoreLink !== '') { + link = service.readmoreLink; } + if (tarteaucitron.parameters.readmoreLink !== undefined && tarteaucitron.parameters.readmoreLink !== '') { + link = tarteaucitron.parameters.readmoreLink; + } + html += ' '; + html += ' ' + tarteaucitron.lang.more; + html += ' '; + html += ' - '; html += ' '; html += ' ' + tarteaucitron.lang.source; html += ' ';