From 6c619befdb14920725f33e7b6d7d155ee4248baa Mon Sep 17 00:00:00 2001 From: Ingo Winter Date: Mon, 18 Nov 2019 00:22:51 +0100 Subject: [PATCH] =?UTF-8?q?Unterst=C3=BCtzung=20IE=20>=3D=209?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/iwcc_frontend.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/assets/iwcc_frontend.js b/assets/iwcc_frontend.js index dcb3888..528e668 100644 --- a/assets/iwcc_frontend.js +++ b/assets/iwcc_frontend.js @@ -1,3 +1,14 @@ +// get IE version https://stackoverflow.com/a/19999868 +function iwccIEVersion(){var n=window.navigator.userAgent,i=n.indexOf("MSIE ");return i>0?parseInt(n.substring(i+5,n.indexOf(".",i))):-1} +// element.classList polyfill http://purl.eligrey.com/github/classList.js/blob/master/classList.js +"document"in self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||!function(t){"use strict";if("Element"in t){var e="classList",n="prototype",i=t.Element[n],s=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},o=Array[n].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},c=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},a=function(t,e){if(""===e)throw new c("SYNTAX_ERR","The token must not be empty.");if(/\s/.test(e))throw new c("INVALID_CHARACTER_ERR","The token must not contain space characters.");return o.call(t,e)},l=function(t){for(var e=r.call(t.getAttribute("class")||""),n=e?e.split(/\s+/):[],i=0,s=n.length;s>i;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute("class",this.toString())}},u=l[n]=[],h=function(){return new l(this)};if(c[n]=Error[n],u.item=function(t){return this[t]||null},u.contains=function(t){return~a(this,t+"")},u.add=function(){var t,e=arguments,n=0,i=e.length,s=!1;do t=e[n]+"",~a(this,t)||(this.push(t),s=!0);while(++nn;n++)t=arguments[n],e.call(this,t)}};e("add"),e("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:n.call(this,t)}}"replace"in document.createElement("_").classList||(DOMTokenList.prototype.replace=function(t,e){var n=this.toString().split(" "),i=n.indexOf(t+"");~i&&(n=n.slice(i),this.remove.apply(this,n),this.add(e),this.add.apply(this,n.slice(1)))}),t=null}()); +// DOMParser polyfill https://gist.github.com/1129031 +!function(t){"use strict";var e=t.prototype,r=e.parseFromString;try{if((new t).parseFromString("","text/html"))return}catch(t){}e.parseFromString=function(t,e){if(/^\s*text\/html\s*(?:;|$)/i.test(e)){var n=document.implementation.createHTMLDocument("");return t.toLowerCase().indexOf("-1?n.documentElement.innerHTML=t:n.body.innerHTML=t,n}return r.apply(this,arguments)}}(DOMParser); +// nodelist.forEach polyfill https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach +if (window.NodeList && !NodeList.prototype.forEach){NodeList.prototype.forEach = Array.prototype.forEach;} +// node.remove polyfill https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md +[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach(function(e){e.hasOwnProperty("remove")||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){null!==this.parentNode&&this.parentNode.removeChild(this)}})}); + document.addEventListener('DOMContentLoaded', function () { var expires = new Date(), @@ -30,12 +41,25 @@ document.addEventListener('DOMContentLoaded', function () iwccBox = iwccBox.getElementById('iwcc-background'); document.querySelectorAll('body')[0].appendChild(iwccBox); + if (iwccIEVersion() === 9) + { + iwccBox.querySelectorAll('.iwcc-cookiegroup-checkbox').forEach(function (el) + { + el.classList.remove('pretty'); + el.querySelectorAll('.icon').forEach(function (icon) + { + icon.remove(); + }) + }); + } + for (var key in consents) { addScript(iwccBox.querySelector('[data-uid="' + key + '"]')); } - if (iwccBox.classList.contains('iwcc-initially-hidden')) { + if (iwccBox.classList.contains('iwcc-initially-hidden')) + { show = 0; } @@ -155,7 +179,8 @@ document.addEventListener('DOMContentLoaded', function () for (var key in consents) { checkbox = iwccBox.querySelector('[data-uid="' + key + '"]'); - if (!checkbox) { + if (!checkbox) + { continue; } checkbox.checked = true;