Some fix for 🦕 browsers

This commit is contained in:
Amauri CHAMPEAUX 2021-05-09 12:11:32 +02:00
parent e6bda65fd8
commit 74bff595d2
2 changed files with 27 additions and 30 deletions

View File

@ -17,7 +17,7 @@ var scripts = document.getElementsByTagName('script'),
var tarteaucitron = { var tarteaucitron = {
"version": 20210422, "version": 20210509,
"cdn": cdn, "cdn": cdn,
"user": {}, "user": {},
"lang": {}, "lang": {},
@ -517,13 +517,13 @@ var tarteaucitron = {
var tacRootAvailableEvent; var tacRootAvailableEvent;
if(typeof(Event) === 'function') { if(typeof(Event) === 'function') {
tacRootAvailableEvent = new Event("tac.root_available"); tacRootAvailableEvent = new Event("tac.root_available");
}else{ }else if (typeof(document.createEvent) === 'function'){
tacRootAvailableEvent = document.createEvent('Event'); tacRootAvailableEvent = document.createEvent('Event');
tacRootAvailableEvent.initEvent("tac.root_available", true, true); tacRootAvailableEvent.initEvent("tac.root_available", true, true);
} }
//end ie compatibility //end ie compatibility
window.dispatchEvent(tacRootAvailableEvent); if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacRootAvailableEvent);}
if (tarteaucitron.job !== undefined) { if (tarteaucitron.job !== undefined) {
tarteaucitron.job = tarteaucitron.cleanArray(tarteaucitron.job); tarteaucitron.job = tarteaucitron.cleanArray(tarteaucitron.job);
@ -862,7 +862,7 @@ var tarteaucitron = {
var send_event_item; var send_event_item;
if(typeof(Event) === 'function') { if(typeof(Event) === 'function') {
send_event_item = new Event(event_key); send_event_item = new Event(event_key);
}else{ }else if (typeof(document.createEvent) === 'function'){
send_event_item = document.createEvent('Event'); send_event_item = document.createEvent('Event');
send_event_item.initEvent(event_key, true, true); send_event_item.initEvent(event_key, true, true);
} }
@ -923,13 +923,13 @@ var tarteaucitron = {
}, },
"addClass": function (id, className) { "addClass": function (id, className) {
"use strict"; "use strict";
if (document.getElementById(id) !== null) { if (document.getElementById(id) !== null && document.getElementById(id).classList !== undefined) {
document.getElementById(id).classList.add(className); document.getElementById(id).classList.add(className);
} }
}, },
"removeClass": function (id, className) { "removeClass": function (id, className) {
"use strict"; "use strict";
if (document.getElementById(id) !== null) { if (document.getElementById(id) !== null && document.getElementById(id).classList !== undefined) {
document.getElementById(id).classList.remove(className); document.getElementById(id).classList.remove(className);
} }
}, },
@ -1028,11 +1028,11 @@ var tarteaucitron = {
if (key !== "") { if (key !== "") {
if (status === true) { if (status === true) {
document.getElementById(key + 'Line').classList.add('tarteaucitronIsAllowed'); tarteaucitron.userInterface.addClass(key + 'Line', 'tarteaucitronIsAllowed');
document.getElementById(key + 'Line').classList.remove('tarteaucitronIsDenied'); tarteaucitron.userInterface.removeClass(key + 'Line', 'tarteaucitronIsDenied');
} else if (status === false) { } else if (status === false) {
document.getElementById(key + 'Line').classList.remove('tarteaucitronIsAllowed'); tarteaucitron.userInterface.removeClass(key + 'Line', 'tarteaucitronIsAllowed');
document.getElementById(key + 'Line').classList.add('tarteaucitronIsDenied'); tarteaucitron.userInterface.addClass(key + 'Line', 'tarteaucitronIsDenied');
} }
// check if all services are allowed // check if all services are allowed
@ -1141,7 +1141,9 @@ var tarteaucitron = {
tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none'); tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
document.getElementById('tarteaucitronClosePanel').focus(); document.getElementById('tarteaucitronClosePanel').focus();
document.getElementsByTagName('body')[0].classList.add('tarteaucitron-modal-open'); if (document.getElementsByTagName('body')[0].classList !== undefined) {
document.getElementsByTagName('body')[0].classList.add('tarteaucitron-modal-open');
}
tarteaucitron.userInterface.focusTrap(); tarteaucitron.userInterface.focusTrap();
tarteaucitron.userInterface.jsSizing('main'); tarteaucitron.userInterface.jsSizing('main');
@ -1149,13 +1151,13 @@ var tarteaucitron = {
var tacOpenPanelEvent; var tacOpenPanelEvent;
if(typeof(Event) === 'function') { if(typeof(Event) === 'function') {
tacOpenPanelEvent = new Event("tac.open_panel"); tacOpenPanelEvent = new Event("tac.open_panel");
}else{ }else if (typeof(document.createEvent) === 'function'){
tacOpenPanelEvent = document.createEvent('Event'); tacOpenPanelEvent = document.createEvent('Event');
tacOpenPanelEvent.initEvent("tac.open_panel", true, true); tacOpenPanelEvent.initEvent("tac.open_panel", true, true);
} }
//end ie compatibility //end ie compatibility
window.dispatchEvent(tacOpenPanelEvent); if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacOpenPanelEvent);}
}, },
"closePanel": function () { "closePanel": function () {
"use strict"; "use strict";
@ -1182,19 +1184,21 @@ var tarteaucitron = {
if (document.getElementById('tarteaucitronCloseAlert') !== null) { if (document.getElementById('tarteaucitronCloseAlert') !== null) {
document.getElementById('tarteaucitronCloseAlert').focus(); document.getElementById('tarteaucitronCloseAlert').focus();
} }
document.getElementsByTagName('body')[0].classList.remove('tarteaucitron-modal-open'); if (document.getElementsByTagName('body')[0].classList !== undefined) {
document.getElementsByTagName('body')[0].classList.remove('tarteaucitron-modal-open');
}
//ie compatibility //ie compatibility
var tacClosePanelEvent; var tacClosePanelEvent;
if(typeof(Event) === 'function') { if(typeof(Event) === 'function') {
tacClosePanelEvent = new Event("tac.close_panel"); tacClosePanelEvent = new Event("tac.close_panel");
}else{ }else if (typeof(document.createEvent) === 'function'){
tacClosePanelEvent = document.createEvent('Event'); tacClosePanelEvent = document.createEvent('Event');
tacClosePanelEvent.initEvent("tac.close_panel", true, true); tacClosePanelEvent.initEvent("tac.close_panel", true, true);
} }
//end ie compatibility //end ie compatibility
window.dispatchEvent(tacClosePanelEvent); if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacClosePanelEvent);}
}, },
"focusTrap": function() { "focusTrap": function() {
"use strict"; "use strict";
@ -1249,7 +1253,7 @@ var tarteaucitron = {
var tacOpenAlertEvent; var tacOpenAlertEvent;
if(typeof(Event) === 'function') { if(typeof(Event) === 'function') {
tacOpenAlertEvent = new Event("tac.open_alert"); tacOpenAlertEvent = new Event("tac.open_alert");
}else{ }else if (typeof(document.createEvent) === 'function'){
tacOpenAlertEvent = document.createEvent('Event'); tacOpenAlertEvent = document.createEvent('Event');
tacOpenAlertEvent.initEvent("tac.open_alert", true, true); tacOpenAlertEvent.initEvent("tac.open_alert", true, true);
} }
@ -1259,7 +1263,7 @@ var tarteaucitron = {
document.getElementById('tarteaucitronAlertBig').focus(); document.getElementById('tarteaucitronAlertBig').focus();
} }
window.dispatchEvent(tacOpenAlertEvent); if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacOpenAlertEvent);}
}, },
"closeAlert": function () { "closeAlert": function () {
"use strict"; "use strict";
@ -1275,13 +1279,13 @@ var tarteaucitron = {
var tacCloseAlertEvent; var tacCloseAlertEvent;
if(typeof(Event) === 'function') { if(typeof(Event) === 'function') {
tacCloseAlertEvent = new Event("tac.close_alert"); tacCloseAlertEvent = new Event("tac.close_alert");
}else{ }else if (typeof(document.createEvent) === 'function'){
tacCloseAlertEvent = document.createEvent('Event'); tacCloseAlertEvent = document.createEvent('Event');
tacCloseAlertEvent.initEvent("tac.close_alert", true, true); tacCloseAlertEvent.initEvent("tac.close_alert", true, true);
} }
//end ie compatibility //end ie compatibility
window.dispatchEvent(tacCloseAlertEvent); if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacCloseAlertEvent);}
}, },
"toggleCookiesList": function () { "toggleCookiesList": function () {
"use strict"; "use strict";

View File

@ -357,7 +357,7 @@ tarteaucitron.services.facebookpost = {
"js": function () { "js": function () {
"use strict"; "use strict";
tarteaucitron.fallback(['tac_facebookpost'], function (x) { tarteaucitron.fallback(['tac_facebookpost'], function (x) {
var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Michel'), var frame_title = tarteaucitron.fixSelfXSS(x.getAttribute("title") || 'Facebook iframe'),
width = x.getAttribute("width"), width = x.getAttribute("width"),
height = x.getAttribute("height"), height = x.getAttribute("height"),
url = x.getAttribute("data-url"), url = x.getAttribute("data-url"),
@ -1826,14 +1826,7 @@ tarteaucitron.services.gtag = {
* https://support.google.com/analytics/answer/7476333?hl=en * https://support.google.com/analytics/answer/7476333?hl=en
* https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain * https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain
*/ */
gtag( gtag('config',tarteaucitron.user.gtagUa,{ 'anonymize_ip': true },{linker: {domains: tarteaucitron.user.gtagCrossdomain,}});
'config',
tarteaucitron.user.gtagUa,
{ 'anonymize_ip': true },
{linker: {
domains: tarteaucitron.user.gtagCrossdomain,
}},
);
} else { } else {
gtag('config', tarteaucitron.user.gtagUa, { 'anonymize_ip': true }); gtag('config', tarteaucitron.user.gtagUa, { 'anonymize_ip': true });
} }
@ -3158,7 +3151,7 @@ tarteaucitron.services.verizondottag = {
}); });
tarteaucitron.addScript('https://s.yimg.com/wi/ytc.js', '', function () { tarteaucitron.addScript('https://s.yimg.com/wi/ytc.js', '', function () {
const items = window.dotq; //const items = window.dotq;
window.dotq = []; window.dotq = [];
window.dotq.push = function (item) { window.dotq.push = function (item) {
YAHOO.ywa.I13N.fireBeacon([item]) YAHOO.ywa.I13N.fireBeacon([item])