// Check jQuery version before we load function isiPhone(){ return ( (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1) ); } var isMobile = 0; function getScript(url, success) { var script = document.createElement('script'); script.src = url; var head = document.getElementsByTagName('head')[0], done = false; // Attach handlers for all browsers script.onload = script.onreadystatechange = function() { if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { done = true; success(); script.onload = script.onreadystatechange = null; head.removeChild(script); } }; head.appendChild(script); } var col = 3; var row = 4; var size = 2; var lang = 'english'; var btob = '1'; var bg = 'FFFFFF'; var dfc = '000000'; var border = 'CCCCCC'; var hbg = 'F1F0F0'; var hfc = '000000'; var abg = 'DDFFCC'; var afc = '000000'; var ubg = 'FFC0BD'; var ufc = '000000'; var mobileresize = 'yes'; var border_radius = '0'; var daystart = 'sunday'; var showrentalname = 0; function iFrame8(ek) { var ids = ek.id; getScript('https://codeorigin.jquery.com/jquery-1.10.2.min.js',function() { var cjQuery = jQuery.noConflict(true); cjQuery(document).ready(function() { function resizeiFrame(){ var iFrameContainerWidth = cjQuery(ek).parent().width(); /* * Pradip #966 * IMPORTANT: * Do not calculate a fixed iframe height here. * The iframe height is supplied by public-calendar.blade.php * through postMessage after the calendar has rendered. * * This prevents the old 350px * months / min-height calculations * from creating a large empty area below the calendar. */ cjQuery(ek).css({ width: '100%', margin: '0', padding: '0', display: 'block', border: '0' }); /* * Pradip #966 * Tell the calendar its current available width. * public-calendar.blade.php can use this to recalculate * responsive columns after 767px. */ /* * The number of columns is controlled from this script. * When the breakpoint changes, reload the iframe with * the new ?col= value so the months move row-by-row. */ updateResponsiveCalendar(false); } }); var elements = document.getElementsByClassName('holds-the-iframe'); document.querySelectorAll('.holds-the-iframe'); console.log(document.querySelectorAll('.holds-the-iframe').length); console.log(document.querySelectorAll('.holds-the-iframe')); for(var i=0;i< document.querySelectorAll('.holds-the-iframe').length;i++) { var foobarElement = document.getElementsByClassName('holds-the-iframe'); foobarElement[i].style.background = 'none'; } }); } var calendarID = ''; var iframeID = "acCalendar8"; var lastCalendarHeight = 150; /** * Pradip #966 * Ensure the page has a responsive viewport meta tag. * * Checks whether a viewport meta tag already exists and creates * one with responsive scaling settings when it is not present. * * @returns {void} */ (function () { var viewportMeta = document.querySelector('meta[name="viewport"]'); if (!viewportMeta) { viewportMeta = document.createElement('meta'); viewportMeta.name = 'viewport'; viewportMeta.content = 'width=device-width, initial-scale=1.0'; document.head.appendChild(viewportMeta); } })(); /* * ========================================================= * RESPONSIVE CALENDAR COLUMNS * ========================================================= * * Keep the original ?col= value as the maximum number of * columns. As the iframe gets narrower, reduce the number * of month columns. The iframe is reloaded only when the * required column count actually changes. */ var originalCalendarCol = parseInt(col, 10) || 1; var currentCalendarCol = originalCalendarCol; /** * Pradip #966 * Determine the appropriate calendar column count based on viewport width. * * Uses the actual browser viewport width to support responsive behavior * across desktop, tablet, and mobile layouts. * * Breakpoints: * - Above 767px: Uses the original calendar column count. * - 480px–767px: Limits the calendar to a maximum of 2 columns. * - Below 480px: Uses a single column. * * @returns {number} Number of calendar columns to display. */ function getResponsiveCalendarCol() { /* * Use the actual embedding viewport width. * Chrome DevTools Responsive + / - changes window.innerWidth. * Do not use the iframe parent's clientWidth because that can * remain fixed by the host page layout. */ var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0; if (width > 767) { return originalCalendarCol; } if (width >= 480) { return Math.min(originalCalendarCol, 2); } return 1; } /** * Pradip #966 * Apply the calculated calendar height to the iframe and its wrapper. * * Validates the supplied height, stores the latest valid height, * and updates the iframe dimensions and related display properties. * The parent wrapper is also synchronized to prevent layout gaps, * clipping, or unwanted scrolling. * * @param {number|string} height The calendar height in pixels. * @returns {void} */ function applyIframeHeight(height) { var iframe = document.getElementById(iframeID); if (!iframe) { return; } height = parseInt(height, 10); if (!height || height < 50) { return; } lastCalendarHeight = height; iframe.style.width = '100%'; iframe.style.height = height + 'px'; iframe.style.minHeight = '0'; iframe.style.maxHeight = 'none'; iframe.style.display = 'block'; iframe.setAttribute('height', height); var wrapper = iframe.parentElement; if (wrapper) { wrapper.style.width = '100%'; wrapper.style.height = height + 'px'; wrapper.style.minHeight = '0'; wrapper.style.maxHeight = 'none'; wrapper.style.margin = '0'; wrapper.style.padding = '0'; wrapper.style.overflow = 'hidden'; } } // end applyIframeHeight function /** * Pradip #966 * Measure the rendered calendar height inside the iframe. * * Calculates the lowest visible calendar month within the iframe's * calendar container and applies the resulting height to the iframe. * Adds a small bottom offset to prevent the calendar content from * being clipped. * * Falls back gracefully when the iframe, document, calendar container, * or calendar elements are unavailable. Cross-origin access errors * are ignored so the iframe's postMessage-based height mechanism * can continue to provide the required height. * * @returns {void} */ function measureIframeCalendarHeight() { var iframe = document.getElementById(iframeID); if (!iframe || !iframe.contentDocument) { return; } try { var doc = iframe.contentDocument; var demo = doc.getElementById('demo'); if (!demo) { return; } var calendars = demo.querySelectorAll( '.calendar-month-container' ); var maxBottom = 0; for (var i = 0; i < calendars.length; i++) { var rect = calendars[i].getBoundingClientRect(); if (rect.width <= 0 || rect.height <= 0) { continue; } if (rect.bottom > maxBottom) { maxBottom = rect.bottom; } } if (maxBottom > 0) { applyIframeHeight( Math.ceil(maxBottom + 10) ); } } catch (e) { /* * If the iframe becomes cross-origin in another deployment, * the child's postMessage height will still be used. */ } } // end measureIframeCalendarHeight function /** * Pradip #966 * Request and recalculate the calendar iframe height. * * Sends a resize request to the embedded calendar using postMessage, * then performs multiple delayed height measurements from the parent * window to account for layout changes that may occur after resizing. * * Multiple measurements help handle responsive viewport changes, * including cases where browser developer tools resize the iframe * without triggering a resize event inside the iframe. * * @returns {void} */ function requestIframeHeight() { var iframe = document.getElementById(iframeID); if (!iframe) { return; } try { if (iframe.contentWindow) { iframe.contentWindow.postMessage( { type: 'rentalbell-calendar-resize' }, '*' ); } } catch (e) { // Ignore postMessage errors. } /* * Measure from the parent as well. This is intentionally done * after layout has settled because DevTools + / - can change * the iframe width without firing a resize event inside it. */ setTimeout(function () { measureIframeCalendarHeight(); }, 50); setTimeout(function () { measureIframeCalendarHeight(); }, 250); setTimeout(function () { measureIframeCalendarHeight(); }, 600); } // end requestIframeHeight function /** * Pradip #966 * Update the responsive calendar iframe layout. * * Determines the appropriate calendar column count based on * the current viewport and updates the iframe's `col` parameter * when the column count changes. * * If the column count remains unchanged, only the iframe height * is recalculated without reloading the iframe. * * Preserves the last known valid iframe height while a new layout * is being prepared and schedules multiple height recalculations * after the iframe loads to account for delayed rendering. * * @param {boolean} force Whether to force a responsive calendar update. * @returns {void} */ function updateResponsiveCalendar(force) { var iframe = document.getElementById(iframeID); if (!iframe) { return; } var newCol = getResponsiveCalendarCol(); /* * Column count has not changed. * Do not reload the iframe. Just recalculate its height. */ if (!force && newCol === currentCalendarCol) { requestIframeHeight(); return; } currentCalendarCol = newCol; var src = iframe.getAttribute('src'); if (!src) { return; } /* * Update the col query parameter. */ if (/([?&])col=[^&]*/.test(src)) { src = src.replace( /([?&])col=[^&]*/, '$1col=' + currentCalendarCol ); } else { src += (src.indexOf('?') >= 0 ? '&' : '?') + 'col=' + currentCalendarCol; } /* * Keep the last known valid height while the new iframe * is loading. Never force the old 150px height. */ if (lastCalendarHeight && lastCalendarHeight > 50) { applyIframeHeight(lastCalendarHeight); } else { applyIframeHeight(250); } /* * Recalculate height after the new iframe has loaded. */ iframe.onload = function () { setTimeout(function () { requestIframeHeight(); }, 50); setTimeout(function () { requestIframeHeight(); }, 300); setTimeout(function () { requestIframeHeight(); }, 800); }; //iframe.setAttribute('src', src); } // end updateResponsiveCalendar function document.write( '' ); /** * Pradip #966 * Ensure the page has a responsive viewport configuration. * * Checks for an existing viewport meta tag and creates one when * it is missing, enabling proper responsive scaling across devices. * * @returns {void} */ (function () { var viewportMeta = document.querySelector('meta[name="viewport"]'); if (!viewportMeta) { viewportMeta = document.createElement('meta'); viewportMeta.name = 'viewport'; viewportMeta.content = 'width=device-width, initial-scale=1.0'; document.head.appendChild(viewportMeta); } // end if viewportMeta exists })(); // end self-invoking function currentCalendarCol = getResponsiveCalendarCol(); // get responsive calendar column document.write( '