firstVisibleTask: function () {
for (const task of document.getElementsByClassName("task")) {
const state = task.getAttribute("data-state");
- if (task instanceof HTMLElement && (state === currentViewState || (currentViewState === "all" && state !== "deleted"))) {
+ if (
+ task instanceof HTMLElement &&
+ (state === currentViewState || (currentViewState === "all" && state !== "deleted")) &&
+ !task.classList.contains("hide")
+ ) {
return task;
}
}
cursor = increment > 0 ? cursor.nextElementSibling : cursor.previousElementSibling;
if (!cursor || !(cursor instanceof HTMLElement)) break;
const state = cursor.getAttribute("data-state")!;
- if (state === currentViewState || (currentViewState === "all" && state !== "deleted")) {
+ if (
+ (state === currentViewState || (currentViewState === "all" && state !== "deleted")) &&
+ !cursor.classList.contains("hide")
+ ) {
offset -= increment;
valid_cursor = cursor;
}
ui.removeTag(target.parentElement!.getAttribute("data-created")!, target.textContent!);
},
+ resetTagView: function () {
+ for (const task of document.getElementsByClassName("task")) {
+ task.classList.remove("hide");
+ }
+ },
+
resetView: function () {
this.setView("todo");
+ this.resetTagView();
},
returnFocusAfterInput: function (): boolean {
return ui.setState(createTimestamp, newState, oldState);
},
+ setTagView: function () {
+ const target = this.currentTag();
+ if (!target) return;
+ const tag = target.textContent!;
+ for (const task of document.getElementsByClassName("task")) {
+ if (Model.hasTag(task, tag)) {
+ task.classList.remove("hide");
+ } else {
+ task.classList.add("hide");
+ }
+ }
+ },
+
setView: function (state: string) {
const sheet = (document.getElementById("viewStyle") as HTMLStyleElement).sheet!;
if (state === "all") {
if (event.key == "d") return browserUI.setView("done");
if (event.key == "q") return browserUI.setView("todo");
if (event.key == "s") return (inputState = InputState.VS);
+ if (event.key == "T") return browserUI.resetTagView();
+ if (event.key == "t") return browserUI.setTagView();
if (event.key == "v") return browserUI.resetView();
if (event.key == "w") return browserUI.setView("waiting");
if (event.key == "x") return browserUI.setView("deleted");