80 lines
2.1 KiB
HTML
80 lines
2.1 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>1XAUD Partnership iframe render</title>
|
|
<style>
|
|
html,
|
|
body {
|
|
margin: 0;
|
|
background: #0f1218;
|
|
font-family: Arial, sans-serif;
|
|
}
|
|
|
|
.frame-wrap {
|
|
position: relative;
|
|
max-width: 1000px;
|
|
margin: 0 auto;
|
|
overflow: hidden;
|
|
border: none;
|
|
background: #151921;
|
|
min-height: 600px;
|
|
}
|
|
|
|
iframe {
|
|
display: block;
|
|
width: 100%;
|
|
min-height: 600px;
|
|
overflow: hidden;
|
|
border: none;
|
|
}
|
|
</style>
|
|
<script>
|
|
window._ = {
|
|
getVar(name) {
|
|
return name === "merchantId" ? "1888" : "";
|
|
}
|
|
};
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="frame-wrap">
|
|
<iframe id="partnershipIframe" src="https://1xaud.em7bd7.co/embed/partnership/partnership.asp"></iframe>
|
|
<script>
|
|
(() => {
|
|
const merchantId = (typeof _ !== "undefined" && typeof _.getVar === "function") ? (_.getVar("merchantId") ?? "") : "";
|
|
if (!merchantId) {
|
|
console.log("merchantId not found");
|
|
return;
|
|
}
|
|
function init(iframe) {
|
|
iframe.addEventListener("load", function() {
|
|
iframe.contentWindow.postMessage({ type: "setIframeData", clientMerchant: merchantId }, "*");
|
|
});
|
|
window.addEventListener("message", function(event) {
|
|
if (event.data && event.data.type === "setPartnershipIframeHeight") {
|
|
iframe.style.height = event.data.height + "px";
|
|
}
|
|
}, false);
|
|
}
|
|
var el = document.getElementById("partnershipIframe");
|
|
if (el) { init(el); return; }
|
|
var attempts = 0;
|
|
var timer = setInterval(function() {
|
|
attempts++;
|
|
var el = document.getElementById("partnershipIframe");
|
|
if (el) {
|
|
clearInterval(timer);
|
|
init(el);
|
|
} else if (attempts >= 5) {
|
|
clearInterval(timer);
|
|
alert("iframe not found");
|
|
}
|
|
}, 1000);
|
|
})();
|
|
</script>
|
|
</div>
|
|
</body>
|
|
</html>
|