mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-02 20:29:10 +00:00
Fixed bug with negated title filter
This commit is contained in:
parent
94c7a4fc39
commit
e42a062dcc
@ -78,10 +78,15 @@ exports.filterFragments = {
|
||||
exports.operators = {
|
||||
"title": { // Filter by title
|
||||
selector: function(operator) {
|
||||
return "$tw.utils.pushTop(subResults,\"" + $tw.utils.stringify(operator.operand) + "\");";
|
||||
if(operator.prefix === "!") {
|
||||
return "for(title in source) {if(title !== \"" + $tw.utils.stringify(operator.operand) + "\") {$tw.utils.pushTop(subResults,title);}}";
|
||||
} else {
|
||||
return "$tw.utils.pushTop(subResults,\"" + $tw.utils.stringify(operator.operand) + "\");";
|
||||
}
|
||||
},
|
||||
filter: function(operator) {
|
||||
return "if(subResults.indexOf(\"" + $tw.utils.stringify(operator.operand) + "\") !== -1) {subResults = [\"" + $tw.utils.stringify(operator.operand) + "\"];} else {subResults = [];}";
|
||||
var op = operator.prefix === "!" ? "!" : "=";
|
||||
return "if(subResults.indexOf(\"" + $tw.utils.stringify(operator.operand) + "\") " + op + "== -1) {subResults = [\"" + $tw.utils.stringify(operator.operand) + "\"];} else {subResults = [];}";
|
||||
}
|
||||
},
|
||||
"prefix": { // Filter by title prefix
|
||||
|
Loading…
Reference in New Issue
Block a user