mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
Merge branch 'search'
This commit is contained in:
commit
d859cb554a
1 file changed
+6
-2
+6
-2
@@ -4,8 +4,12 @@ function drawcontents(data) {
|
|||||||
data = data || _lastData; //Cache data so we can drawcontents without waiting for the server, for the search box.
|
data = data || _lastData; //Cache data so we can drawcontents without waiting for the server, for the search box.
|
||||||
_lastData = data;
|
_lastData = data;
|
||||||
|
|
||||||
const search = new RegExp(document.querySelector("#search").value, 'i');
|
// allow searching for multiple criteria separated by space
|
||||||
data = data.filter(function(item) {
|
var searchArgs = document.querySelector("#search").value;
|
||||||
|
searchArgs = searchArgs.trim();
|
||||||
|
searchArgs = '(' + searchArgs.replace(/ +/g,")|(") + ')';
|
||||||
|
const search = new RegExp(searchArgs, 'i');
|
||||||
|
data = data.filter(function(item) {
|
||||||
return search.test(item.name);
|
return search.test(item.name);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user