mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
21 lines
777 B
JavaScript
21 lines
777 B
JavaScript
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
|
import "@hotwired/turbo-rails"
|
|
import "controllers"
|
|
|
|
function setupCurrentlyHacking() {
|
|
const header = document.querySelector('.currently-hacking');
|
|
// only if no existing event listener
|
|
if (!header) { return }
|
|
header.onclick = function() {
|
|
const container = document.querySelector('.currently-hacking-container');
|
|
if (container) {
|
|
container.classList.toggle('visible');
|
|
}
|
|
}
|
|
}
|
|
|
|
// Handle both initial page load and subsequent Turbo navigations
|
|
document.addEventListener('turbo:load', setupCurrentlyHacking);
|
|
document.addEventListener('turbo:render', setupCurrentlyHacking);
|
|
document.addEventListener('DOMContentLoaded', setupCurrentlyHacking);
|