mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-18 18:35:14 +08:00
Restore selected filter on page load
This commit is contained in:
parent
5b604ac251
commit
44992056cf
@ -5,13 +5,4 @@
|
||||
<li id="paused_filter"><a href="#" onclick="setFilter('paused');"><img src="images/skin/paused.png"/>_(Paused)</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>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Remember this via Cookie
|
||||
var filter = Cookie.read('selected_filter');
|
||||
if(!$defined(last_filter)) {
|
||||
filter = 'all';
|
||||
}
|
||||
$(filter+'_filter').addClass('selectedFilter');
|
||||
</script>
|
||||
</ul>
|
@ -39,6 +39,8 @@ var stateToImg = function (state) {
|
||||
return 'images/skin/' + state + '.png';
|
||||
};
|
||||
|
||||
filter = getLocalStorageItem('selected_filter', 'all');
|
||||
|
||||
var loadTorrentsInfoTimer;
|
||||
var loadTorrentsInfo = function () {
|
||||
var queueing_enabled = false;
|
||||
@ -172,6 +174,23 @@ window.addEvent('load', function () {
|
||||
resizeLimit : [100, 300]
|
||||
});
|
||||
MochaUI.Desktop.setDesktopSize();
|
||||
|
||||
setFilter = function (f) {
|
||||
// Visually Select the right filter
|
||||
$("all_filter").removeClass("selectedFilter");
|
||||
$("downloading_filter").removeClass("selectedFilter");
|
||||
$("completed_filter").removeClass("selectedFilter");
|
||||
$("paused_filter").removeClass("selectedFilter");
|
||||
$("active_filter").removeClass("selectedFilter");
|
||||
$("inactive_filter").removeClass("selectedFilter");
|
||||
$(f + "_filter").addClass("selectedFilter");
|
||||
filter = f;
|
||||
localStorage.setItem('selected_filter', f);
|
||||
// Reload torrents
|
||||
if (typeof myTable.table != 'undefined')
|
||||
updateTransferList();
|
||||
}
|
||||
|
||||
new MochaUI.Panel({
|
||||
id : 'Filters',
|
||||
title : 'Panel',
|
||||
@ -184,6 +203,9 @@ window.addEvent('load', function () {
|
||||
},
|
||||
loadMethod : 'xhr',
|
||||
contentURL : 'filters.html',
|
||||
onContentLoaded : function () {
|
||||
setFilter(filter);
|
||||
},
|
||||
column : 'filtersColumn',
|
||||
height : 300
|
||||
});
|
||||
@ -290,22 +312,6 @@ window.addEvent('load', function () {
|
||||
column : 'mainColumn',
|
||||
height : prop_h
|
||||
});
|
||||
|
||||
setFilter = function (f) {
|
||||
// Visually Select the right filter
|
||||
$("all_filter").removeClass("selectedFilter");
|
||||
$("downloading_filter").removeClass("selectedFilter");
|
||||
$("completed_filter").removeClass("selectedFilter");
|
||||
$("paused_filter").removeClass("selectedFilter");
|
||||
$("active_filter").removeClass("selectedFilter");
|
||||
$("inactive_filter").removeClass("selectedFilter");
|
||||
$(f + "_filter").addClass("selectedFilter");
|
||||
filter = f;
|
||||
localStorage.setItem('selected_filter', f);
|
||||
// Reload torrents
|
||||
updateTransferList();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function closeWindows() {
|
||||
|
Loading…
Reference in New Issue
Block a user