From 5e7ef9a5ef13e0d263a3cd4a2c1b9b7e6f7bfde5 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 27 Dec 2015 12:37:57 +0000 Subject: [PATCH] Rename setFilteredUIData() to filterPluginData() --- src/gui/html/js/events.js | 12 ++++++------ src/gui/html/js/helpers.js | 16 +++++++++------- src/gui/html/js/init.js | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/gui/html/js/events.js b/src/gui/html/js/events.js index 4b4678e9..eafbb9b5 100644 --- a/src/gui/html/js/events.js +++ b/src/gui/html/js/events.js @@ -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); } diff --git a/src/gui/html/js/helpers.js b/src/gui/html/js/helpers.js index d84ce2af..d57c08eb 100644 --- a/src/gui/html/js/helpers.js +++ b/src/gui/html/js/helpers.js @@ -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; }); diff --git a/src/gui/html/js/init.js b/src/gui/html/js/init.js index 858663cf..74b83808 100644 --- a/src/gui/html/js/init.js +++ b/src/gui/html/js/init.js @@ -104,7 +104,7 @@ function applyEnabledFilters() { || loot.filters.hideNotes || loot.filters.hideDoNotCleanMessages || loot.filters.hideAllPluginMessages) { - setFilteredUIData(); + filterPluginData(plugins, filters); } if (loot.filters.hideVersionNumbers) {