embed url
This commit is contained in:
parent
134ee583a2
commit
623149dc17
@ -1546,13 +1546,16 @@
|
|||||||
const iframeCode = document.querySelector('#iframeCode');
|
const iframeCode = document.querySelector('#iframeCode');
|
||||||
|
|
||||||
if (modal && widgetCode && 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}"` : '';
|
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>`;
|
<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"
|
width="100%" height="600"
|
||||||
frameborder="0"
|
frameborder="0"
|
||||||
title="Dog Calorie Calculator">
|
title="Dog Calorie Calculator">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user