Last active
June 4, 2020 10:48
-
-
Save astyagun/4b59dcf04af80bb32c4198b169e54f0a to your computer and use it in GitHub Desktop.
Добавить действие "Запланировать следующее действие" с контекстом "Мак"
This file contains hidden or 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
/*{ | |
"author": "Anton Styagun", | |
"targets": ["omnifocus"], | |
"type": "action", | |
"identifier": "com.antonstyagun.planNextAction", | |
"version": "0.1", | |
"description": "Добавить действие \"Запланировать следующее действие\" с контекстом \"Мак\"", | |
"label": "Запланировать следующее действие", | |
"mediumLabel": "Запланировать следующее действие", | |
"paletteLabel": "Запланировать следующее действие", | |
}*/ | |
// https://gist.github.com/astyagun/4b59dcf04af80bb32c4198b169e54f0a | |
(() => { | |
let action = new PlugIn.Action(function(selection) { | |
new Task('Запланировать следующее действие', taskInsertionPosition(selection)).addTag(tagNamed("Мак")); | |
}); | |
action.validate = function(selection){ | |
return app.platformName == 'macOS'; | |
}; | |
return action; | |
})(); | |
function taskInsertionPosition(selection) { | |
if(selection.projects.length > 0) | |
return selection.projects[selection.projects.length - 1]; | |
else if(selection.tasks.length > 0) | |
return selection.tasks[selection.tasks.length - 1].after; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment