on overlayOpen() { $overlays = document.getElementsByClassName('ff-tab-overlay'); for (var i = 0; i < $overlays.length; i++) { $overlays[i].style.display = 'block'; $overlays[i].style.top = '0px'; $overlays[i].style.bottom = '0px'; $overlays[i].style.left = '0px'; $overlays[i].style.right = '0px'; } } function overlayClose() { $overlays = document.getElementsByClassName('ff-tab-overlay'); setTimeout(function () { for (var i = 0; i < $overlays.length; i++) { $overlays[i].style.display = 'none'; $overlays[i].style.top = 'auto'; $overlays[i].style.bottom = 'auto'; $overlays[i].style.left = 'auto'; $overlays[i].style.right = 'auto'; } }, 300); } function closeDay(IATA) { var $box = document.getElementById('ff-day-infobox-' + IATA); var boxes = document.getElementsByClassName('ff-box-dark'); $box.style.display = 'none'; for (var i = 0; i < boxes.length; i++) { if (boxes[i].classList.contains("active")) { boxes[i].classList.remove("active"); } } } function openDay(event, day) { var $target = event.currentTarget; var $box = document.getElementById('ff-day-infobox-' + day.IATA); var boxes = document.getElementsByClassName('ff-box-dark'); var $content = document.getElementById('ff-day-content-' + day.IATA); $box.style.display = 'block'; for (var i = 0; i < boxes.length; i++) { if (boxes[i].classList.contains("active")) { boxes[i].classList.remove("active"); } } $target.classList.add('active'); $html = doBoxHtml(day); $content.innerHTML = $html; var $boxsize = $box.getBoundingClientRect(); $box.style.top = $target.offsetTop - $boxsize.height - 25 + "px"; // if (screenwidth < 641) { //if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){ // Mobile // } else { // Desktop // $box.style.width = '400px'; // $box.style.left = ($target.offsetLeft - 150) + 'px'; // } if (!isInViewport($box)) { $box.scrollIntoView({behavior: "smooth", block: "start", inline: "nearest"}); } } function minutesToTime(minutes) { // Make sure we have a valid number // if (typeof minutes !== 'number' || isNaN(minutes) || minutes < 0) { // return 'Invalid input'; // } // Round to whole minutes minutes = Math.floor(minutes); // Calculate hours and remaining minutes const hours = Math.floor(minutes / 60); const remainingMinutes = minutes % 60; // Handle hours text (singular/plural) const hoursText = hours === 1 ? 'hour' : 'hours'; // Handle minutes text (singular/plural) const minutesText = remainingMinutes === 1 ? 'minute' : 'minutes'; // Format the output based on hours and minutes if (hours < 1) { return `${remainingMinutes} ${minutesText}`; } else if (remainingMinutes === 0) { return `${hours} ${hoursText}`; } else { return `${hours} ${hoursText} ${remainingMinutes} ${minutesText}`; } } function doBoxHtml(day) { $html = '