2013-05-25 16:26:22 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/filters/is/current.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: isfilteroperator
|
|
|
|
|
|
|
|
Filter function for [is[current]]
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/*
|
|
|
|
Export our filter function
|
|
|
|
*/
|
|
|
|
exports.current = function(source,prefix,options) {
|
2014-04-27 19:03:33 +00:00
|
|
|
var results = [],
|
|
|
|
currTiddlerTitle = options.widget && options.widget.getVariable("currentTiddler");
|
2014-04-03 19:49:16 +00:00
|
|
|
if(prefix === "!") {
|
|
|
|
source(function(tiddler,title) {
|
2014-04-27 19:03:33 +00:00
|
|
|
if(title !== currTiddlerTitle) {
|
2014-04-03 19:49:16 +00:00
|
|
|
results.push(title);
|
2013-05-25 16:26:22 +00:00
|
|
|
}
|
2014-04-03 19:49:16 +00:00
|
|
|
});
|
2013-05-25 16:26:22 +00:00
|
|
|
} else {
|
2014-04-03 19:49:16 +00:00
|
|
|
source(function(tiddler,title) {
|
2014-04-27 19:03:33 +00:00
|
|
|
if(title === currTiddlerTitle) {
|
2014-04-03 19:49:16 +00:00
|
|
|
results.push(title);
|
|
|
|
}
|
|
|
|
});
|
2013-05-25 16:26:22 +00:00
|
|
|
}
|
|
|
|
return results;
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|