top of page
bottom of page
(function() {
var iframe = document.getElementById('noleggy-booking-iframe-116e6760-cec3-4c48-ae83-4254a4e844cb');
var container = document.getElementById('noleggy-booking-container-116e6760-cec3-4c48-ae83-4254a4e844cb');
if (!iframe) return;
var takeLangFromHtml = true;
var blurOverlay = null;
var containerDefaultStyle = '';
var iframeDefaultStyle = iframe.getAttribute('style') || '';
var isPinned = false;
function ensureBlurOverlay() {
if (blurOverlay) return blurOverlay;
blurOverlay = document.createElement('div');
blurOverlay.id = 'noleggy-booking-blur-overlay-116e6760-cec3-4c48-ae83-4254a4e844cb';
blurOverlay.style.cssText = 'position:fixed;inset:0;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);z-index:999;pointer-events:none;';
document.body.appendChild(blurOverlay);
return blurOverlay;
}
function pinContainer() {
if (!container || !iframe) return;
isPinned = true;
container.style.cssText = 'position:fixed;top:0;left:0;right:0;width:100vw;height:100dvh;z-index:1000;margin:0;overflow:hidden;';
iframe.style.cssText = 'border:none;width:100vw;height:100dvh;max-width:none;margin:0;display:block;';
}
function unpinContainer() {
if (container) container.style.cssText = containerDefaultStyle;
if (iframe) iframe.style.cssText = iframeDefaultStyle;
isPinned = false;
}
function onMessage(e) {
if (!e.data || typeof e.data !== 'object') return;
if (e.data.type === 'noleggy-widget-resize' && typeof e.data.height === 'number') {
if (!isPinned) iframe.style.height = e.data.height + 'px';
}
if (e.data.type === 'noleggy-booking-page-change' && e.data.moduleId === '116e6760-cec3-4c48-ae83-4254a4e844cb' && container) {
if (e.data.step && e.data.step !== 'dates') {
ensureBlurOverlay().style.display = 'block';
pinContainer();
} else {
if (blurOverlay) blurOverlay.style.display = 'none';
unpinContainer();
}
container.scrollTo({ top: 0, behavior: 'smooth' });
}
if (e.data.type === 'noleggy-widget-ready' && takeLangFromHtml) {
var htmlLang = document.documentElement.lang || '';
var lang = htmlLang.split('-')[0].toLowerCase();
iframe.contentWindow.postMessage({ type: 'noleggy-set-lang', lang: lang, takeLangFromHtml: true }, '*');
}
}
window.addEventListener('message', onMessage);
})();