":1}},{"from":"2026-01-26","to":"2026-02-01","filterName":"Week 5 (Jan 26 - Feb 1)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-02-02","to":"2026-02-08","filterName":"Week 6 (Feb 2 - Feb 8)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-02-09","to":"2026-02-15","filterName":"Week 7 (Feb 9 - Feb 15)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-02-16","to":"2026-02-22","filterName":"Week 8 (Feb 16 - Feb 22)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-02-23","to":"2026-03-01","filterName":"Week 9 (Feb 23 - Mar 1)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-03-02","to":"2026-03-08","filterName":"Week 10 (Mar 2 - Mar 8)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-03-09","to":"2026-03-15","filterName":"Week 11 (Mar 9 - Mar 15)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-03-16","to":"2026-03-22","filterName":"Week 12 (Mar 16 - Mar 22)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-03-23","to":"2026-03-29","filterName":"Week 13 (Mar 23 - Mar 29)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-03-30","to":"2026-04-05","filterName":"Week 14 (Mar 30 - Apr 5)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-04-06","to":"2026-04-12","filterName":"Week 15 (Apr 6 - Apr 12)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-04-13","to":"2026-04-19","filterName":"Week 16 (Apr 13 - Apr 19)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-04-20","to":"2026-04-26","filterName":"Week 17 (Apr 20 - Apr 26)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-04-27","to":"2026-05-03","filterName":"Week 18 (Apr 27 - May 3)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-05-04","to":"2026-05-10","filterName":"Week 19 (May 4 - May 10)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-05-11","to":"2026-05-17","filterName":"Week 20 (May 11 - May 17)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-05-18","to":"2026-05-24","filterName":"Week 21 (May 18 - May 24)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-05-25","to":"2026-05-31","filterName":"Week 22 (May 25 - May 31)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-06-01","to":"2026-06-07","filterName":"Week 23 (Jun 1 - Jun 7)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-06-08","to":"2026-06-14","filterName":"Week 24 (Jun 8 - Jun 14)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-06-15","to":"2026-06-21","filterName":"Week 25 (Jun 15 - Jun 21)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-06-22","to":"2026-06-28","filterName":"Week 26 (Jun 22 - Jun 28)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-06-29","to":"2026-07-05","filterName":"Week 27 (Jun 29 - Jul 5)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-07-06","to":"2026-07-12","filterName":"Week 28 (Jul 6 - Jul 12)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-07-13","to":"2026-07-19","filterName":"Week 29 (Jul 13 - Jul 19)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-07-20","to":"2026-07-26","filterName":"Week 30 (Jul 20 - Jul 26)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-07-27","to":"2026-08-02","filterName":"Week 31 (Jul 27 - Aug 2)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-08-03","to":"2026-08-09","filterName":"Week 32 (Aug 3 - Aug 9)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-08-10","to":"2026-08-16","filterName":"Week 33 (Aug 10 - Aug 16)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-08-17","to":"2026-08-23","filterName":"Week 34 (Aug 17 - Aug 23)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-08-24","to":"2026-08-30","filterName":"Week 35 (Aug 24 - Aug 30)","filterSelected":0,"airlines":{"U2":0,"V7":1}},{"from":"2026-08-31","to":"2026-09-06","filterName":"Week 36 (Aug 31 - Sep 6)","filterSelected":0,"airlines":{"V7":0}},{"from":"2026-09-07","to":"2026-09-13","filterName":"Week 37 (Sep 7 - Sep 13)","filterSelected":0,"airlines":{"V7":0}},{"from":"2026-09-14","to":"2026-09-20","filterName":"Week 38 (Sep 14 - Sep 20)","filterSelected":0,"airlines":{"V7":0}},{"from":"2026-09-21","to":"2026-09-27","filterName":"Week 39 (Sep 21 - Sep 27)","filterSelected":0,"airlines":{"V7":0}},{"from":"2026-09-28","to":"2026-10-04","filterName":"Week 40 (Sep 28 - Oct 4)","filterSelected":0,"airlines":{"V7":0}},{"from":"2026-10-05","to":"2026-10-11","filterName":"Week 41 (Oct 5 - Oct 11)","filterSelected":0,"airlines":{"V7":0}}]; var $selectedweeks = {"V7":{"selected":2,"week":0},"U2":{"selected":2,"week":0}}; const dropdownButtons = document.querySelectorAll('.shortcut-button-airlines a'); // Add click event to each button dropdownButtons.forEach(button => { button.addEventListener('click', function (e) { e.preventDefault(); const dropdown = this.closest('.shortcut-button-airlines').querySelector('.airlines-list'); // Toggle the dropdown if (dropdown.style.display === 'block') { dropdown.style.display = 'none'; } else { // Close all other dropdowns first document.querySelectorAll('.airlines-list').forEach(d => { d.style.display = 'none'; }); dropdown.style.display = 'block'; } // Handle the tab click if dataset.id exists if (button.dataset.id) { const tabElement = document.getElementById('ff-tab-' + button.dataset.id); if (tabElement) { tabElement.click(); // Scroll to the element tabElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); } } }); }); // Close dropdowns when clicking outside document.addEventListener('click', function (e) { // Check if the click is outside the dropdown and its button if (!e.target.closest('.shortcut-button-airlines')) { document.querySelectorAll('.airlines-list').forEach(dropdown => { dropdown.style.display = 'none'; }); } }); // Also close dropdown when clicking on items inside the dropdown document.querySelectorAll('.airlines-list a').forEach(link => { link.addEventListener('click', function (e) { // Optional: prevent default if you're handling navigation via JS // e.preventDefault(); // Find and close the parent dropdown const dropdown = this.closest('.airlines-list'); if (dropdown) { dropdown.style.display = 'none'; } // Get the id from data attribute if it exists const id = this.dataset.id; if (id) { const tabElement = document.getElementById('ff-tab-' + id); if (tabElement) { tabElement.click(); // Scroll to the element tabElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); } } }); }); function changeWeek(to, idnumber, weekname, weekkey, airline) { $selectedweeks[airline].selected = parseInt(weekkey); $dropdown = document.getElementById('ff-dropdown-' + idnumber); $header = document.getElementById('ff-date-' + idnumber); $header.innerHTML = weekname; UIkit.dropdown($dropdown).hide(0); overlayOpen(); const xhttp = new XMLHttpRequest(); xhttp.onload = function () { var testdiv = document.getElementById('ff-ajax-' + airline); testdiv.innerHTML = this.responseText; } xhttp.open("GET", "/new/getweek/" + $airportFrom + "/" + $airportTo + "/" + to + "/" + airline + '?preview=1', true); xhttp.send(); overlayClose(); } function changeWeekArrow(direction, airline) { overlayOpen(); if (direction == 'left' && $selectedweeks[airline].selected !== 0) { $selectedweeks[airline].selected = $selectedweeks[airline].selected - 1; } else if (direction == 'right' && $selectedweeks[airline].selected !== $weeks.length) { $selectedweeks[airline].selected = $selectedweeks[airline].selected + 1; } const xhttp = new XMLHttpRequest(); xhttp.onload = function () { var testdiv = document.getElementById('ff-ajax-' + airline); testdiv.innerHTML = this.responseText; } xhttp.open("GET", "/new/getweek/" + $airportFrom + "/" + $airportTo + "/" + $weeks[$selectedweeks[airline].selected].to + "/" + airline + '?preview=1', true); xhttp.send(); $header = document.getElementById('ff-date-' + $opentab); $header.innerHTML = $weeks[$selectedweeks[airline].selected].filterName; overlayClose(); } function 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 = '