Created
February 28, 2017 09:47
-
-
Save alexwlchan/163ab04bda82627091d63d717c14b67a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// auto_collapse_deferred_items.js | |
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
// | |
// This script collapses any projects with the @defer tag in the frontmost | |
// window. Useful for tidying up the window, so I don't have to see the | |
// detail associated with those projects. | |
'use strict' | |
function TaskPaperCollapseDeferredItems(editor, options) { | |
var projects = editor.outline.evaluateItemPath('//@type=project'); | |
for (idx in projects) { | |
var project = projects[idx]; | |
if (project.hasAttribute("data-defer")) { | |
editor.setCollapsed(project); | |
} | |
} | |
return 0; | |
} | |
Application("TaskPaper").documents[0].evaluate({ | |
script: TaskPaperCollapseDeferredItems.toString() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment