todo: "White",
waiting: "MediumOrchid",
};
- var currentTagView: string | null = null;
+ var currentTagFilter: string | null = null;
var currentViewState = "todo";
var taskFocusedBeforeJumpingToInput: HTMLElement | null = null;
var lastTagNameEntered = "";
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;
},
},
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) {
},
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");
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();
}
}
}
- 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) {
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")) {
function browserInit() {
log.replay();
+ browserUI.setTitle();
browserUI.firstVisibleTask()?.focus();
document.body.addEventListener("keydown", handleKey, { capture: false });
}