mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-25 23:03:15 +00:00
Add x-listops filter toggle (#4990)
This commit is contained in:
parent
5aa4e4cb68
commit
c41e34793d
|
@ -187,4 +187,19 @@ Extended filter operators to manipulate the current list.
|
||||||
}, []);
|
}, []);
|
||||||
return set;
|
return set;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Toggles an item in the current list.
|
||||||
|
*/
|
||||||
|
exports.toggle = function(source, operator) {
|
||||||
|
var results = prepare_results(source),
|
||||||
|
index = results.indexOf(operator.operand);
|
||||||
|
if(index === -1) {
|
||||||
|
results.push(operator.operand);
|
||||||
|
} else {
|
||||||
|
results.splice(index, 1);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user