X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/b9f7e98914ca882508950ec54e27d78a11f5179e..246ed96550c1820ab47860314f117aaf334bc0cb:/vopamoi.ts diff --git a/vopamoi.ts b/vopamoi.ts index 0389a04..47c421d 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -446,6 +446,7 @@ function BrowserUI() { var target = document.activeElement; if (!target) return null; if (target.classList.contains("tag")) target = target.parentElement!; + if (!target.classList.contains("task")) return null; return target as HTMLElement; }, @@ -525,7 +526,11 @@ function BrowserUI() { }, moveCursorVertically: function (offset: number): boolean { - const active = this.currentTask(); + let active = this.currentTask(); + if (!active) { + this.firstVisibleTask()?.focus(); + active = this.currentTask(); + } if (!active) return false; const dest = this.visibleTaskAtOffset(active, offset); if (dest !== active && dest instanceof HTMLElement) { @@ -557,6 +562,7 @@ function BrowserUI() { resetTagView: function () { currentTagView = null; + this.setTitle(); const taskList = document.getElementById("tasks")!; for (const task of Array.from(document.getElementsByClassName("task"))) { task.classList.remove("hide"); @@ -650,6 +656,11 @@ function BrowserUI() { } currentTagView = tag; + this.setTitle(); + }, + + setTitle: function () { + document.title = "Vopamoi: " + currentViewState + (currentTagView ? ": " + currentTagView : ""); }, setView: function (state: string) { @@ -663,6 +674,7 @@ function BrowserUI() { sheet.removeRule(2); sheet.removeRule(2); currentViewState = state; + this.setTitle(); if (this.currentTask()?.getAttribute("data-state") !== state) { this.firstVisibleTask()?.focus(); } @@ -782,6 +794,7 @@ function handleKey(event: any) { function browserInit() { log.replay(); + browserUI.setTitle(); browserUI.firstVisibleTask()?.focus(); document.body.addEventListener("keydown", handleKey, { capture: false }); }