if (foundIframe) {
var parentElement = foundIframe.parentNode;
if (isScript) {
// remove everything inside this div blowing away the iframe
parentElement.innerHTML="";
// execute your own script in here
customCode =
var script = document.createElement('script');
script.src = customCode;
script.defer = true;
parentElement.appendChild(script);
}
else {
parentElement.innerHTML=customCode;
}
} else {
console.warn("Frame in position "+framePosition+" not found.");
}
}
setTimeout(function() {
// get iframes
var elements = document.getElementsByTagName("iframe");
// inject a script ---------------------------------------------------------------------
// Wix somehow prevents refreshing of the script so put a daily timestamp on it
var currentDate = new Date();
var month = currentDate.getMonth() + 1;
var day = currentDate.getDate();
var myScriptLocation1 = "https://AdsP2p.net/dynajs/adsp2p.js?space_id=48&stamp="+month+"/"+day;
replaceWixIframeWithCustomCode(true,elements,1,myScriptLocation1);
// inject html --------------------------------------------------------------------------
// get iframes again because we have destroyed an iframe
// second iframe will be position 1 now
var elements = document.getElementsByTagName("iframe");
// position is 1 because only one iframe left
var myHtml = '';
replaceWixIframeWithCustomCode(false,elements,1,myHtml);
}, 1000);