Skip to content

Commit

Permalink
BUGFIX: browser compatibility - IE11 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jobee committed Dec 7, 2020
1 parent 676db93 commit 87aa91a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
function getKlaroServiceTitles() {
let services = klaro.getManager().config.services;
document.querySelectorAll('[data-klaro-service-title]').forEach(item => {
let serviceTitlePlaceholders = document.querySelectorAll('[data-klaro-service-title]');
Array.prototype.forEach.call(serviceTitlePlaceholders, function (serviceTitlePlaceholder) {
for (var i=0; i < services.length; i++) {
if (services[i].name === item.getAttribute('data-klaro-service-title')) {
item.innerHTML = services[i].title;
if (services[i].name === serviceTitlePlaceholder.getAttribute('data-klaro-service-title')) {
serviceTitlePlaceholder.innerHTML = services[i].title;
}
}
});
}
document.addEventListener("DOMContentLoaded", getKlaroServiceTitles);

document.querySelectorAll('[data-consent-button]').forEach(item => {
item.addEventListener('click', event => {
let tmsConsentButtons = document.querySelectorAll('[data-consent-button]');
Array.prototype.forEach.call(tmsConsentButtons, function (tmsConsentButton) {
tmsConsentButton.addEventListener('click', event => {
event.preventDefault();
let serviceName = item.getAttribute('data-name');
let serviceName = tmsConsentButton.getAttribute('data-name');
if (serviceName) {
let manager = klaro.getManager();
manager.updateConsent(serviceName, true)
Expand Down
9 changes: 5 additions & 4 deletions Resources/Public/JavaScript/NoConsentPlaceholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ function toggleNoConsentPlaceholders(consent, service) {
var serviceName = service.name;
var serviceConsent = consent;

document.querySelectorAll('.tms-consent_no-consent-placeholder').forEach(item => {
if (serviceName !== item.dataset.name)
let noConsentPlaceholders = document.querySelectorAll('.tms-consent_no-consent-placeholder');
Array.prototype.forEach.call(noConsentPlaceholders, function (noConsentPlaceholder) {
if (serviceName !== noConsentPlaceholder.dataset.name)
return;

if (serviceConsent === false) {
item.classList.add('consent-needed');
noConsentPlaceholder.classList.add('consent-needed');
} else {
item.classList.remove('consent-needed');
noConsentPlaceholder.classList.remove('consent-needed');
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/Public/JavaScript/main.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Public/JavaScript/main.bundle.js.map

Large diffs are not rendered by default.

0 comments on commit 87aa91a

Please sign in to comment.