|
@@ -293,7 +293,7 @@ var tarteaucitron = {
|
|
|
}
|
|
|
document.getElementsByTagName('head')[0].appendChild(customThemePopup);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
var body = document.body,
|
|
|
div = document.createElement('div'),
|
|
|
html = '',
|
|
@@ -311,7 +311,7 @@ var tarteaucitron = {
|
|
|
// Step 3: prepare the html
|
|
|
html += '<div id="tarteaucitronPremium"></div>';
|
|
|
html += '<button type="button" id="tarteaucitronBack" aria-label="' + tarteaucitron.lang.close + '"></button>';
|
|
|
- html += '<div id="tarteaucitron" role="dialog" aria-labelledby="dialogTitle">';
|
|
|
+ html += '<div id="tarteaucitron" role="dialog" aria-modal="true" aria-describedby="tarteaucitronInfo" aria-labelledby="dialogTitle" tabindex="-1">';
|
|
|
html += ' <button type="button" id="tarteaucitronClosePanel">';
|
|
|
html += ' ' + tarteaucitron.lang.close;
|
|
|
html += ' </button>';
|
|
@@ -622,15 +622,15 @@ var tarteaucitron = {
|
|
|
var html = '';
|
|
|
html += '<li class="tarteaucitronLine">';
|
|
|
html += ' <div class="tarteaucitronName">';
|
|
|
- html += ' <span class="tarteaucitronH3" role="heading" aria-level="3">'+tarteaucitron.lang[cat].title+'</span>';
|
|
|
+ html += ' <span class="tarteaucitronH3" role="heading" aria-level="2">'+tarteaucitron.lang[cat].title+'</span>';
|
|
|
html += ' <span>'+tarteaucitron.lang[cat].details+'</span>';
|
|
|
- html += ' <button type="button" class="tarteaucitron-toggle-group" id="tarteaucitron-toggle-group-'+cat+'">'+tarteaucitron.lang.alertSmall+' ('+document.getElementById("tarteaucitronServices_"+cat).childElementCount+')</button>';
|
|
|
+ html += ' <button type="button" aria-expanded="false" class="tarteaucitron-toggle-group" id="tarteaucitron-toggle-group-'+cat+'">'+tarteaucitron.lang.alertSmall+' ('+document.getElementById("tarteaucitronServices_"+cat).childElementCount+')</button>';
|
|
|
html += ' </div>';
|
|
|
html += ' <div class="tarteaucitronAsk" id="tarteaucitron-group-'+cat+'">';
|
|
|
- html += ' <button type="button" class="tarteaucitronAllow" id="tarteaucitron-accept-group-'+cat+'">';
|
|
|
+ html += ' <button type="button" aria-label="' + tarteaucitron.lang.allow + ' ' + tarteaucitron.lang[cat].title + '" class="tarteaucitronAllow" id="tarteaucitron-accept-group-'+cat+'">';
|
|
|
html += ' <span class="tarteaucitronCheck"></span> ' + tarteaucitron.lang.allow;
|
|
|
html += ' </button> ';
|
|
|
- html += ' <button type="button" class="tarteaucitronDeny" id="tarteaucitron-reject-group-'+cat+'">';
|
|
|
+ html += ' <button type="button" aria-label="' + tarteaucitron.lang.deny + ' ' + tarteaucitron.lang[cat].title + '" class="tarteaucitronDeny" id="tarteaucitron-reject-group-'+cat+'">';
|
|
|
html += ' <span class="tarteaucitronCross"></span> ' + tarteaucitron.lang.deny;
|
|
|
html += ' </button>';
|
|
|
html += ' </div>';
|
|
@@ -643,8 +643,10 @@ var tarteaucitron = {
|
|
|
tarteaucitron.userInterface.toggle('tarteaucitronServices_' + cat);
|
|
|
if (document.getElementById('tarteaucitronServices_' + cat).style.display == 'block') {
|
|
|
tarteaucitron.userInterface.addClass('tarteaucitronServicesTitle_' + cat, 'tarteaucitronIsExpanded');
|
|
|
+ document.getElementById('tarteaucitron-toggle-group-'+cat).setAttribute('aria-expanded', 'true');
|
|
|
} else {
|
|
|
tarteaucitron.userInterface.removeClass('tarteaucitronServicesTitle_' + cat, 'tarteaucitronIsExpanded');
|
|
|
+ document.getElementById('tarteaucitron-toggle-group-'+cat).setAttribute('aria-expanded', 'false');
|
|
|
}
|
|
|
});
|
|
|
tarteaucitron.addClickEventToId("tarteaucitron-accept-group-" + cat, function () {
|
|
@@ -660,7 +662,7 @@ var tarteaucitron = {
|
|
|
|
|
|
// add a little timeout to be sure everything is accessible
|
|
|
setTimeout(function () {
|
|
|
-
|
|
|
+
|
|
|
// Setup events
|
|
|
tarteaucitron.addClickEventToId("tarteaucitronCloseCross", function () {
|
|
|
tarteaucitron.userInterface.closeAlert();
|
|
@@ -735,7 +737,7 @@ var tarteaucitron = {
|
|
|
tarteaucitron.events.load();
|
|
|
}
|
|
|
}, 500);
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
});
|
|
|
},
|
|
@@ -778,17 +780,17 @@ var tarteaucitron = {
|
|
|
html += ' ' + tarteaucitron.lang.more;
|
|
|
html += ' </a>';
|
|
|
html += ' <span class="tarteaucitronReadmoreSeparator"> - </span>';
|
|
|
- html += ' <a href="' + service.uri + '" target="_blank" rel="noreferrer noopener" title="' + service.name + ' ' + tarteaucitron.lang.newWindow + '" class="tarteaucitronReadmoreOfficial">';
|
|
|
+ html += ' <a href="' + service.uri + '" target="_blank" rel="noreferrer noopener" title="' + tarteaucitron.lang.source + ' ' + service.name + ' ' + tarteaucitron.lang.newWindow + '" class="tarteaucitronReadmoreOfficial">';
|
|
|
html += ' ' + tarteaucitron.lang.source;
|
|
|
html += ' </a>';
|
|
|
}
|
|
|
|
|
|
html += ' </div>';
|
|
|
html += ' <div class="tarteaucitronAsk">';
|
|
|
- html += ' <button type="button" id="' + service.key + 'Allowed" class="tarteaucitronAllow">';
|
|
|
+ html += ' <button type="button" aria-label="' + tarteaucitron.lang.allow + ' ' + service.name + '" id="' + service.key + 'Allowed" class="tarteaucitronAllow">';
|
|
|
html += ' <span class="tarteaucitronCheck"></span> ' + tarteaucitron.lang.allow;
|
|
|
html += ' </button> ';
|
|
|
- html += ' <button type="button" id="' + service.key + 'Denied" class="tarteaucitronDeny">';
|
|
|
+ html += ' <button type="button" aria-label="' + tarteaucitron.lang.deny + ' ' + service.name + '" id="' + service.key + 'Denied" class="tarteaucitronDeny">';
|
|
|
html += ' <span class="tarteaucitronCross"></span> ' + tarteaucitron.lang.deny;
|
|
|
html += ' </button>';
|
|
|
html += ' </div>';
|
|
@@ -909,12 +911,12 @@ var tarteaucitron = {
|
|
|
} else {
|
|
|
|
|
|
document.getElementById(id).style[property] = value;
|
|
|
-
|
|
|
+
|
|
|
if (property == "display" && value == "block" && (id == "tarteaucitron" || id == "tarteaucitronAlertBig")) {
|
|
|
document.getElementById(id).style["opacity"] = "0";
|
|
|
setTimeout(function() {document.getElementById(id).style["opacity"] = "1";}, 1);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (property == "display" && value == "block" && id == "tarteaucitronBack") {
|
|
|
document.getElementById(id).style["opacity"] = "0";
|
|
|
setTimeout(function() {document.getElementById(id).style["opacity"] = "0.7";}, 1);
|
|
@@ -1031,9 +1033,16 @@ var tarteaucitron = {
|
|
|
if (status === true) {
|
|
|
tarteaucitron.userInterface.addClass(key + 'Line', 'tarteaucitronIsAllowed');
|
|
|
tarteaucitron.userInterface.removeClass(key + 'Line', 'tarteaucitronIsDenied');
|
|
|
+ document.getElementById(key + 'Allowed').setAttribute('aria-pressed', 'true');
|
|
|
+ document.getElementById(key + 'Denied').setAttribute('aria-pressed', 'false');
|
|
|
} else if (status === false) {
|
|
|
tarteaucitron.userInterface.removeClass(key + 'Line', 'tarteaucitronIsAllowed');
|
|
|
tarteaucitron.userInterface.addClass(key + 'Line', 'tarteaucitronIsDenied');
|
|
|
+ document.getElementById(key + 'Allowed').setAttribute('aria-pressed', 'false');
|
|
|
+ document.getElementById(key + 'Denied').setAttribute('aria-pressed', 'true');
|
|
|
+ } else {
|
|
|
+ document.getElementById(key + 'Allowed').setAttribute('aria-pressed', 'false');
|
|
|
+ document.getElementById(key + 'Denied').setAttribute('aria-pressed', 'false');
|
|
|
}
|
|
|
|
|
|
// check if all services are allowed
|
|
@@ -1065,18 +1074,29 @@ var tarteaucitron = {
|
|
|
|
|
|
tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsAllowed');
|
|
|
tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied');
|
|
|
+
|
|
|
+ document.getElementById(c + 'AllDenied').setAttribute('aria-pressed', 'false');
|
|
|
+ document.getElementById(c + 'AllAllowed').setAttribute('aria-pressed', 'true');
|
|
|
+
|
|
|
} else if (nbAllowed === 0 && nbPending === 0) {
|
|
|
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');
|
|
|
+
|
|
|
+ document.getElementById(c + 'AllDenied').setAttribute('aria-pressed', 'true');
|
|
|
+ document.getElementById(c + 'AllAllowed').setAttribute('aria-pressed', 'false');
|
|
|
+
|
|
|
} else {
|
|
|
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');
|
|
|
+
|
|
|
+ document.getElementById(c + 'AllDenied').setAttribute('aria-pressed', 'false');
|
|
|
+ document.getElementById(c + 'AllAllowed').setAttribute('aria-pressed', 'false');
|
|
|
}
|
|
|
|
|
|
// close the alert if all service have been reviewed
|
|
@@ -1111,26 +1131,41 @@ var tarteaucitron = {
|
|
|
groupallowed = 0;
|
|
|
for (var ii = 0; ii < doc.children.length; ii++) {
|
|
|
if (doc.children[ii].className == "tarteaucitronLine tarteaucitronIsDenied") {
|
|
|
- groupdenied++;
|
|
|
+ groupdenied++;
|
|
|
}
|
|
|
if (doc.children[ii].className == "tarteaucitronLine tarteaucitronIsAllowed") {
|
|
|
- groupallowed++;
|
|
|
+ groupallowed++;
|
|
|
}
|
|
|
}
|
|
|
if (total === groupallowed) {
|
|
|
tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsDenied');
|
|
|
tarteaucitron.userInterface.addClass('tarteaucitron-group-'+cat, 'tarteaucitronIsAllowed');
|
|
|
+
|
|
|
+ if (document.getElementById('tarteaucitron-reject-group-'+cat)) {
|
|
|
+ document.getElementById('tarteaucitron-reject-group-'+cat).setAttribute('aria-pressed', 'false');
|
|
|
+ document.getElementById('tarteaucitron-accept-group-'+cat).setAttribute('aria-pressed', 'true');
|
|
|
+ }
|
|
|
}
|
|
|
if (total === groupdenied) {
|
|
|
tarteaucitron.userInterface.addClass('tarteaucitron-group-'+cat, 'tarteaucitronIsDenied');
|
|
|
tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsAllowed');
|
|
|
+
|
|
|
+ if (document.getElementById('tarteaucitron-reject-group-'+cat)) {
|
|
|
+ document.getElementById('tarteaucitron-reject-group-'+cat).setAttribute('aria-pressed', 'true');
|
|
|
+ document.getElementById('tarteaucitron-accept-group-'+cat).setAttribute('aria-pressed', 'false');
|
|
|
+ }
|
|
|
}
|
|
|
if (total !== groupdenied && total !== groupallowed) {
|
|
|
tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsDenied');
|
|
|
tarteaucitron.userInterface.removeClass('tarteaucitron-group-'+cat, 'tarteaucitronIsAllowed');
|
|
|
+
|
|
|
+ if (document.getElementById('tarteaucitron-reject-group-'+cat)) {
|
|
|
+ document.getElementById('tarteaucitron-reject-group-'+cat).setAttribute('aria-pressed', 'false');
|
|
|
+ document.getElementById('tarteaucitron-accept-group-'+cat).setAttribute('aria-pressed', 'false');
|
|
|
+ }
|
|
|
}
|
|
|
- groupdenied = 0;
|
|
|
- groupallowed = 0;
|
|
|
+ groupdenied = 0;
|
|
|
+ groupallowed = 0;
|
|
|
});
|
|
|
|
|
|
},
|
|
@@ -1534,9 +1569,13 @@ var tarteaucitron = {
|
|
|
var i;
|
|
|
|
|
|
for (i = 0; i < arr.length; i += 1) {
|
|
|
- document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/;';
|
|
|
- document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname + ';';
|
|
|
- document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname.split('.').slice(-2).join('.') + ';';
|
|
|
+
|
|
|
+ var rgxpCookie = new RegExp("^(.*;)?\\s*" + arr[i] + "\\s*=\\s*[^;]+(.*)?$");
|
|
|
+ if (document.cookie.match(rgxpCookie)) {
|
|
|
+ document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/;';
|
|
|
+ document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname + ';';
|
|
|
+ document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname.split('.').slice(-2).join('.') + ';';
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
"checkCount": function (key) {
|
|
@@ -1690,7 +1729,7 @@ var tarteaucitron = {
|
|
|
"getLanguage": function () {
|
|
|
"use strict";
|
|
|
|
|
|
- var availableLanguages = 'bg,ca,cn,cs,da,de,el,en,es,fi,fr,hu,it,ja,lv,nl,no,oc,pl,pt,ro,ru,se,sk,sv,tr,vi,zh',
|
|
|
+ var availableLanguages = 'bg,ca,cn,cs,da,de,el,en,es,fi,fr,hu,it,ja,lt,lv,nl,no,oc,pl,pt,ro,ru,se,sk,sv,tr,vi,zh',
|
|
|
defaultLanguage = 'en';
|
|
|
|
|
|
if (tarteaucitronForceLanguage !== '') {
|
|
@@ -1911,7 +1950,7 @@ var tarteaucitron = {
|
|
|
},
|
|
|
"proPing": function () {
|
|
|
"use strict";
|
|
|
- if (tarteaucitron.uuid !== '' && tarteaucitron.uuid !== undefined && tarteaucitron.proTemp !== '') {
|
|
|
+ if (tarteaucitron.uuid !== '' && tarteaucitron.uuid !== undefined && tarteaucitron.proTemp !== '' && tarteaucitronStatsEnabled) {
|
|
|
var div = document.getElementById('tarteaucitronPremium'),
|
|
|
timestamp = new Date().getTime(),
|
|
|
url = 'https://tarteaucitron.io/log/?';
|
|
@@ -1936,7 +1975,7 @@ var tarteaucitron = {
|
|
|
/**
|
|
|
Utility function to Add or update the fields of obj1 with the ones in obj2
|
|
|
*/
|
|
|
- for(key in custom){
|
|
|
+ for(var key in custom){
|
|
|
if(custom[key] instanceof Object){
|
|
|
source[key] = tarteaucitron.AddOrUpdate(source[key], custom[key]);
|
|
|
}else{
|