From 04121152b8cdaba8ad9d98bf13b4b14c50225906 Mon Sep 17 00:00:00 2001 From: Daniel Schuster Date: Thu, 28 Nov 2019 19:01:40 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Pr=C3=A4fix=20f=C3=BCr=20Cookie=20als=20con?= =?UTF-8?q?fig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/2ClickIframePrivacy.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/2ClickIframePrivacy.js b/src/2ClickIframePrivacy.js index d3a0b6a..f261f5b 100644 --- a/src/2ClickIframePrivacy.js +++ b/src/2ClickIframePrivacy.js @@ -9,8 +9,10 @@ var config = { enableCookies: true, - useSessionCookie: true + useSessionCookie: true, + cookieNamespace: '_2ClickIPEnable-' }; + this.types = new Array( { type: 'video', @@ -73,10 +75,10 @@ if(remind){ if(config.useSessionCookie){ - setSessionCookie('_2ClickIPEnable-'+type, '1'); + setSessionCookie(config.cookieNamespace+type, '1'); } else{ - setCookie('_2ClickIPEnable-'+type, '1', 30); + setCookie(config.cookieNamespace+type, '1', 30); } } } @@ -111,6 +113,10 @@ if (typeof Userconfig.useSessionCookie !== 'undefined') { config.useSessionCookie = Userconfig.useSessionCookie; } + if (typeof Userconfig.cookieNamespace !== 'undefined') { + config.cookieNamespace = Userconfig.cookieNamespace; + } + if (Array.isArray(Userconfig.CustomTypes)) { this.types = Userconfig.CustomTypes; @@ -119,7 +125,7 @@ for (i = 0; i < this.types.length; i++) { var selector = document.getElementsByClassName(this.types[i].class); var x; - if(!getCookie('_2ClickIPEnable-'+this.types[i].type)){ + if(!getCookie(config.cookieNamespace+this.types[i].type)){ for (x = 0; x < selector.length; x++) { wrap(selector[x], document.createElement('div'), this.types[i].type, this.types[i].class, this.types[i].description); } From 923333ac4a0c211870aad899bdb8fc5b09925714 Mon Sep 17 00:00:00 2001 From: Daniel Schuster Date: Thu, 28 Nov 2019 19:33:21 +0100 Subject: [PATCH 2/2] Url und Labels als config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Url der Datenschutzerklärung sowie Labels für den Link zur Datenschutzerklärung, Inhalt anzeigen und Auswahl merken als config --- src/2ClickIframePrivacy.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/2ClickIframePrivacy.js b/src/2ClickIframePrivacy.js index f261f5b..c0ad0b7 100644 --- a/src/2ClickIframePrivacy.js +++ b/src/2ClickIframePrivacy.js @@ -10,7 +10,11 @@ var config = { enableCookies: true, useSessionCookie: true, - cookieNamespace: '_2ClickIPEnable-' + cookieNamespace: '_2ClickIPEnable-', + showContentLabel: 'Inhalt anzeigen', + rememberChoiceLabel: 'Auswahl merken', + privacyPolicyLabel: 'Datenschutzerklärung', + privacyPolicyUrl: false }; this.types = new Array( @@ -51,9 +55,12 @@ wrapper.className = 'privacy-msg '+selclass+'-msg'; wrapper.style.width = el.clientWidth+'px'; wrapper.style.height = el.clientHeight+'px'; - wrapper.innerHTML = text +'Inhalt anzeigen'; + wrapper.innerHTML = text +''+config.showContentLabel+''; if(config.enableCookies){ - wrapper.innerHTML = wrapper.innerHTML + '
'; + wrapper.innerHTML = wrapper.innerHTML + '
'; + } + if(config.privacyPolicyUrl){ + wrapper.innerHTML = wrapper.innerHTML + '
'+config.privacyPolicyLabel+''; } wrapper.innerHTML = '

' + wrapper.innerHTML + '

'; wrapper.appendChild(el); @@ -116,7 +123,18 @@ if (typeof Userconfig.cookieNamespace !== 'undefined') { config.cookieNamespace = Userconfig.cookieNamespace; } - + if (typeof Userconfig.privacyPolicyUrl !== 'undefined') { + config.privacyPolicyUrl = Userconfig.privacyPolicyUrl; + } + if (typeof Userconfig.showContentLabel !== 'undefined') { + config.showContentLabel = Userconfig.showContentLabel; + } + if (typeof Userconfig.rememberChoiceLabel !== 'undefined') { + config.rememberChoiceLabel = Userconfig.rememberChoiceLabel; + } + if (typeof Userconfig.privacyPolicyLabel !== 'undefined') { + config.privacyPolicyLabel = Userconfig.privacyPolicyLabel; + } if (Array.isArray(Userconfig.CustomTypes)) { this.types = Userconfig.CustomTypes;