Fixed some TODO #hash handling.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3233 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
09a283fdbc
commit
fb94e1cde9
@ -64,15 +64,17 @@ core.register("onInput", function(command) {
|
|||||||
activeList = makePrivateKey(command);
|
activeList = makePrivateKey(command);
|
||||||
writeList(activeList, {name: command, items: []}).then(notifyChanged).then(redisplay);
|
writeList(activeList, {name: command, items: []}).then(notifyChanged).then(redisplay);
|
||||||
}
|
}
|
||||||
} else if (command.hash) {
|
|
||||||
activeList = command.hash;
|
|
||||||
if (activeList.charAt(0) == "#") {
|
|
||||||
activeList = activeList.substring(1);
|
|
||||||
}
|
|
||||||
redisplay();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
core.register("hashChange", function(event) {
|
||||||
|
activeList = event.hash;
|
||||||
|
if (activeList && activeList.charAt(0) == "#") {
|
||||||
|
activeList = activeList.substring(1);
|
||||||
|
}
|
||||||
|
redisplay();
|
||||||
|
});
|
||||||
|
|
||||||
core.register("onMessage", function(message) {
|
core.register("onMessage", function(message) {
|
||||||
return redisplay();
|
return redisplay();
|
||||||
});
|
});
|
||||||
@ -137,6 +139,8 @@ function removeItem(key, name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function printList(name, key, items) {
|
function printList(name, key, items) {
|
||||||
|
terminal.cork();
|
||||||
|
terminal.clear();
|
||||||
terminal.print(name,
|
terminal.print(name,
|
||||||
" - ",
|
" - ",
|
||||||
{command: "action:" + JSON.stringify({action: "setShowHidden", value: !showHidden}), value: showHidden ? "stop showing hidden" : "show hidden"},
|
{command: "action:" + JSON.stringify({action: "setShowHidden", value: !showHidden}), value: showHidden ? "stop showing hidden" : "show hidden"},
|
||||||
@ -170,9 +174,11 @@ function printList(name, key, items) {
|
|||||||
")");
|
")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
terminal.uncork();
|
||||||
}
|
}
|
||||||
|
|
||||||
function redisplay() {
|
function redisplay() {
|
||||||
|
terminal.cork();
|
||||||
terminal.clear();
|
terminal.clear();
|
||||||
terminal.setEcho(false);
|
terminal.setEcho(false);
|
||||||
if (activeList) {
|
if (activeList) {
|
||||||
@ -184,6 +190,7 @@ function redisplay() {
|
|||||||
} else {
|
} else {
|
||||||
printListOfLists();
|
printListOfLists();
|
||||||
}
|
}
|
||||||
|
terminal.uncork();
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeId() {
|
function makeId() {
|
||||||
@ -239,8 +246,9 @@ function getVisibleLists() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function printListOfLists() {
|
function printListOfLists() {
|
||||||
terminal.print("TODO Lists:");
|
|
||||||
getVisibleLists().then(function(keys) {
|
getVisibleLists().then(function(keys) {
|
||||||
|
terminal.cork();
|
||||||
|
terminal.print("TODO Lists:");
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
terminal.print({
|
terminal.print({
|
||||||
@ -248,6 +256,7 @@ function printListOfLists() {
|
|||||||
value: getName(key),
|
value: getName(key),
|
||||||
}, " ", isPrivate(key) ? "(private)" : "(public)");
|
}, " ", isPrivate(key) ? "(private)" : "(public)");
|
||||||
}
|
}
|
||||||
|
terminal.uncork();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user