mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-20 00:35:22 +00:00
20 lines
777 B
JavaScript
20 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);
|