X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/55c0520e11d12258f0913f11043fc402723339f8..06c452120f001ffee11ae5b80263fc1ed4fea481:/vopamoi.ts diff --git a/vopamoi.ts b/vopamoi.ts index 30efb1b..1d357bd 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -320,7 +320,7 @@ function BrowserUI() { todo: "White", waiting: "MediumOrchid", }; - var currentTagView: string | null = null; + var currentTagFilter: string | null = null; var currentViewState = "todo"; var taskFocusedBeforeJumpingToInput: HTMLElement | null = null; var lastTagNameEntered = ""; @@ -561,7 +561,8 @@ function BrowserUI() { }, resetTagView: function () { - currentTagView = null; + currentTagFilter = null; + this.setTitle(); const taskList = document.getElementById("tasks")!; for (const task of Array.from(document.getElementsByClassName("task"))) { task.classList.remove("hide"); @@ -610,14 +611,8 @@ function BrowserUI() { return ui.setState(createTimestamp, newState, oldState); }, - setTagView: function (tag: string | null = null) { - if (tag === null) { - const target = this.currentTag(); - if (!target) return; - tag = target.textContent!; - } - - if (currentTagView !== null) { + setTagFilter: function (tag: string) { + if (currentTagFilter !== null) { this.resetTagView(); } @@ -654,7 +649,21 @@ function BrowserUI() { } } - currentTagView = tag; + currentTagFilter = tag; + this.setTitle(); + }, + + setTagView: function (tag: string | null = null) { + if (tag === null) { + const target = this.currentTag(); + if (!target) return; + tag = target.textContent!; + } + this.setTagFilter(tag); + }, + + setTitle: function () { + document.title = "Vopamoi: " + currentViewState + (currentTagFilter ? ": " + currentTagFilter : ""); }, setView: function (state: string) { @@ -668,13 +677,14 @@ function BrowserUI() { sheet.removeRule(2); sheet.removeRule(2); currentViewState = state; + this.setTitle(); if (this.currentTask()?.getAttribute("data-state") !== state) { this.firstVisibleTask()?.focus(); } }, setUntaggedView: function () { - if (currentTagView !== null) { + if (currentTagFilter !== null) { this.resetTagView(); } for (const task of document.getElementsByClassName("task")) { @@ -787,6 +797,7 @@ function handleKey(event: any) { function browserInit() { log.replay(); + browserUI.setTitle(); browserUI.firstVisibleTask()?.focus(); document.body.addEventListener("keydown", handleKey, { capture: false }); }