From d44bee32ebb5c4d453a32ce2c7d3993f9e541ded Mon Sep 17 00:00:00 2001 From: Clement G Date: Fri, 5 Jun 2020 14:59:27 +0200 Subject: [PATCH] Manage cookie icon --- README.md | 3 +++ css/tarteaucitron.css | 39 +++++++++++++++++++++++++++++++++++++++ tarteaucitron.js | 10 ++++++++++ 3 files changed, 52 insertions(+) diff --git a/README.md b/README.md index 7c05151..644c98b 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,9 @@ tarteaucitron.init({ "orientation": "middle", /* Banner position (top - bottom) */ "showAlertSmall": true, /* Show the small banner on bottom right */ "cookieslist": true, /* Show the cookie list */ + + "showIcon": true, /* Show cookie icon to manage cookies */ + "iconPosition": "BottomRight", /* Position of the icon between BottomRight, BottomLeft, TopRight and TopLeft */ "adblocker": false, /* Show a Warning if an adblocker is detected */ "AcceptAllCta" : true, /* Show the accept all button when highPrivacy on */ diff --git a/css/tarteaucitron.css b/css/tarteaucitron.css index 068763f..5684a08 100644 --- a/css/tarteaucitron.css +++ b/css/tarteaucitron.css @@ -554,6 +554,45 @@ div#tarteaucitronServices { z-index: 2147483644; } +/*** + * Icon + */ +.tarteaucitronIconBottomRight { + bottom: 0; + right: 0; +} +.tarteaucitronIconBottomLeft { + bottom: 0; + left: 0; +} +.tarteaucitronIconTopRight { + top: 0; + right: 0; +} +.tarteaucitronIconTopLeft { + top: 0; + left: 0; +} + +#tarteaucitronIcon { + background: transparent; + position: fixed; + width: auto; + z-index: 2147483646; +} +#tarteaucitronIcon #tarteaucitronManager { + color: transparent; + cursor: pointer; + display: inline-block; + font-size: 11px !important; + padding: 8px 10px 8px; + border: none; +} +#tarteaucitronIcon #tarteaucitronManager img { + width: 50px; + height: 50px; +} + /*** * Small alert */ diff --git a/tarteaucitron.js b/tarteaucitron.js index 6acfabb..d44e850 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -208,6 +208,8 @@ var tarteaucitron = { "bodyPosition": "bottom", "removeCredit": false, "showAlertSmall": true, + "showIcon": true, + "iconPosition": "BottomRight", "cookieslist": true, "handleBrowserDNTRequest": false, "AcceptAllCta" : true, @@ -429,6 +431,14 @@ var tarteaucitron = { html += '
'; } + if (tarteaucitron.parameters.showIcon === true) { + html += '
'; + html += ' '; + html += '
'; + } + if (tarteaucitron.parameters.showAlertSmall === true) { html += '
'; html += '