1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-16 08:54:22 +00:00
TiddlyWiki5/core/modules/filters/shadowsource.js

41 lines
834 B
JavaScript

/*\
title: $:/core/modules/filters/shadowsource.js
type: application/javascript
module-type: filteroperator
Filter operator for returning the source plugins for shadow tiddlers
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.shadowsource = function(source,operator,options) {
var results = [],
pushShadowSource = function(title) {
var source = options.wiki.getShadowSource(title);
if(source) {
$tw.utils.pushTop(results,source);
}
};
// Iterate through the source tiddlers
if($tw.utils.isArray(source)) {
$tw.utils.each(source,function(title) {
pushShadowSource(title);
});
} else {
$tw.utils.each(source,function(element,title) {
pushShadowSource(title);
});
}
results.sort();
return results;
};
})();