1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-26 15:23:15 +00:00

Fixed problem with prefix filter

This commit is contained in:
Jeremy Ruston 2012-06-06 12:13:31 +01:00
parent e2ea8ff436
commit 72de3d4206

View File

@ -86,12 +86,12 @@ exports.operators = {
},
"prefix": {
selector: function(operator) {
var op = operator.prefix === "!" ? "!" : "";
return "for(var title in source) {if(" + op + "title.substr(0,\"" + operator.operand.length + "\")===\"" + $tw.utils.stringify(operator.operand) + "\") {$tw.utils.pushTop(subResults,title);}}";
var op = operator.prefix === "!" ? "!" : "=";
return "for(var title in source) {if(title.substr(0," + operator.operand.length + ")" + op + "==\"" + $tw.utils.stringify(operator.operand) + "\") {$tw.utils.pushTop(subResults,title);}}";
},
filter: function(operator) {
var op = operator.prefix === "!" ? "" : "!";
return "for(var r=subResults.length-1; r>=0; r--) {if(" + op + "title.substr(0,\"" + operator.operand.length + "\")===\"" + $tw.utils.stringify(operator.operand) + "\") {subResults.splice(r,1);}}";
var op = operator.prefix === "!" ? "=" : "!";
return "for(var r=subResults.length-1; r>=0; r--) {if(title.substr(0," + operator.operand.length + ")" + op + "==\"" + $tw.utils.stringify(operator.operand) + "\") {subResults.splice(r,1);}}";
}
},
"is": {