Rename setFilteredUIData() to filterPluginData()

This commit is contained in:
Oliver Hamlet
2016-01-06 18:27:02 +00:00
parent 1f3784c279
commit 5e7ef9a5ef
3 changed files with 16 additions and 14 deletions
+6 -6
View File
@@ -139,7 +139,7 @@ function onChangeGame(evt) {
document.getElementById('main').lastElementChild.scrollToItem(0);
/* Now update virtual lists. */
setFilteredUIData();
filterPluginData(loot.game.plugins, loot.filters);
loot.Dialog.closeProgress();
}).catch(handlePromiseError);
@@ -235,7 +235,7 @@ function onSortPlugins() {
/* Now update the UI for the new order. */
loot.game.plugins = loot.game.loadOrder;
setFilteredUIData();
filterPluginData(loot.game.plugins, loot.filters);
/* Now hide the masterlist update buttons, and display the accept and
cancel sort buttons. */
@@ -274,7 +274,7 @@ function onCancelSort(evt) {
return loot.query('cancelSort').then(() => {
/* Sort UI elements again according to stored old load order. */
loot.game.plugins = loot.game.oldLoadOrder;
setFilteredUIData();
filterPluginData(loot.game.plugins, loot.filters);
delete loot.game.loadOrder;
delete loot.game.oldLoadOrder;
@@ -573,7 +573,7 @@ function onConflictsFilter(evt) {
} else {
document.body.removeAttribute('data-conflicts');
}
setFilteredUIData();
filterPluginData(loot.game.plugins, loot.filters);
}
function onCopyMetadata(evt) {
loot.query('copyMetadata', evt.target.getName()).then(() => {
@@ -713,7 +713,7 @@ function onContentRefresh() {
}
/* Reapply filters. */
setFilteredUIData();
filterPluginData(loot.game.plugins, loot.filters);
loot.Dialog.closeProgress();
}).catch(handlePromiseError);
@@ -732,5 +732,5 @@ function onSidebarFilterToggle(evt) {
loot.filters.contentSearchString = evt.target.value;
}
saveFilterState(evt);
setFilteredUIData();
filterPluginData(loot.game.plugins, loot.filters);
}
+9 -7
View File
@@ -52,10 +52,10 @@ function getConflictingPlugins(pluginName) {
return [pluginName];
}).catch(handlePromiseError);
}
function setFilteredUIData() {
getConflictingPlugins(loot.filters.conflictTargetPluginName).then((conflictingPluginNames) => {
loot.filters.conflictingPluginNames = conflictingPluginNames;
return loot.game.plugins.filter(loot.filters.pluginFilter, loot.filters);
function filterPluginData(plugins, filters) {
getConflictingPlugins(filters.conflictTargetPluginName).then((conflictingPluginNames) => {
filters.conflictingPluginNames = conflictingPluginNames;
return plugins.filter(filters.pluginFilter, filters);
}).then((filteredPlugins) => {
document.getElementById('cardsNav').data = filteredPlugins;
document.getElementById('pluginCardList').data = filteredPlugins;
@@ -66,16 +66,18 @@ function setFilteredUIData() {
element.onMessagesChange();
}
});
document.getElementById('cardsNav').updateSize();
document.getElementById('pluginCardList').updateSize();
/* Now perform search again. If there is no current search, this won't
do anything. */
document.getElementById('searchBar').search();
/* Re-count all hidden plugins and messages. */
document.getElementById('hiddenPluginNo').textContent = loot.game.plugins.length - filteredPlugins.length;
document.getElementById('hiddenPluginNo').textContent = plugins.length - filteredPlugins.length;
let hiddenMessageNo = 0;
loot.game.plugins.forEach((plugin) => {
hiddenMessageNo += plugin.messages.length - plugin.getCardContent(loot.filters).messages.length;
plugins.forEach((plugin) => {
hiddenMessageNo += plugin.messages.length - plugin.getCardContent(filters).messages.length;
});
document.getElementById('hiddenMessageNo').textContent = hiddenMessageNo;
});
+1 -1
View File
@@ -104,7 +104,7 @@ function applyEnabledFilters() {
|| loot.filters.hideNotes
|| loot.filters.hideDoNotCleanMessages
|| loot.filters.hideAllPluginMessages) {
setFilteredUIData();
filterPluginData(plugins, filters);
}
if (loot.filters.hideVersionNumbers) {