task.setAttribute("tabindex", "0");
task.setAttribute("data-created", timestamp);
document.getElementById("tasks")!.appendChild(task);
- task.focus();
return task;
},
for (const task of document.getElementsByClassName("task")) {
if (task !== target && this.getPriority(task) > priority) {
task.parentElement!.insertBefore(target, task);
- target instanceof HTMLElement && target.focus();
return target;
}
}
document.getElementById("tasks")!.appendChild(target);
- target instanceof HTMLElement && target.focus();
return target;
},
const input = <HTMLInputElement>document.getElementById("taskName");
if (input.value) {
const task = UI.addTask(input.value);
+ if (task && task instanceof HTMLElement) task.focus();
input.value = "";
if (event.getModifierState("Control")) {
this.setPriority(task, null, document.getElementsByClassName("task")[0]);
const newPriorityRounded = Math.round(newPriority);
const okToRound = aPriority < newPriorityRounded && newPriorityRounded < bPriority;
UI.setPriority(task.getAttribute("data-created")!, okToRound ? newPriorityRounded : newPriority, Model.getPriority(task));
+ task instanceof HTMLElement && task.focus();
},
setState: function (state: string) {