{"version":3,"file":"custom-up5jwY1l.js","sources":["../../../app/frontend/entrypoints/custom.js"],"sourcesContent":["// START SECTION FOR READ MORE TOGGLE BUTTON\n\n// We have to listen for turbo links instead of DOMContentLoaded now because\n// we're using turbo link partials, see more info: https://stackoverflow.com/questions/73168578/rails-js-script-code-not-working-while-screen-back-due-to-turbolinks\n\ndocument.addEventListener('turbo:load', function () {\n console.log('Custom JS in Entrypoints connected!');\n\n // Lightbox Controls\n const lightbox = document.getElementById('lightbox');\n const lightboxVideo = document.getElementById('lightbox-video');\n const lightboxClose = document.getElementsByClassName('lightbox-close')[0];\n\n document.querySelectorAll('.open-lightbox').forEach((element) => {\n element.addEventListener('click', function (event) {\n console.log('Open lightbox clicked');\n event.preventDefault();\n const videoUrl = this.getAttribute('data-video-url');\n lightboxVideo.src = videoUrl;\n lightbox.style.setProperty('display', 'flex', 'important'); // Show the lightbox\n });\n });\n\n if (lightboxClose) {\n lightboxClose.addEventListener('click', function () {\n lightbox.style.setProperty('display', 'none', 'important'); // Hide the lightbox\n lightboxVideo.src = ''; // Stop the video\n });\n }\n\n window.addEventListener('click', function (event) {\n if (event.target == lightbox) {\n lightbox.style.setProperty('display', 'none', 'important'); // Hide the lightbox\n lightboxVideo.src = ''; // Stop the video\n }\n });\n // End Lightbox Controls\n\n document.addEventListener('click', function (event) {\n if (event.target.matches('.toggle-btn')) {\n var btn = event.target;\n var descriptionText = document.querySelectorAll('.description-text');\n\n descriptionText.forEach(function (text) {\n text.classList.toggle('expanded');\n if (text.classList.contains('expanded')) {\n btn.textContent = 'Show less...';\n } else {\n btn.textContent = 'Read more...';\n window.scrollTo({ top: 0, behavior: 'smooth' });\n }\n });\n }\n });\n\n var menuToggle = document.getElementById('menu-toggle');\n var menuItems = document.getElementById('menu-items');\n\n // Function to toggle menu\n function toggleMenu() {\n menuItems.classList.toggle('visible');\n }\n\n // Listen for click on toggle button\n if (menuToggle) {\n menuToggle.addEventListener('click', function (event) {\n toggleMenu();\n event.stopPropagation(); // Prevent click from immediately propagating to document\n });\n }\n\n // Function to close menu if clicking outside of it\n function handleClickOutside(event) {\n if (\n !menuItems.contains(event.target) &&\n !menuToggle.contains(event.target) &&\n menuItems.classList.contains('visible')\n ) {\n menuItems.classList.remove('visible');\n }\n }\n\n // Listen for clicks outside of menu\n document.addEventListener('click', handleClickOutside);\n\n // END SECTION FOR READ MORE TOGGLE BUTTON\n\n // START SECTION FOR COUNTRY COUNTER\n\n const cityDiv = document.getElementById('cityDivCanada');\n const countryCountElement = document.getElementById('countryCountCanada');\n\n // Check if the necessary elements exist on the current page\n if (cityDiv && countryCountElement) {\n // Update the count initially\n updateCountryCount();\n\n // Function to update the count whenever the city div changes\n function updateCountryCount() {\n const numberOfCities = cityDiv.children.length;\n countryCountElement.textContent = `🇨🇦 Canada (${numberOfCities})`;\n }\n // Call the function to update the count after adding or removing cities\n updateCountryCount();\n }\n\n // END SECTION FOR COUNTRY COUNTER\n\n // START SECTION FOR BOOTSTRAP COLLAPSE\n\n function setupButtonToggle(buttonId, dataId) {\n var button = document.getElementById(buttonId);\n var collapseExample = document.getElementById(dataId);\n\n if (button && collapseExample) {\n button.addEventListener('click', function (e) {\n e.preventDefault();\n var isExpanded = collapseExample.classList.contains('show');\n\n if (isExpanded) {\n collapseExample.classList.remove('show');\n } else {\n collapseExample.classList.add('show');\n }\n });\n }\n }\n\n setupButtonToggle('more-info-button', 'more-info-data');\n setupButtonToggle('event-info-button', 'event-info-data');\n setupButtonToggle('artist-info-button', 'artist-info-data');\n setupButtonToggle('recurringEventButton', 'recurringEventData');\n\n // END SECTION FOR BOOTSTRAP COLLAPSE\n\n // START SECTION FOR DROPDOWN TOOLTIPS\n\n var dropdownItems = document.querySelectorAll('.dropdown-item');\n var showTimer, hideTimer;\n\n dropdownItems.forEach(function (dropdownItem) {\n dropdownItem.addEventListener('keydown', function (event) {\n var next;\n if (event.key === 'ArrowDown') {\n next = dropdownItem.nextElementSibling;\n if (next) {\n next.focus();\n }\n } else if (event.key === 'ArrowUp') {\n next = dropdownItem.previousElementSibling;\n if (next) {\n next.focus();\n }\n }\n });\n });\n\n function handleDropdownHoverAndKeyboard(element) {\n var dropdownMenu = element.querySelector('.dropdown-menu');\n element.addEventListener('mouseenter', function () {\n clearTimeout(hideTimer);\n var otherDropdownMenus = document.querySelectorAll('.dropdown-menu:not(.show)');\n otherDropdownMenus.forEach(function (menu) {\n menu.style.display = 'none';\n });\n showTimer = setTimeout(function () {\n dropdownMenu.style.display = 'block';\n }, 250);\n });\n element.addEventListener('mouseleave', function () {\n clearTimeout(showTimer);\n hideTimer = setTimeout(function () {\n dropdownMenu.style.display = 'none';\n }, 250);\n });\n element.addEventListener('keydown', function (event) {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n clearTimeout(showTimer);\n clearTimeout(hideTimer);\n var otherDropdownMenus = document.querySelectorAll('.dropdown-menu:not(.show)');\n otherDropdownMenus.forEach(function (menu) {\n menu.style.display = 'none';\n });\n dropdownMenu.style.display = 'block';\n var firstDropdownItem = dropdownMenu.querySelector('.dropdown-item');\n if (firstDropdownItem) {\n firstDropdownItem.focus();\n }\n }\n });\n dropdownMenu.addEventListener('mouseenter', function () {\n clearTimeout(hideTimer);\n });\n dropdownMenu.addEventListener('mouseleave', function () {\n hideTimer = setTimeout(function () {\n dropdownMenu.style.display = 'none';\n }, 250);\n });\n }\n\n var dropdownItems = document.querySelectorAll('.nav-item.dropdown, .dropdown');\n\n dropdownItems.forEach(function (dropdownItem) {\n handleDropdownHoverAndKeyboard(dropdownItem);\n });\n});\n// END SECTION FOR DROPDOWN TOOLTIPS\n\n// START SECTION FOR SCROLL TO TOP BUTTON\n\n// var scrollToTopBtn = document.getElementById('scrollToTopBtn');\n\n// // Show/hide the button based on the scroll position\n// window.addEventListener('scroll', function () {\n// if (window.pageYOffset > 20) {\n// scrollToTopBtn.style.display = 'block';\n// } else {\n// scrollToTopBtn.style.display = 'none';\n// }\n// });\n\n// // Scroll to top when the button is clicked\n// scrollToTopBtn.addEventListener('click', function () {\n// window.scrollTo({\n// top: 0,\n// behavior: 'smooth',\n// });\n// });\n\n// END SECTION FOR SCROLL TO TOP BUTTON\n// START SECTION FOR CALENDAR\nlet isCalendarInitialized = false;\n\nfunction initializeCalendar() {\n if (isCalendarInitialized) return;\n\n var calendarEl = document.getElementById('calendar');\n if (!calendarEl) return; // make sure the element exists\n\n var dancestyleSlug = calendarEl.dataset.dancestyleSlug;\n var calendar = new FullCalendar.Calendar(calendarEl, {\n // ... your calendar options\n });\n\n calendar.render();\n isCalendarInitialized = true;\n}\n\n// END SECTION FOR CALENDAR\n"],"names":["lightbox","lightboxVideo","lightboxClose","element","event","videoUrl","btn","descriptionText","text","menuToggle","menuItems","toggleMenu","handleClickOutside","cityDiv","countryCountElement","updateCountryCount","numberOfCities","setupButtonToggle","buttonId","dataId","button","collapseExample","e","isExpanded","dropdownItems","showTimer","hideTimer","dropdownItem","next","handleDropdownHoverAndKeyboard","dropdownMenu","otherDropdownMenus","menu","firstDropdownItem"],"mappings":"AAKA,SAAS,iBAAiB,aAAc,UAAY,CAClD,QAAQ,IAAI,qCAAqC,EAGjD,MAAMA,EAAW,SAAS,eAAe,UAAU,EAC7CC,EAAgB,SAAS,eAAe,gBAAgB,EACxDC,EAAgB,SAAS,uBAAuB,gBAAgB,EAAE,CAAC,EAEzE,SAAS,iBAAiB,gBAAgB,EAAE,QAASC,GAAY,CAC/DA,EAAQ,iBAAiB,QAAS,SAAUC,EAAO,CACjD,QAAQ,IAAI,uBAAuB,EACnCA,EAAM,eAAgB,EACtB,MAAMC,EAAW,KAAK,aAAa,gBAAgB,EACnDJ,EAAc,IAAMI,EACpBL,EAAS,MAAM,YAAY,UAAW,OAAQ,WAAW,CAC/D,CAAK,CACL,CAAG,EAEGE,GACFA,EAAc,iBAAiB,QAAS,UAAY,CAClDF,EAAS,MAAM,YAAY,UAAW,OAAQ,WAAW,EACzDC,EAAc,IAAM,EAC1B,CAAK,EAGH,OAAO,iBAAiB,QAAS,SAAUG,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