Merge pull request #115 from thomascombe/feat/hide-read-more

Change read more link
This commit is contained in:
Amauri CHAMPEAUX 2018-12-26 13:34:11 +01:00 committed by GitHub
commit 6dec199d5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 1 deletions

View File

@ -50,6 +50,28 @@ tarteaucitron.init({
"useExternalCss": false /* If false, the tarteaucitron.css file will be loaded */
//"cookieDomain": ".my-multisite-domaine.fr" /* Shared cookie for subdomain website */
"readmoreLink": "/cookiespolicy" /* Change the default readmore link pointing to opt-out.ferank.eu */
});
</script>
```
# 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
}
};
```

View File

@ -521,8 +521,17 @@ var tarteaucitron = {
html += ' <div class="tarteaucitronName">';
html += ' <span class="tarteaucitronH3" role="heading" aria-level="h3">' + service.name + '</span>';
html += ' <span id="tacCL' + service.key + '" class="tarteaucitronListCookies"></span><br/>';
if (tarteaucitron.parameters.moreInfoLink == true) {
html += ' <a href="https://opt-out.ferank.eu/service/' + service.key + '/" target="_blank" rel="noopener" title="'+ tarteaucitron.lang.cookieDetail + ' ' + service.name + ' ' + tarteaucitron.lang.ourSite + ' ' + tarteaucitron.lang.newWindow +'">';
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 += ' <a href="' + link + '" target="_blank" rel="noopener" title="'+ tarteaucitron.lang.cookieDetail + ' ' + service.name + ' ' + tarteaucitron.lang.ourSite + ' ' + tarteaucitron.lang.newWindow +'">';
html += ' ' + tarteaucitron.lang.more;
html += ' </a>';
html += ' - ';
@ -530,6 +539,7 @@ var tarteaucitron = {
html += ' ' + tarteaucitron.lang.source;
html += ' </a>';
}
html += ' </div>';
html += ' <div class="tarteaucitronAsk">';
html += ' <button id="' + service.key + 'Allowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respond(this, true);">';