embed url

This commit is contained in:
Dayowe 2025-06-08 23:02:57 +02:00
parent 134ee583a2
commit 623149dc17

View File

@ -1546,13 +1546,16 @@
const iframeCode = document.querySelector('#iframeCode');
if (modal && widgetCode && iframeCode) {
const baseUrl = window.location.origin;
// Extract domain from current URL to build embed subdomain
const hostname = window.location.hostname;
const protocol = window.location.protocol;
const embedUrl = `${protocol}//embed.${hostname}`;
const theme = this.theme !== 'system' ? ` data-theme="${this.theme}"` : '';
widgetCode.textContent = `<script src="embed.${baseUrl}/dog-calculator-widget.js"></script>
widgetCode.textContent = `<script src="${embedUrl}/dog-calculator-widget.js"></script>
<div id="dog-calorie-calculator"${theme}></div>`;
iframeCode.textContent = `<iframe src="embed.${baseUrl}/iframe.html${this.theme !== 'system' ? '?theme=' + this.theme : ''}"
iframeCode.textContent = `<iframe src="${embedUrl}/iframe.html${this.theme !== 'system' ? '?theme=' + this.theme : ''}"
width="100%" height="600"
frameborder="0"
title="Dog Calorie Calculator">