1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-04 19:04:30 +00:00

- Remember selected filter using a Cookie (Web UI)

This commit is contained in:
Christophe Dumez 2009-12-04 21:03:50 +00:00
parent f9a5afe446
commit f0a18ec1f5
3 changed files with 17 additions and 3 deletions

View File

@ -1,7 +1,16 @@
<ul>
<li class="selectedFilter" id="all_filter"><a href="#" onclick="setFilter('all');"><img src="images/skin/filterall.png"/>_(All)</a></li>
<li id="all_filter"><a href="#" onclick="setFilter('all');"><img src="images/skin/filterall.png"/>_(All)</a></li>
<li id="downloading_filter"><a href="#" onclick="setFilter('downloading');"><img src="images/skin/downloading.png"/>_(Downloading)</a></li>
<li id="completed_filter"><a href="#" onclick="setFilter('completed');"><img src="images/skin/uploading.png"/>_(Completed)</a></li>
<li id="active_filter"><a href="#" onclick="setFilter('active');"><img src="images/skin/filteractive.png"/>_(Active)</a></li>
<li id="inactive_filter"><a href="#" onclick="setFilter('inactive');"><img src="images/skin/filterinactive.png"/>_(Inactive)</a></li>
</ul>
</ul>
<script type="text/javascript">
// Remember this via Cookie
var last_filter = Cookie.read('selected_filter');
if(!$defined(last_filter)) {
last_filter = 'all';
}
$(last_filter+'_filter').addClass('selectedFilter');
</script>

View File

@ -177,6 +177,8 @@ window.addEvent('domready', function(){
$(f+"_filter").addClass("selectedFilter");
myTable.setFilter(f);
ajaxfn();
// Remember this via Cookie
Cookie.write('selected_filter', f);
}
});

View File

@ -42,7 +42,10 @@ var dynamicTable = new Class ({
this.cur = new Array();
this.priority_hidden = false;
this.progressIndex = progressIndex;
this.filter = 'all';
this.filter = Cookie.read('selected_filter');
if(!$defined(this.filter)) {
this.filter = 'all';
}
this.context_menu = context_menu;
this.table.sortedIndex = 1; // Default is NAME
this.table.reverseSort = false;