Commit 1a7339bf authored by Max Bebök's avatar Max Bebök

#54 added limit to actor-search

parent 736ea71e
......@@ -68,6 +68,12 @@
margin-bottom: 5px;
}
#searchWindow-actor .data-limit {
width: 80px;
height: 25px;
margin-right: 6px;
}
#searchWindow-actor .btn-group:last-child {
float: right;
}
......@@ -142,6 +148,7 @@
<div class="search-footer">
<button class="btn btn btn-default data-tool-selectAll">Select All</button>
<span>
Limit: <input type="number" class="form-control data-limit" placeholder='∞' value="100" />
Actors found: <span class="data-resultCount">0</span>
</span>
</div>
......
......@@ -23,8 +23,13 @@ module.exports = class Actor_Search_Finder
{
const actor = this.actorHandler.actors[actorId];
if(this._checkActor(actor, searchValue, filter))
if(this._checkActor(actor, searchValue, filter)) {
this.result.push(actor);
if(!isNaN(filter.limit) && this.result.length >= filter.limit) {
break;
}
}
}
return this.result;
}
......
......@@ -78,6 +78,8 @@ module.exports = class Actor_Search_GUI
*/
_initFilters()
{
this.filter.limit = 100;
const filterNodes = this.windowNode.querySelectorAll("button[data-filter]");
for(let node of filterNodes)
{
......@@ -94,10 +96,15 @@ module.exports = class Actor_Search_GUI
};
}
this.windowNode.querySelector(".data-searchValue").onkeyup = (ev) => {
this.windowNode.querySelector(".data-searchValue").onkeyup = ev => {
this.searchValue = ev.target.value;
this._triggerSearch();
};
this.windowNode.querySelector(".data-limit").onchange = ev => {
this.filter.limit = parseInt(ev.target.value);
this._triggerSearch();
};
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment