Abstract isolated DOM code out of init functions

This commit is contained in:
Oliver Hamlet
2016-06-10 23:05:30 +01:00
parent a2770d257b
commit 73bcb858dc
2 changed files with 14 additions and 4 deletions
+9
View File
@@ -73,6 +73,15 @@
}
}
static openDialog(dialogElementId) {
document.getElementById(dialogElementId).open();
}
static initialiseVirtualLists(plugins) {
document.getElementById('cardsNav').items = plugins;
document.getElementById('pluginCardList').items = plugins;
}
static updateSelectedGame(gameFolder) {
document.getElementById('gameMenu').value = gameFolder;
+5 -4
View File
@@ -147,7 +147,7 @@
function handleInitErrors(error) {
dom.listInitErrors(JSON.parse(error.message));
Dialog.closeProgress();
document.getElementById('settingsButton').click();
dom.openDialog('settingsDialog');
}
function setGameTypes() {
@@ -175,11 +175,12 @@
return query('getGameData').then((result) => {
const game = JSON.parse(result, Plugin.fromJson);
appData.game = new Game(game, appData.l10n);
document.getElementById('cardsNav').items = appData.game.plugins;
document.getElementById('pluginCardList').items = appData.game.plugins;
dom.initialiseVirtualLists(appData.game.plugins);
appData.Filters.fillConflictsFilterList(appData.game.plugins);
appData.filters.load(appData.settings.filters);
appData.filters.apply(appData.game.plugins);
Dialog.closeProgress();
});
}
@@ -224,7 +225,7 @@
.catch(handleInitErrors)
.then(() => {
if (loot.settings.lastVersion !== loot.version) {
document.getElementById('firstRun').open();
dom.openDialog('firstRun');
}
}).catch(handlePromiseError);
};