Ver código fonte

Merge pull request #266 from Adysone/master

Remove the hardcoded colors from the JS
Amauri CHAMPEAUX 6 anos atrás
pai
commit
3996698dc9
2 arquivos alterados com 34 adições e 26 exclusões
  1. 26 2
      css/tarteaucitron.css
  2. 8 24
      tarteaucitron.js

+ 26 - 2
css/tarteaucitron.css

@@ -371,6 +371,14 @@ div#tarteaucitronServices {
     padding: 15px 5px;
     padding: 15px 5px;
 }
 }
 
 
+#tarteaucitron #tarteaucitronServices .tarteaucitronLine.tarteaucitronIsAllowed {
+    border-color: #1B870B;
+}
+
+#tarteaucitron #tarteaucitronServices .tarteaucitronLine.tarteaucitronIsDenied {
+    border-color: #9C1A1A;
+}
+
 #tarteaucitron #tarteaucitronServices .tarteaucitronMainLine {
 #tarteaucitron #tarteaucitronServices .tarteaucitronMainLine {
     background: #333;
     background: #333;
     border: 3px solid #333;
     border: 3px solid #333;
@@ -432,6 +440,22 @@ div#tarteaucitronServices {
     border: 0;
     border: 0;
 }
 }
 
 
+#tarteaucitron #tarteaucitronServices #tarteaucitronAllAllowed.tarteaucitronIsSelected {
+    background-color: #1B870B;
+    opacity: 1;
+}
+#tarteaucitron #tarteaucitronServices #tarteaucitronAllDenied.tarteaucitronIsSelected {
+    background-color: #9C1A1A;
+    opacity: 1;
+}
+
+#tarteaucitron #tarteaucitronServices .tarteaucitronLine.tarteaucitronIsAllowed .tarteaucitronAllow {
+    background-color: #1B870B;
+}
+#tarteaucitron #tarteaucitronServices .tarteaucitronLine.tarteaucitronIsDenied .tarteaucitronDeny {
+    background-color: #9C1A1A;
+}
+
 #tarteaucitron #tarteaucitronServices .tarteaucitronLine .tarteaucitronName .tarteaucitronListCookies {
 #tarteaucitron #tarteaucitronServices .tarteaucitronLine .tarteaucitronName .tarteaucitronListCookies {
     color: #333;
     color: #333;
     font-size: 12px;
     font-size: 12px;
@@ -712,13 +736,13 @@ div.amazon_product {
 }.tarteaucitronIsDenied .tarteaucitronDeny {
 }.tarteaucitronIsDenied .tarteaucitronDeny {
     opacity: 1!important;
     opacity: 1!important;
 }
 }
-.tarteaucitronLine .tarteaucitronAllow, .tarteaucitronLine .tarteaucitronAllow {
+.tarteaucitronLine .tarteaucitronAllow, .tarteaucitronLine .tarteaucitronDeny {
     opacity: 0.4;
     opacity: 0.4;
 }
 }
 
 
 div#tarteaucitronInfo {
 div#tarteaucitronInfo {
     display: block!important;
     display: block!important;
-    position: initial!important;
+    position: relative;
     text-align: center!important;
     text-align: center!important;
     max-width: 80%!important;
     max-width: 80%!important;
     padding: 15px 0!important;
     padding: 15px 0!important;

+ 8 - 24
tarteaucitron.js

@@ -18,7 +18,7 @@ var scripts = document.getElementsByTagName('script'),
 
 
 
 
 var tarteaucitron = {
 var tarteaucitron = {
-    "version": 20181023,
+    "version": 20181120,
     "cdn": cdn,
     "cdn": cdn,
     "user": {},
     "user": {},
     "lang": {},
     "lang": {},
@@ -689,13 +689,7 @@ var tarteaucitron = {
         },
         },
         "color": function (key, status) {
         "color": function (key, status) {
             "use strict";
             "use strict";
-            var gray = '#808080',
-                greenDark = '#1B870B',
-                greenLight = '#E6FFE2',
-                redDark = '#9C1A1A',
-                redLight = '#FFE2E2',
-                yellowDark = '#FBDA26',
-                c = 'tarteaucitron',
+            var c = 'tarteaucitron',
                 nbDenied = 0,
                 nbDenied = 0,
                 nbPending = 0,
                 nbPending = 0,
                 nbAllowed = 0,
                 nbAllowed = 0,
@@ -703,17 +697,9 @@ var tarteaucitron = {
                 index;
                 index;
 
 
             if (status === true) {
             if (status === true) {
-                tarteaucitron.userInterface.css(key + 'Line', 'borderLeft', '5px solid ' + greenDark);
-                tarteaucitron.userInterface.css(key + 'Allowed', 'backgroundColor', greenDark);
-                tarteaucitron.userInterface.css(key + 'Denied', 'backgroundColor', gray);
-
                 document.getElementById(key + 'Line').classList.add('tarteaucitronIsAllowed');
                 document.getElementById(key + 'Line').classList.add('tarteaucitronIsAllowed');
                 document.getElementById(key + 'Line').classList.remove('tarteaucitronIsDenied');
                 document.getElementById(key + 'Line').classList.remove('tarteaucitronIsDenied');
             } else if (status === false) {
             } else if (status === false) {
-                tarteaucitron.userInterface.css(key + 'Line', 'borderLeft', '5px solid ' + redDark);
-                tarteaucitron.userInterface.css(key + 'Allowed', 'backgroundColor', gray);
-                tarteaucitron.userInterface.css(key + 'Denied', 'backgroundColor', redDark);
-
                 document.getElementById(key + 'Line').classList.remove('tarteaucitronIsAllowed');
                 document.getElementById(key + 'Line').classList.remove('tarteaucitronIsAllowed');
                 document.getElementById(key + 'Line').classList.add('tarteaucitronIsDenied');
                 document.getElementById(key + 'Line').classList.add('tarteaucitronIsDenied');
             }
             }
@@ -734,16 +720,14 @@ var tarteaucitron = {
             tarteaucitron.userInterface.css(c + 'DotRed', 'width', ((100 / sum) * nbDenied) + '%');
             tarteaucitron.userInterface.css(c + 'DotRed', 'width', ((100 / sum) * nbDenied) + '%');
 
 
             if (nbDenied === 0 && nbPending === 0) {
             if (nbDenied === 0 && nbPending === 0) {
-                tarteaucitron.userInterface.css(c + 'AllAllowed', 'backgroundColor', greenDark);
-                tarteaucitron.userInterface.css(c + 'AllDenied', 'opacity', '0.4');
-                tarteaucitron.userInterface.css(c + 'AllAllowed', 'opacity', '1');
+                document.getElementById(c + 'AllDenied').classList.remove('tarteaucitronIsSelected');
+                document.getElementById(c + 'AllAllowed').classList.add('tarteaucitronIsSelected');
             } else if (nbAllowed === 0 && nbPending === 0) {
             } else if (nbAllowed === 0 && nbPending === 0) {
-                tarteaucitron.userInterface.css(c + 'AllAllowed', 'opacity', '0.4');
-                tarteaucitron.userInterface.css(c + 'AllDenied', 'opacity', '1');
-                tarteaucitron.userInterface.css(c + 'AllDenied', 'backgroundColor', redDark);
+                document.getElementById(c + 'AllAllowed').classList.remove('tarteaucitronIsSelected');
+                document.getElementById(c + 'AllDenied').classList.add('tarteaucitronIsSelected');
             } else {
             } else {
-                tarteaucitron.userInterface.css(c + 'AllAllowed', 'opacity', '0.4');
-                tarteaucitron.userInterface.css(c + 'AllDenied', 'opacity', '0.4');
+                document.getElementById(c + 'AllDenied').classList.remove('tarteaucitronIsSelected');
+                document.getElementById(c + 'AllAllowed').classList.remove('tarteaucitronIsSelected');
             }
             }
 
 
             // close the alert if all service have been reviewed
             // close the alert if all service have been reviewed