Persist category filters
This commit is contained in:
parent
8b5b465231
commit
e4326a4394
14
index.html
14
index.html
|
@ -246,31 +246,31 @@
|
|||
<button ng-click="clearFilter()" class="btn btn-default btn-mini">Clear</button>
|
||||
<br>
|
||||
<label for="filter-speed">
|
||||
<input type="checkbox" ng-model="filterSpeed" id="filter-speed">
|
||||
<input type="checkbox" ng-model="filterSpeed" ng-change="persistFilters()" id="filter-speed">
|
||||
running
|
||||
</label>
|
||||
<label for="filter-active">
|
||||
<input type="checkbox" ng-model="filterActive" id="filter-active">
|
||||
<input type="checkbox" ng-model="filterActive" ng-change="persistFilters()" id="filter-active">
|
||||
active
|
||||
</label>
|
||||
<label for="filter-waiting">
|
||||
<input type="checkbox" ng-model="filterWaiting" id="filter-waiting">
|
||||
<input type="checkbox" ng-model="filterWaiting" ng-change="persistFilters()" id="filter-waiting">
|
||||
waiting
|
||||
</label>
|
||||
<label for="filter-complete">
|
||||
<input type="checkbox" ng-model="filterComplete" id="filter-complete">
|
||||
<input type="checkbox" ng-model="filterComplete" ng-change="persistFilters()" id="filter-complete">
|
||||
complete
|
||||
</label>
|
||||
<label for="filter-error">
|
||||
<input type="checkbox" ng-model="filterError" id="filter-error">
|
||||
<input type="checkbox" ng-model="filterError" ng-change="persistFilters()" id="filter-error">
|
||||
error
|
||||
</label>
|
||||
<label for="filter-paused">
|
||||
<input type="checkbox" ng-model="filterPaused" id="filter-paused">
|
||||
<input type="checkbox" ng-model="filterPaused" ng-change="persistFilters()" id="filter-paused">
|
||||
paused
|
||||
</label>
|
||||
<label for="filter-removed">
|
||||
<input type="checkbox" ng-model="filterRemoved" id="filter-removed">
|
||||
<input type="checkbox" ng-model="filterRemoved" ng-change="persistFilters()" id="filter-removed">
|
||||
removed
|
||||
</label>
|
||||
<button ng-click="toggleStateFilters()" class="btn btn-default btn-mini">Toggle</button>
|
||||
|
|
|
@ -188,6 +188,7 @@ function(
|
|||
scope.filterError = !scope.filterError;
|
||||
scope.filterPaused = !scope.filterPaused;
|
||||
scope.filterRemoved = !scope.filterRemoved;
|
||||
scope.persistFilters();
|
||||
};
|
||||
|
||||
scope.resetFilters = function() {
|
||||
|
@ -200,9 +201,38 @@ function(
|
|||
scope.filterRemoved =
|
||||
true;
|
||||
scope.clearFilter();
|
||||
scope.persistFilters();
|
||||
};
|
||||
|
||||
scope.resetFilters();
|
||||
scope.persistFilters = function() {
|
||||
var o = JSON.stringify({
|
||||
s: scope.filterSpeed,
|
||||
a: scope.filterActive,
|
||||
w: scope.filterWaiting,
|
||||
c: scope.filterComplete,
|
||||
e: scope.filterError,
|
||||
p: scope.filterPaused,
|
||||
r: scope.filterRemoved
|
||||
});
|
||||
utils.setCookie("aria2filters", o);
|
||||
};
|
||||
|
||||
scope.loadFilters = function() {
|
||||
var o = JSON.parse(utils.getCookie("aria2filters"));
|
||||
if (!o) {
|
||||
scope.resetFilters();
|
||||
return;
|
||||
}
|
||||
scope.filterSpeed = !!o.s;
|
||||
scope.filterActive = !!o.a;
|
||||
scope.filterWaiting = !!o.w;
|
||||
scope.filterComplete = !!o.c;
|
||||
scope.filterError = !!o.e;
|
||||
scope.filterPaused = !!o.p;
|
||||
scope.filterRemoved = !!o.r;
|
||||
};
|
||||
|
||||
scope.loadFilters();
|
||||
|
||||
|
||||
// max downloads shown in one page
|
||||
|
|
Loading…
Reference in New Issue
Block a user