2013-05-25 16:26:22 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/filters/tags.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: filteroperator
|
|
|
|
|
2013-08-07 15:04:06 +00:00
|
|
|
Filter operator returning all the tags of the selected tiddlers
|
2013-05-25 16:26:22 +00:00
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/*
|
|
|
|
Export our filter function
|
|
|
|
*/
|
|
|
|
exports.tags = function(source,operator,options) {
|
2015-07-05 18:47:44 +00:00
|
|
|
var tags = {};
|
2014-04-03 19:49:16 +00:00
|
|
|
source(function(tiddler,title) {
|
2015-07-05 18:47:44 +00:00
|
|
|
var t, length;
|
2013-05-25 16:26:22 +00:00
|
|
|
if(tiddler && tiddler.fields.tags) {
|
2015-07-05 18:47:44 +00:00
|
|
|
for(t=0, length=tiddler.fields.tags.length; t<length; t++) {
|
|
|
|
tags[tiddler.fields.tags[t]] = true;
|
|
|
|
}
|
2013-05-25 16:26:22 +00:00
|
|
|
}
|
2014-04-03 19:49:16 +00:00
|
|
|
});
|
2015-07-05 18:47:44 +00:00
|
|
|
return Object.keys(tags);
|
2013-05-25 16:26:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
})();
|