Fixed bug with negated title filter

print-window-tiddler
Jeremy Ruston 2013-04-25 10:03:37 +01:00
rodzic 94c7a4fc39
commit e42a062dcc
1 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -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