]> git.scottworley.com Git - vopamoi/commitdiff
Dynamic title
authorScott Worley <scottworley@scottworley.com>
Fri, 20 Oct 2023 20:35:04 +0000 (13:35 -0700)
committerScott Worley <scottworley@scottworley.com>
Fri, 20 Oct 2023 20:35:04 +0000 (13:35 -0700)
vopamoi.ts

index 30efb1b2f47dc5999e1f3635be343f8ba6ed4bb0..47c421df5d9507951bafa547f9e090e16d6cf052 100644 (file)
@@ -562,6 +562,7 @@ function BrowserUI() {
 
     resetTagView: function () {
       currentTagView = null;
 
     resetTagView: function () {
       currentTagView = null;
+      this.setTitle();
       const taskList = document.getElementById("tasks")!;
       for (const task of Array.from(document.getElementsByClassName("task"))) {
         task.classList.remove("hide");
       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;
       }
 
       currentTagView = tag;
+      this.setTitle();
+    },
+
+    setTitle: function () {
+      document.title = "Vopamoi: " + currentViewState + (currentTagView ? ": " + currentTagView : "");
     },
 
     setView: function (state: string) {
     },
 
     setView: function (state: string) {
@@ -668,6 +674,7 @@ function BrowserUI() {
       sheet.removeRule(2);
       sheet.removeRule(2);
       currentViewState = state;
       sheet.removeRule(2);
       sheet.removeRule(2);
       currentViewState = state;
+      this.setTitle();
       if (this.currentTask()?.getAttribute("data-state") !== state) {
         this.firstVisibleTask()?.focus();
       }
       if (this.currentTask()?.getAttribute("data-state") !== state) {
         this.firstVisibleTask()?.focus();
       }
@@ -787,6 +794,7 @@ function handleKey(event: any) {
 
 function browserInit() {
   log.replay();
 
 function browserInit() {
   log.replay();
+  browserUI.setTitle();
   browserUI.firstVisibleTask()?.focus();
   document.body.addEventListener("keydown", handleKey, { capture: false });
 }
   browserUI.firstVisibleTask()?.focus();
   document.body.addEventListener("keydown", handleKey, { capture: false });
 }