mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Abstract isolated DOM code out of init functions
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user