From b595ca0ce5a46c674c9cd95ef0797299ec7c2ccd Mon Sep 17 00:00:00 2001 From: Jason Benedetti Date: Thu, 22 Aug 2019 14:58:35 +0200 Subject: [PATCH 1/2] Add higher encapsulation level to enhance design abilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FR : Ajout de plusieurs
et non stylisées pour faciliter le travail d'intégration et de design simplement via du CSS, notamment sur l'apparence de boutons par rapport aux textes. EN : Add some
and "unstylished" to enhance the integration and design work via simple CSS rules, especially about the buttons appearance compared to the texts. --- tarteaucitron.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tarteaucitron.js b/tarteaucitron.js index e480c63..8814af2 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -329,9 +329,11 @@ var tarteaucitron = { if (tarteaucitron.parameters.highPrivacy && !tarteaucitron.parameters.AcceptAllCta) { html += '
'; + html += '
'; html += ' '; html += ' ' + tarteaucitron.lang.alertBigPrivacy; html += ' '; + html += ' '; html += ' '; @@ -341,10 +343,13 @@ var tarteaucitron = { html += ' ' + tarteaucitron.lang.privacyUrl; html += ' '; } - + + html += ' '; + html += '
'; html += '
'; } else { html += '
'; + html += '
'; html += ' '; if (tarteaucitron.parameters.highPrivacy) { @@ -354,6 +359,7 @@ var tarteaucitron = { } html += ' '; + html += ' '; html += ' '; @@ -367,6 +373,8 @@ var tarteaucitron = { html += ' '; } + html += ' '; + html += '
'; html += '
'; html += '
'; } From c6e19d73b5c570865ebc899ab2c5d3ba119af98c Mon Sep 17 00:00:00 2001 From: Jason Benedetti Date: Fri, 23 Aug 2019 10:44:05 +0200 Subject: [PATCH 2/2] Increase the ask area capability to be extended - Encapsulate the main ask area buttons into a current state class (same comportment that the existing one on each service line). - Add simpler methods to add/remove classes on user interface on the same way that the existing "css" method. --- tarteaucitron.js | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/tarteaucitron.js b/tarteaucitron.js index 8814af2..07135ff 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -641,6 +641,18 @@ var tarteaucitron = { document.getElementById(id).style[property] = value; } }, + "addClass": function (id, className) { + "use strict"; + if (document.getElementById(id) !== null) { + document.getElementById(id).classList.add(className); + } + }, + "removeClass": function (id, className) { + "use strict"; + if (document.getElementById(id) !== null) { + document.getElementById(id).classList.remove(className); + } + }, "respondAll": function (status) { "use strict"; var s = tarteaucitron.services, @@ -728,14 +740,23 @@ var tarteaucitron = { tarteaucitron.userInterface.css(c + 'DotRed', 'width', ((100 / sum) * nbDenied) + '%'); if (nbDenied === 0 && nbPending === 0) { - document.getElementById(c + 'AllDenied').classList.remove('tarteaucitronIsSelected'); - document.getElementById(c + 'AllAllowed').classList.add('tarteaucitronIsSelected'); + tarteaucitron.userInterface.removeClass(c + 'AllDenied', c + 'IsSelected'); + tarteaucitron.userInterface.addClass(c + 'AllAllowed', c + 'IsSelected'); + + tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsAllowed'); + tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied'); } else if (nbAllowed === 0 && nbPending === 0) { - document.getElementById(c + 'AllAllowed').classList.remove('tarteaucitronIsSelected'); - document.getElementById(c + 'AllDenied').classList.add('tarteaucitronIsSelected'); + tarteaucitron.userInterface.removeClass(c + 'AllAllowed', c + 'IsSelected'); + tarteaucitron.userInterface.addClass(c + 'AllDenied', c + 'IsSelected'); + + tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsAllowed'); + tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsDenied'); } else { - document.getElementById(c + 'AllDenied').classList.remove('tarteaucitronIsSelected'); - document.getElementById(c + 'AllAllowed').classList.remove('tarteaucitronIsSelected'); + tarteaucitron.userInterface.removeClass(c + 'AllAllowed', c + 'IsSelected'); + tarteaucitron.userInterface.removeClass(c + 'AllDenied', c + 'IsSelected'); + + tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsAllowed'); + tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied'); } // close the alert if all service have been reviewed