mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 21:05:15 +00:00
* Inertia p1? * Inertia'fied signed out homepage? * Split up signed in page * WIP signed in v2? * Better signed in? * Clean up extensions page! * Fix currently hacking * Better docs page? * Docs update 2 * Clean up "What is Hackatime?" + get rid of that godawful green dev mode * Better nav? * Cleaner settings? * Fix commit times * Fix flashes + OS improv * Setup v2 * Readd some of the syncers? * Remove stray emdash * Clean up Step 3 * Oops, remove .vite * bye bye, /inertia-example * bin/rubocop -A * Fix docs vuln
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
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');
|
|
}
|
|
}
|
|
}
|
|
|
|
function outta() {
|
|
// we should figure out a better way of doing this rather than this shit ass way, but it works for now
|
|
const modal = document.getElementById('logout-modal');
|
|
if (!modal) return;
|
|
|
|
window.showLogout = function () {
|
|
modal.dispatchEvent(new CustomEvent('modal:open', { bubbles: true }));
|
|
};
|
|
}
|
|
|
|
// Handle both initial page load and subsequent Turbo navigations
|
|
document.addEventListener('turbo:load', function () {
|
|
setupCurrentlyHacking();
|
|
outta();
|
|
});
|
|
document.addEventListener('turbo:render', function () {
|
|
setupCurrentlyHacking();
|
|
outta();
|
|
});
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
setupCurrentlyHacking();
|
|
outta();
|
|
});
|