-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.html
executable file
·42 lines (42 loc) · 1.37 KB
/
main.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{{#content.widget_id}}
<iframe
src="https://www.bookingmood.com/embed/{{content.widget_id}}?{{content.url_params}}"
frameborder="0"
marginwidth="0"
marginheight="0"
style="width: 100%; border: 0; border-radius: 4px; overflow: hidden"
allowfullscreen
/>
<script>
if (!window.bmResizeInitialized) {
window.bmResizeInitialized = true;
window.addEventListener("message", (event) => {
if (!event.source) return;
try {
const data = JSON.parse(event.data);
if (data.context !== "iframe.resize") return;
const frame = document.querySelector(`iframe[src="${data.src}"]`);
if (!frame) return;
frame.height = data.height + 1;
if (
frame.parentElement.parentElement?.classList.contains("wb_element")
) {
frame.parentElement.parentElement.style.setProperty("width", "100%");
frame.parentElement.parentElement.style.setProperty(
"height",
`${data.height + 1}px`
);
}
document
.querySelectorAll("[data-plugin=bookingmood]")
.forEach((node) => {
node.style.setProperty("width", "100%");
node.style.setProperty("height", `${data.height + 1}px`);
});
} catch {}
});
}
</script>
{{/content.widget_id}}{{^content.widget_id}}
<p>No Bookingmood widget selected</p>
{{/content.widget_id}}