iframe_single_optin
Version:
Single opt-in for iframe resources like google maps, youtube and vimeo.
1 lines • 6.4 kB
JavaScript
!function a(s,n,r){function o(t,e){if(!n[t]){if(!s[t]){var i="function"==typeof require&&require;if(!e&&i)return i(t,!0);if(u)return u(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}i=n[t]={exports:{}},s[t][0].call(i.exports,function(e){return o(s[t][1][e]||e)},i,i.exports,a,s,n,r)}return n[t].exports}for(var u="function"==typeof require&&require,e=0;e<r.length;e++)o(r[e]);return o}({1:[function(e,t,i){"use strict";i.__esModule=!0,i.IframeSingleOptIn=void 0;var u=e("../Language"),c=[{type:"googlemaps",name:"Google Maps"},{type:"youtube",name:"YouTube"},{type:"vimeo",name:"VIMEO"}],l=[{type:"googlemaps",url:"https://www.google.com/intl/de_DE/help/terms_maps/"},{type:"youtube",url:"https://policies.google.com/privacy"},{type:"vimeo",url:"https://vimeo.com/privacy"}];function a(e,t,i,a,s){void 0===a&&(a=!1),void 0===s&&(s={});var n,r,o=this;this._cssClass="isoi",this._language=new u.Language,this._container=e,this._service=t,this._serviceName=(n=this._service,(e=c.filter(function(e){return e.type==n}))[0]?e[0].name:null),this._serviceUrl=s&&"string"==typeof s.serviceUrl?s.serviceUrl:(r=this._service,(t=l.filter(function(e){return e.type==r}))[0]?t[0].url:null),this._serviceName&&this._serviceUrl?(this._iframeMarkup=i,this._isUrlEncoded=a,s&&s.cssClass&&(this._cssClass=s.cssClass),s&&"object"==typeof s.language&&Object.keys(s.language).forEach(function(e){o._language.data[e]=s.language[e],o._language.setLanguageKey(e)}),e="googlemaps"!==this._service,t={SERVICE_NAME:this._serviceName,SERVICE_URL:this._serviceUrl},this._titleText=s&&"string"==typeof s.titleText?s.titleText:this._language.get(e?"titleTextVideo":"titleTextMap",t),this._serviceUrlText=s&&"string"==typeof s.serviceUrlText?s.serviceUrlText:this._language.get("serviceUrlText",t),this._showText=s&&"string"==typeof s.showText?s.showText:this._language.get(e?"showTextVideo":"showTextMap",t),this._infoText=s&&"string"==typeof s.infoText?s.infoText:this._language.get(e?"infoTextVideo":"infoTextMap",t),this._init()):console.error("Service name or service url could not be determined!","Service: ".concat(this._service),"Service name: ".concat(this._serviceName),"Service URL: ".concat(this._serviceUrl))}a.prototype._init=function(){this._stage=this._createElement("DIV",this._cssClass+"__stage","",this._container),this._background=this._createElement("DIV",this._cssClass+"__background","",this._stage);var e,t=this._createElement("DIV",this._cssClass+"__interface","",this._stage),i=(this._titleText&&this._createElement("DIV",this._cssClass+"__title",this._titleText,t),this._infoText&&this._createElement("DIV",this._cssClass+"__info",this._infoText,t),this._serviceUrlText&&(e=this._createElement("DIV",this._cssClass+"__privacy-link","",t),(e=this._createElement("A",this._cssClass+"__privacy-link__anchor",this._serviceUrlText,e)).setAttribute("href",this._serviceUrl),e.setAttribute("target","_blank")),this._button=this._createElement("BUTTON",this._cssClass+"__button",this._showText,t),this._button.setAttribute("title",this._showText),this._button.setAttribute("type","button"),this);this._button.addEventListener("click",function(){i._container.removeChild(i._stage),i._container.innerHTML=i._isUrlEncoded?decodeURIComponent(i._iframeMarkup):i._iframeMarkup},!1)},a.prototype._createElement=function(e,t,i,a){e=document.createElement(e);return t&&e.setAttribute("class",t),i&&(e.innerHTML=i),a&&a.appendChild(e),e},i.IframeSingleOptIn=a},{"../Language":4}],2:[function(e,t,i){"use strict";i.__esModule=!0,i.data=void 0,i.data={titleTextVideo:"Wir benötigen Ihre Zustimmung, um das Video zu laden",titleTextMap:"Wir benötigen Ihre Zustimmung, um die Karte zu laden",serviceUrlText:"Mehr Informationen",showTextVideo:"{SERVICE_NAME} Video anzeigen",showTextMap:"{SERVICE_NAME} Karte anzeigen",infoTextVideo:"Wir verwenden einen Service eines Drittanbieters, um Videoinhalte einzubetten. Dieser Service kann Daten zu Ihren Aktivitäten sammeln. Bitte lesen Sie die Details durch und stimmen Sie der Nutzung des Service zu, um dieses Video anzuzeigen.",infoTextMap:"Wir verwenden einen Service eines Drittanbieters, um Karteninhalte einzubetten. Dieser Service kann Daten zu Ihren Aktivitäten sammeln. Bitte lesen Sie die Details durch und stimmen Sie der Nutzung des Service zu, um diese Karte anzuzeigen."}},{}],3:[function(e,t,i){"use strict";i.__esModule=!0,i.data=void 0,i.data={titleTextVideo:"We need your consent to load the video",titleTextMap:"We need your consent to load the map",serviceUrlText:"more information",showTextVideo:"show {SERVICE_NAME} video",showTextMap:"show {SERVICE_NAME}",infoTextVideo:"We use a third party service to embed video content. This service can collect data about your activities. Please read the details and agree to use the service to view this video.",infoTextMap:"We use a third party service to embed map content. This service can collect data about your activities. Please read the details and agree to use the service to view this map."}},{}],4:[function(e,t,i){"use strict";i.__esModule=!0,i.Language=void 0;var a=e("./LanguageData.default"),s=e("./LanguageData.de");function n(){var e=document.querySelector("html");this.setLanguageKey(e&&e.hasAttribute("lang")?e.getAttribute("lang"):"default"),this.data={default:a.data,de:s.data}}n.prototype.setLanguageKey=function(e){this.languageKey=e},n.prototype.get=function(e,t){var i="",i="object"==typeof this.data[this.languageKey]&&"string"==typeof this.data[this.languageKey][e]?this.data[this.languageKey][e]:"string"==typeof this.data.default[e]?this.data.default[e]:"["+e+"]";if("object"==typeof(t=void 0===t?{}:t))for(var a in t)i=i.replace("{"+a+"}",t[a]);return i},i.Language=n},{"./LanguageData.de":2,"./LanguageData.default":3}],5:[function(e,t,i){"use strict";i.__esModule=!0;var a=e("./IframeSingleOptIn"),s=document.querySelectorAll('[data-toggle="iframe-single-opt-in"]');if(s)for(var n=0;n<s.length;n++){var r=s[n].hasAttribute("data-service")?s[n].getAttribute("data-service"):"",o=!s[n].hasAttribute("data-is-urlencoded")||"true"===s[n].getAttribute("data-is-urlencoded"),u=s[n].hasAttribute("data-iframe-markup")?s[n].getAttribute("data-iframe-markup"):"";r&&u?new a.IframeSingleOptIn(s[n],r,u,o):console.error("SingleOptIn: Not all required attributes are set.","Service: ".concat(r),"iframeMarkup: ".concat(u))}},{"./IframeSingleOptIn":1}]},{},[5]);