Filters are now correctly reapplied on game change.

Fixes #229.
This commit is contained in:
WrinklyNinja
2014-08-23 00:12:04 +01:00
parent ecc2166ec6
commit ec604a9b1a
+24 -1
View File
@@ -297,7 +297,25 @@ function changeGame(evt) {
]
});
loot.query(request).then(function(result){
/* First clear the UI of all existing game-specific data. Also
/* For each filter, save its state then deactivate it if it is activated.
All filters apart from the conflicts filter will be re-activated
after the new game has loaded. */
var elements = document.getElementById('filters').getElementsByTagName('input');
var activeFilters = [];
for (var i = 0; i < elements.length; ++i) {
if (elements[i].type == 'checkbox' && elements[i].id != 'showOnlyConflicts'
&& elements[i].checked) {
activeFilters.push(elements[i]);
elements[i].click();
}
}
if (document.getElementById('showOnlyConflicts').checked) {
document.getElementById('showOnlyConflicts').click();
}
document.getElementById('conflictsPlugin').value = '';
/* Clear the UI of all existing game-specific data. Also
clear the card and li variables for each plugin object. */
loot.games[index].plugins.forEach(function(plugin){
plugin.card.parentElement.removeChild(plugin.card);
@@ -315,6 +333,11 @@ function changeGame(evt) {
/* Now update game menu to highlight the newly selected game. */
updateSelectedGame();
/* Reapply previously active filters. */
activeFilters.forEach(function(filter){
filter.click();
});
}).catch(processCefError);
}
function openReadme(evt) {