mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-19 06:06:17 +00:00
50 lines
956 B
JavaScript
50 lines
956 B
JavaScript
![]() |
/*\
|
||
|
title: $:/core/modules/filters/is/shadow.js
|
||
|
type: application/javascript
|
||
|
module-type: isfilteroperator
|
||
|
|
||
|
Filter function for [is[shadow]]
|
||
|
|
||
|
\*/
|
||
|
(function(){
|
||
|
|
||
|
/*jslint node: true, browser: true */
|
||
|
/*global $tw: false */
|
||
|
"use strict";
|
||
|
|
||
|
/*
|
||
|
Export our filter function
|
||
|
*/
|
||
|
exports.shadow = function(source,prefix,options) {
|
||
|
var results = [];
|
||
|
// Function to check a tiddler
|
||
|
function checkTiddler(title) {
|
||
|
var match = options.wiki.isShadowTiddler(title);
|
||
|
if(prefix === "!") {
|
||
|
match = !match;
|
||
|
}
|
||
|
if(match) {
|
||
|
results.push(title);
|
||
|
}
|
||
|
};
|
||
|
// Iterate through the source tiddlers
|
||
|
if($tw.utils.isArray(source)) {
|
||
|
$tw.utils.each(source,function(title) {
|
||
|
checkTiddler(title);
|
||
|
});
|
||
|
} else {
|
||
|
if(prefix !== "!") {
|
||
|
$tw.utils.each(options.wiki.shadowTiddlers,function(tiddler,title) {
|
||
|
results.push(title);
|
||
|
});
|
||
|
} else {
|
||
|
$tw.utils.each(source,function(element,title) {
|
||
|
checkTiddler(title);
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
return results;
|
||
|
};
|
||
|
|
||
|
})();
|