Update JS for API changes moving to iron-list

This commit is contained in:
Oliver Hamlet
2016-03-05 11:49:26 +00:00
parent c88d5e18b7
commit b2244e1447
3 changed files with 10 additions and 13 deletions
+5 -7
View File
@@ -40,8 +40,8 @@ function onChangeGame(evt) {
loot.game = new loot.Game(gameInfo, loot.l10n);
/* Reset virtual list positions. */
document.getElementById('cardsNav').scrollToItem(0);
document.getElementById('main').lastElementChild.scrollToItem(0);
document.getElementById('cardsNav').scrollToIndex(0);
document.getElementById('main').lastElementChild.scrollToIndex(0);
/* Now update virtual lists. */
filterPluginData(loot.game.plugins, loot.filters);
@@ -70,8 +70,6 @@ function updateMasterlistNoProgress() {
existingPlugin.tags = resultPlugin.tags;
}
});
/* Hack to stop cards overlapping. */
document.getElementById('main').lastElementChild.updateSize();
loot.Dialog.showNotification(loot.l10n.translate('Masterlist updated to revision %s.', loot.game.masterlist.revision));
} else {
@@ -356,7 +354,7 @@ function onSwitchSidebarTab(evt) {
}
function onSidebarClick(evt) {
if (evt.target.hasAttribute('data-index')) {
document.getElementById('main').lastElementChild.scrollToItem(evt.target.getAttribute('data-index'));
document.getElementById('main').lastElementChild.scrollToIndex(evt.target.getAttribute('data-index'));
if (evt.type === 'dblclick') {
const card = document.getElementById(evt.target.getAttribute('data-id'));
@@ -439,7 +437,7 @@ function onEditorOpen(evt) {
document.getElementById('sortButton').setAttribute('disabled', '');
}
document.body.setAttribute('data-editors', numEditors);
document.getElementById('cardsNav').updateSize();
document.getElementById('cardsNav').notifyResize();
return loot.query('editorOpened').catch(handlePromiseError);
}
@@ -500,7 +498,7 @@ function onEditorClose(evt) {
} else {
document.body.setAttribute('data-editors', numEditors);
}
document.getElementById('cardsNav').updateSize();
document.getElementById('cardsNav').notifyResize();
}).catch(handlePromiseError);
}
function undoConflictsFilter() {
+3 -4
View File
@@ -44,8 +44,8 @@ function filterPluginData(plugins, filters) {
filters.conflictingPluginNames = conflictingPluginNames;
return plugins.filter(filters.pluginFilter, filters);
}).then((filteredPlugins) => {
document.getElementById('cardsNav').data = filteredPlugins;
document.getElementById('pluginCardList').data = filteredPlugins;
document.getElementById('cardsNav').items = filteredPlugins;
document.getElementById('pluginCardList').items = filteredPlugins;
const pluginCards = document.getElementById('pluginCardList').children;
for (let i = 0; i < pluginCards.length; ++i) {
@@ -53,8 +53,7 @@ function filterPluginData(plugins, filters) {
pluginCards[i].updateContent();
}
}
document.getElementById('cardsNav').updateSize();
document.getElementById('pluginCardList').updateSize();
document.getElementById('cardsNav').notifyResize();
/* Now perform search again. If there is no current search, this won't
do anything. */
+2 -2
View File
@@ -222,8 +222,8 @@
return query('getGameData').then((result) => {
const game = JSON.parse(result, Plugin.fromJson);
appData.game = new Game(game, appData.l10n);
document.getElementById('cardsNav').data = appData.game.plugins;
document.getElementById('main').lastElementChild.data = appData.game.plugins;
document.getElementById('cardsNav').items = appData.game.plugins;
document.getElementById('main').lastElementChild.items = appData.game.plugins;
applyEnabledFilters(appData.filters, appData.settings, appData.game.plugins);
Dialog.closeProgress();
});