2020-11-07 10:29:15 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/filters/is/draft.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: isfilteroperator
|
|
|
|
|
|
|
|
Filter function for [is[draft]] analagous to [has[draft.of]]
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/*
|
|
|
|
Export our filter function
|
|
|
|
*/
|
|
|
|
exports.draft = function(source,prefix,options) {
|
|
|
|
var results = [];
|
|
|
|
if(prefix === "!") {
|
|
|
|
source(function(tiddler,title) {
|
2022-02-22 16:41:29 +00:00
|
|
|
if(!tiddler || !tiddler.isDraft()) {
|
2020-11-07 10:29:15 +00:00
|
|
|
results.push(title);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
source(function(tiddler,title) {
|
2022-02-22 16:41:29 +00:00
|
|
|
if(tiddler && tiddler.isDraft()) {
|
2020-11-07 10:29:15 +00:00
|
|
|
results.push(title);
|
|
|
|
}
|
2021-05-30 18:20:17 +00:00
|
|
|
});
|
2020-11-07 10:29:15 +00:00
|
|
|
}
|
|
|
|
return results;
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|