/** * Created by sephiroth on 03/08/16. */ if(!window["sm-iframe-counter"]) window["sm-iframe-counter"] = 0; if(!window["sm-listener-added"]) { window.addEventListener("message", function(event) { event.data.actions.forEach(function(action) { for(var currentAction in action) self[currentAction](action[currentAction]); }); }); window["sm-listener-added"] = true; } function setFrameHeight(data) { if(data.id) document.getElementById(data.id).style.height = data.height + "px"; } function setCookie(data) { return; if(data.url) self.location.href = `${data.url}?referer=${self.location.href}`; } (function() { var request = "https://sportmaniacs.com/races/ix-10-km-villa-de-ribadesella"; var parent = document.createElement("div"); var iframe = document.createElement("iframe"); iframe.className = "sm-iframe"; iframe.id = "sm-iframe-" + window["sm-iframe-counter"]; window["sm-iframe-counter"]++; iframe.style.borderWidth = 0; iframe.referrerPolicy = "no-referrer"; iframe.style.width = "100%"; iframe.style.height = 600; iframe.style.transition = "all .2s ease-in"; iframe.src = request + window.location.search; parent.appendChild(iframe); document.write(parent.innerHTML); document.getElementById(iframe.id).addEventListener("load", function(event) { setInterval(function() { "use strict"; this.contentWindow.postMessage({ source: "sportmaniacs", actions: [{setFrameId: iframe.id}] }, "*"); this.contentWindow.postMessage({ source: "sportmaniacs", actions: [{setTopDomain: self.location.hostname}] }, "*"); }.bind(this), 300); }); })();