You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/assets/js/app.js

35 lines
833 B
JavaScript

import css from "../css/app.css"
import "./polyfills/closest"
import "./stats"
import "./timeframe-selector"
import "phoenix_html"
const triggers = document.querySelectorAll('[data-dropdown-trigger]')
for (const trigger of triggers) {
trigger.addEventListener('click', function(e) {
e.stopPropagation()
e.currentTarget.nextElementSibling.classList.remove('hidden')
})
}
if (triggers.length > 0) {
document.addEventListener('click', function(e) {
const clickedInDropdown = e.target.closest('[data-dropdown]')
if (!clickedInDropdown) {
for (const dropdown of document.querySelectorAll('[data-dropdown]')) {
dropdown.classList.add('hidden')
}
}
})
}
const flash = document.getElementById('flash')
if (flash) {
setTimeout(function() {
flash.style.display = 'none'
}, 2500)
}