var spendinoJquery;
var thisPageUsingOtherJSLibrary = false;
if (typeof jQuery == 'undefined') {
if (typeof $ == 'function') {
thisPageUsingOtherJSLibrary = true;
}
function getScript(url, success) {
var script = document.createElement('script');
script.src = url;
var head = document.getElementsByTagName('head')[0],
done = false;
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
done = true;
success();
script.onload = script.onreadystatechange = null;
head.removeChild(script);
};
};
head.appendChild(script);
};
getScript('https://api.spendino.de/donationmanager/js/themedForms/jquery-3.6.0.min.js', function() {
if (typeof jQuery=='undefined') {
// Uups
} else {
if (thisPageUsingOtherJSLibrary) {
spendinoJquery = jQuery.noConflict(false);
} else {
spendinoJquery = jQuery.noConflict(true);
}
spendinoJquery.getScript('https://api.spendino.de/donationmanager/js/themedForms/spendino.jquery.blockUI.js');
}
});
} else { // jQuery was already loaded
spendinoJquery = jQuery;
spendinoJquery.getScript('https://api.spendino.de/donationmanager/js/themedForms/spendino.jquery.blockUI.js');
};
document.write('
');
document.write('');
var spinner165 = document.getElementById('spendinoIframeLoader165');
if (spinner165 !== null && typeof spinner165 !== 'undefined') {
var iscentered = false;
var spinnerparent165 = spinner165.parentNode;
var rectParent = spinnerparent165.getBoundingClientRect();
while (!iscentered && spinnerparent165.localName !== 'body') {
iscentered = spinnerparent165.style.cssText.indexOf('center') !== -1;
spinnerparent165 = spinnerparent165.parentNode;
}
if (iscentered) {
spinner165.setAttribute('style', 'position:absolute; left:inherit;width:inherit;margin-top:20px;');
} else if (spinner165.getAttribute('style') == null){
if (rectParent.width > 0) {
spinner165.setAttribute('style', 'position:absolute; left:inherit;width:inherit;margin-top:20px;margin-left: ' + String(rectParent.width / 2 - 50) + 'px;');
} else {
spinner165.setAttribute('style', 'position:absolute; left:inherit;width:inherit;margin-top:20px;margin-left: 50%;');
}
}
}
document.write('');
var urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(location.search);
if (results == null){
return null;
}
else {
return decodeURI(results[1]) || 0;
}
};
var hash = window.location.hash;
var editIframeSrc = false;
if( hash ) {
//todo: hash bei - splitten und wert als named. wert muss key:value sein
$namedParams =hash.substring(1).split('-').join('/');
// $namedParams =hash.substring(1).replace('-','/');
editIframeSrc = true;
// var iframe = window.document.getElementsByName('spendinoWidget');
// if( typeof iframe != 'undefined' ) {
// if (iframe[0].src.indexOf('?') > -1)
// {
// var lTmp = iframe[0].src;
// iframe[0].src = lTmp.split('?')[0] + '/' + $namedParams+'?' + lTmp.split('?')[1];
// } else {
// iframe[0].src = iframe[0].src + '/' + $namedParams;
// }
// }
}
if (location.search !== '') {
// var spendinoParentUrlParams = new URLSearchParams(location.search);
// var spendinoParentUrlParams = {};
var spendinoQueryParams = '';
if(null != urlParam('xcustomcode')) {
if(spendinoQueryParams != '') {
spendinoQueryParams = spendinoQueryParams+'&';
}
spendinoQueryParams = spendinoQueryParams + 'xcustomcode=' +urlParam('xcustomcode');
} else if(null != urlParam('xwerbecode') || null != urlParam('werbecode')) {
if(spendinoQueryParams != '') {
spendinoQueryParams = spendinoQueryParams+'&';
}
var werbecode = null != urlParam('werbecode') ? urlParam('werbecode') : urlParam('xwerbecode');
spendinoQueryParams = spendinoQueryParams + 'xcustomcode=' + werbecode;
}
if(null != urlParam('xcustomtitle') || null != urlParam('customtitle') || null != urlParam('projektname')|| null != urlParam('xwerbecodetitel')|| null != urlParam('werbecodetitel')) {
if(spendinoQueryParams != '') {
spendinoQueryParams = spendinoQueryParams+'&';
}
var customtitle = null != urlParam('projektname') ? urlParam('projektname') : '';
customtitle = null != urlParam('werbecodetitel') ? urlParam('werbecodetitel') : customtitle;
customtitle = null != urlParam('werbecodetitle') ? urlParam('werbecodetitle') : customtitle;
customtitle = null != urlParam('xwerbecodetitle') ? urlParam('xwerbecodetitle') : customtitle;
customtitle = null != urlParam('xwerbecodetitel') ? urlParam('xwerbecodetitel') : customtitle;
customtitle = null != urlParam('customtitle') ? urlParam('customtitle') : customtitle;
customtitle = null != urlParam('xcustomtitle') ? urlParam('xcustomtitle') : customtitle;
spendinoQueryParams = spendinoQueryParams + 'xcustomtitle=' + customtitle;
}
if(spendinoQueryParams != '') {
editIframeSrc = true;
// var siframe = window.document.getElementsByName('spendinoWidget');
// if( typeof siframe != 'undefined' ) {
// if (siframe[0].src.indexOf('?') > -1)
// {
// siframe[0].src = siframe[0].src + '&' + spendinoQueryParams;
// } else {
// siframe[0].src = siframe[0].src + '?' + spendinoQueryParams;
// }
// }
}
}
if (editIframeSrc) {
if (typeof $namedParams !== 'undefined') {
$namedParams = '/' + $namedParams;
} else {
$namedParams = '';
}
if (typeof spendinoQueryParams == 'undefined') {
spendinoQueryParams = '';
}
var iframe = window.document.getElementsByName('spendinoWidget');
if( typeof iframe !== 'undefined' && typeof iframe[0] !== 'undefined') {
// console.log(iframe, $namedParams, spendinoQueryParams);
var newSrc;
if (iframe[0].src.indexOf('?') > -1)
{
if(spendinoQueryParams != '') {
spendinoQueryParams = '&' + spendinoQueryParams;
}
var lTmp = iframe[0].src;
newSrc = lTmp.split('?')[0] + $namedParams + '?' + lTmp.split('?')[1] + spendinoQueryParams;
} else {
if(spendinoQueryParams != '') {
spendinoQueryParams = '?' + spendinoQueryParams;
}
newSrc = iframe[0].src + $namedParams + spendinoQueryParams;
}
iframe[0].src = newSrc;
}
}
var spendinoIframeBase = "spendinoForm";
var spendinoIframeId = spendinoIframeBase + "165";
var spendinoEventListeners = spendinoEventListeners || false;
if( spendinoEventListeners === false ) {
window.addEventListener("resize", resizeSpendino );
// window.addEventListener("scrollTop", scrollTopSpendino );
spendinoEventListeners = true;
}
//var sFrame;
var neededHeight;
var sWidth = '';
if (typeof(scrollTopSpendino) !== 'function') {
var scrollTopSpendino = function( iframeId) {
if (typeof iframeId == 'undefined') {
iframeId = spendinoIframeId;
}
var topPosition = spendinoJquery('#'+iframeId).offset().top
if (topPosition > 40) {
topPosition -= 40;
} else {
topPosition = 0;
}
// console.log('scrollTopSpendino', topPosition, spendinoJquery('#'+iframeId).offset().top);
spendinoJquery('html, body').animate({
scrollTop:topPosition
},'slow');
}
}
if (typeof(setSpendinoParam) !== 'function') {
var setSpendinoParam = function(param, value, disable, iframeId) {
// var setSpendinoParam = function(param, value) {
if (typeof iframeId == 'undefined') {
iframeId = spendinoIframeId;
}
var iframe = document.getElementById( iframeId );
if (typeof disable == 'undefined') {
iframe.contentWindow.postMessage(JSON.stringify(["setParam",param,value,"*"]), '*');
} else {
iframe.contentWindow.postMessage(JSON.stringify(["setParam",param,value,!!disable,"*"]), '*');
}
}
// window.setSpendinoParam = function(param, value) {
// var mFrame = window.document.getElementsByName('spendinoWidget')[0];
// mFrame.contentWindow.postMessage(JSON.stringify(["setParam",param,value,"*"]), '*');
// }
}
if (typeof(getSpendinoParam) !== 'function') {
var getSpendinoParam = function(param, callback, iframeId) {
if (typeof iframeId == 'undefined') {
iframeId = spendinoIframeId;
}
var iframe = document.getElementById( iframeId );
iframe.contentWindow.postMessage(JSON.stringify(["getParam",param,callback,"*"]), '*');
}
// window.getSpendinoParam = function(param, callback) {
// var mFrame = window.document.getElementsByName('spendinoWidget')[0];
// mFrame.contentWindow.postMessage(JSON.stringify(["getParam",param,callback,"*"]), '*');
// }
}
if (typeof(setSpendinoParamMultiForm) !== 'function') {
// var setSpendinoParamMultiForm = function(formid, param, value) {
var setSpendinoParamMultiForm = function(formid, param, value, disable) {
var iframe = document.getElementById( spendinoIframeBase + formid );
if (typeof disable == 'undefined') {
iframe.contentWindow.postMessage(JSON.stringify(["setParam",param,value,"*"]), '*');
} else {
iframe.contentWindow.postMessage(JSON.stringify(["setParam",param,value,!!disable,"*"]), '*');
}
}
// window.setSpendinoParam = function(param, value) {
// var mFrame = window.document.getElementsByName('spendinoWidget')[0];
// mFrame.contentWindow.postMessage(JSON.stringify(["setParam",param,value,"*"]), '*');
// }
}
if (typeof(getSpendinoParamMultiForm) !== 'function') {
var getSpendinoParamMultiForm = function(formid, param, callback) {
var iframe = document.getElementById( spendinoIframeBase + formid );
iframe.contentWindow.postMessage(JSON.stringify(["getParam",param,callback,"*"]), '*');
}
// window.getSpendinoParam = function(param, callback) {
// var mFrame = window.document.getElementsByName('spendinoWidget')[0];
// mFrame.contentWindow.postMessage(JSON.stringify(["getParam",param,callback,"*"]), '*');
// }
}
if (typeof(resizeSpendino) !== 'function') {
var resizeSpendino = function(iframeId) {
if (typeof iframeId == 'undefined') {
iframeId = spendinoIframeId;
}
var iframe = document.getElementById( iframeId );
if( iframe === null || typeof iframe === 'undefined' ) {
return;
}
iframe.width = "100%";
var iframeParent = iframe.parentNode;
var iframeWidth = iframeParent.offsetWidth+'';
if (sWidth != iframeWidth) {
sWidth = iframeWidth;
if (iframeWidth.indexOf('px') !== -1) {
iframeWidth = parseInt(iframeWidth);
}
var iframeHeight = 500;
var ratio = 1;
if (typeof window.devicePixelRatio !== 'undefined') {
ratio = window.devicePixelRatio;
}
if (iframeWidth.indexOf('%') !== -1 || iframeWidth > parseInt('532')) {
iframeWidth = '532';
} else if (iframeWidth < 401) {
iframeHeight = 1900;
}
iframe.width = (iframeWidth) + "px";
iframe.height = (iframeHeight) + "px";
iframe.setAttribute('style', 'height:' + iframe.height + ' !important;width:'
+ iframe.width + ' !important');
}
}
}
if (typeof(scrollToSpendino) !== 'function') {
var scrollToSpendino = function (element, to, duration) {
var top = spendinoJquery(window).scrollTop();
if (duration <= 0) return;
var difference = to - top;
var perTick = difference / duration * 10;
setTimeout(function() {
spendinoJquery(window).scrollTop(top+perTick);
if (spendinoJquery(window).scrollTop() === to) return;
scrollToSpendino(element, to, duration - 10);
}, 10);
}
}
if (typeof(getPositionSpendino) !== 'function') {
var getPositionSpendino = function( el ) {
var xPosition = 0;
var yPosition = 0;
while(el) {
xPosition += el.offsetLeft;
yPosition += el.offsetTop;
el = el.offsetParent;
}
return { x: xPosition, y: yPosition };
}
}
function openCCPopUp(url){
WPP.embeddedPayUrl(url);
}
if (typeof spendinoEventHandler !== 'function') {
var spendinoEventHandler = function (e) {
var eventName = e.data[0];
var data = e.data[1];
var iframeId = e.data[2];
var formId = 0;
if (typeof spendinoIframeId === 'undefined' || spendinoIframeId == '') {
spendinoIframeId = 'spendinoForm165';
}
if (typeof iframeId === 'undefined' || iframeId == '') {
iframeId = spendinoIframeId;
}
formId = iframeId.replace( /^\D+/g, '');
//if( iframeId !== 'spendinoForm//' ) {
// problem bei multiframe;
// if (iframeId !== spendinoIframeId && window.location.href.indexOf('www.gruen.net') < 0) {
// return;
// }
//check for Events independent of iframe
switch (eventName) {
case 'executeBridgeCall':
// console.log('executeBridgeCall', data);
if (typeof (window[data.func]) == 'function') {
if (data.hasOwnProperty('param')) {
window[data.func](data.param);
} else {
window[data.func]();
}
}
break;
case 'getParam' :
var callback = e.data[1]['callback'];
window[callback](e.data[1]['param'], e.data[1]['value']);
break;
case 'share':
share(data)
break;
}
//now proceed with Events needing valid iframe
var iframe = document.getElementById(iframeId);
if (iframe === null || typeof iframe === 'undefined') {
return;
}
switch (eventName) {
case 'setHeight':
var tmp = iframe.dataset.fixedsize;
var iframeNameTmp = iframe.name;
iframeNameTmp = iframeNameTmp.toLowerCase();
// iframe.style.height = data + 'px';
// iframe.width = (iframeWidth) + "px";
if (typeof iframe.dataset.fixedsize === 'undefined' || iframe.dataset.fixedsize !== 'true') {
iframe.height = data + "px";
iframe.setAttribute('style', 'height:' + data + 'px !important;width:'
+ iframe.width + ' !important');
}
// if ((typeof iframe.dataset.fixedsize === 'undefined' || iframe.dataset.fixedsize !== 'true') && iframeNameTmp.indexOf("widget") === -1 && data != 0) {
// iframe.height = data + "px";
// iframe.setAttribute('style', 'height:' + data + 'px !important;width:'
// + iframe.width + ' !important');
// } else if (iframeNameTmp.indexOf("widget") >= 0 && data != 0) {
// if (spendinoJquery("#" + iframeId).width() < 480) {
// data = (data > 300) ? data : 300;
// }
// // funktionier leider nicht immer
// // debugger;
// // var iFrameDOM = $("#"+iframeId).contents();
// // var buttonElement = iFrameDOM.find('#WidgetButton');
// // if (buttonElement !== undefined) {
// // var buttomPos = buttonElement.position();
// // if (buttomPos !== undefined) {
// // var buttonTop = buttonElement.position().top;
// // if (data < buttonTop) {
// // data = data + buttonTop;
// // } else if (buttonTop < 150){
// // data=150;
// // }
// // }
// // }
// iframe.height = data + "px";
// } else if (data !== 0) {
// iframe.height = data + "px";
// }
break;
case 'scrollTo':
var pos = getPositionSpendino(iframe);
if (pos.x < 10) {
pos.x = 10;
}
scrollToSpendino(document.getElementsByTagName('body'), pos.y - 100 + data, 100);
// scrollToSpendino(document.getElementsByTagName('body'), pos.y - 100 + data, 100);
// scrollToSpendino(document.documentElement.scrollTop, pos.y - 100 + data, 100);
break;
case 'location':
iframe.contentWindow.postMessage(JSON.stringify(['location', document.location]), '*');
break;
case 'scrollTop':
scrollTopSpendino();
break;
case 'startProcessChain':
startSpendinoProcess(data);
break;
case 'loadComplete':
// window.dispatchEvent(new Event('spendino:loadcomplete', {
// bubbles: true,
// cancelable: false
// }));
if (typeof data === 'undefined') {
data = {name: 'undefined', id:165};
} else if (typeof data === 'string') {
data = {name: data, id:165};
}
if (typeof (window['spendinoOnLoad' + formId]) == 'function') {
window['spendinoOnLoad' + formId](data);
} else if (typeof (spendinoOnLoad) == 'function') {
spendinoOnLoad(data);
}
window['spendinoLoadingAnimation' + formId]('stop');
// console.log('loadComplete', data);
//if (typeof (spendinoOnLoad//) == 'function') {
// spendinoOnLoad//();
//} else if (typeof (spendinoOnLoad) == 'function') {
// spendinoOnLoad();
//}
//spendinoLoadingAnimation//('stop');
break;
// case 'getParam' :
// var callback = e.data[1]['callback'];
// window[callback](e.data[1]['param'],e.data[1]['value']);
// break;
case 'setCCPaymentUrl':
spendinoJquery.getScript('https://wpp.wirecard.com/loader/paymentPage.js', function () {
openCCPopUp(data);
setTimeout(function () {
spendinoJquery('#wirecard-hpp-container').css('z-index', '110050');
}, 500);
});
break;
case 'startLoadingAnimation':
window['spendinoLoadingAnimation' + formId]('start');
//spendinoLoadingAnimation//('start');
break;
case 'stopLoadingAnimation':
// debugger;
window['spendinoLoadingAnimation' + formId]('stop');
// spendinoLoadingAnimation165('stop');
break;
case 'fullBlock':
spendinoBlockUI('start');
break;
case 'fullUnBlock':
spendinoBlockUI('stop');
break;
case 'iframeDataLayer':
if (data.hasOwnProperty('event')) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push(data);
}
break;
case 'cssTag':
spendinoJquery('head').append(data);
break;
case 'jsTag':
spendinoJquery('head').append('