mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-11 09:50:27 +00:00
Added "prefix" filter
It selects tiddlers whose title starts with a given string
This commit is contained in:
parent
2a1b0cec00
commit
b91ccb064b
@ -84,6 +84,16 @@ exports.operators = {
|
||||
return "if(subResults.indexOf(\"" + $tw.utils.stringify(operator.operand) + "\") !== -1) {subResults = [\"" + $tw.utils.stringify(operator.operand) + "\"];} else {subResults = [];}";
|
||||
}
|
||||
},
|
||||
"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);}}";
|
||||
},
|
||||
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);}}";
|
||||
}
|
||||
},
|
||||
"is": {
|
||||
selector: function(operator) {
|
||||
if(operator.operand === "tiddler") {
|
||||
|
Loading…
Reference in New Issue
Block a user