Skip to content

Commit

Permalink
Merge branch 'main' into deutsch-translation
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmoro authored Nov 6, 2024
2 parents a7f8dc2 + 1dba4a1 commit 8a13620
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
16 changes: 15 additions & 1 deletion src/modules/static.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { store } from '../store';
import { onMouseMove } from '../utils';

let mouseTimeout: NodeJS.Timeout;

export function initStaticMode() {
if (store.get('static')) {
Expand All @@ -8,3 +9,16 @@ export function initStaticMode() {
document.addEventListener('mousemove', onMouseMove);
}
}

function onMouseMove() {
const footer = document.querySelector<HTMLElement>('footer');
footer?.classList.remove('hidden');

clearTimeout(mouseTimeout);

mouseTimeout = setTimeout(() => {
if (!footer?.matches(':hover')) {
footer?.classList.add('hidden');
}
}, 3000);
}
11 changes: 0 additions & 11 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { CITE_FACTOR, INITIAL_THEME_FONT_SIZE } from '../modules/font';
import { store } from '../store';

const GITHUB_NEW_ISSUE_URL = 'https://github.com/cdmoro/literature-clock/issues/new';
let mouseTimeout: NodeJS.Timeout;

export function getTime() {
const testTime = store.get('time');
Expand Down Expand Up @@ -121,16 +120,6 @@ export function updateFavicon(time: string = getTime()) {
link.href = `/favicon/${getFaviconFileName(time)}.ico`;
}

export function onMouseMove() {
const footer = document.querySelector<HTMLElement>('footer');
footer?.classList.remove('hidden');

clearTimeout(mouseTimeout);
mouseTimeout = setTimeout(() => {
footer?.classList.add('hidden');
}, 3000);
}

export function contentLoaded() {
updateFavicon();
document.body.removeAttribute('data-loading');
Expand Down

0 comments on commit 8a13620

Please sign in to comment.