From: Scott Worley Date: Fri, 20 Oct 2023 20:35:04 +0000 (-0700) Subject: Dynamic title X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/246ed96550c1820ab47860314f117aaf334bc0cb?ds=sidebyside;hp=174811c9130a6a170768222463021706c0d5123a Dynamic title --- diff --git a/vopamoi.ts b/vopamoi.ts index 30efb1b..47c421d 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -562,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"); @@ -655,6 +656,11 @@ function BrowserUI() { } currentTagView = tag; + this.setTitle(); + }, + + setTitle: function () { + document.title = "Vopamoi: " + currentViewState + (currentTagView ? ": " + currentTagView : ""); }, setView: function (state: string) { @@ -668,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(); } @@ -787,6 +794,7 @@ function handleKey(event: any) { function browserInit() { log.replay(); + browserUI.setTitle(); browserUI.firstVisibleTask()?.focus(); document.body.addEventListener("keydown", handleKey, { capture: false }); }