Skip to content

Commit 46214b4

Browse files
committed
Revert modifications of core modules
Previously a pull request was opened to merge this filter to the core, but eventually it became a separate plugin, so I had to use the already available methods of Tiddly. TiddlyWiki/TiddlyWiki5#3511
1 parent bdddeba commit 46214b4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

core/modules/filters/kin.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ Finds out where a tiddler originates from and what other tiddlers originate from
1212
/*global $tw: true */
1313
"use strict";
1414

15+
function getObjectKeysByExpression(object,callback) {
16+
var key,
17+
results = [];
18+
for (key in object) {
19+
if (object.hasOwnProperty(key) && callback(object[key])) {
20+
results.push(key);
21+
}
22+
}
23+
return results;
24+
};
25+
1526
function collectTitlesRecursively(baseTiddler,baseTitle,options) {
1627
var cacheName = "kin-filter-" + baseTitle + "-" + options.fieldName + "-",
1728
titlesPointingFromBase = {},
@@ -41,15 +52,15 @@ Finds out where a tiddler originates from and what other tiddlers originate from
4152
function collectTitlesPointingTo(title,currentDepth) {
4253
if(addToResultsIfNotFoundAlready(titlesPointingToBase,title,currentDepth)) {
4354
currentDepth += 1;
44-
$tw.utils.each(options.wiki.findTiddlersByField(title,options.fieldName),function(targetTitle) {
55+
$tw.utils.each(options.wiki.findListingsOfTiddler(title,options.fieldName),function(targetTitle) {
4556
collectTitlesPointingTo(targetTitle,currentDepth);
4657
});
4758
}
4859
}
4960

5061
function getResultsInGivenDepth(cachedData) {
5162
if(options.depth) {
52-
return $tw.utils.getObjectKeysByExpression(cachedData,function(value) {
63+
return getObjectKeysByExpression(cachedData,function(value) {
5364
return value <= options.depth;
5465
})
5566
} else {

0 commit comments

Comments
 (0)