Skip to content

Commit

Permalink
Fix loading icon not working on 1 loads
Browse files Browse the repository at this point in the history
  • Loading branch information
LegItMate committed Sep 23, 2022
1 parent 5b8ebde commit a47a8a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/components/launchers/find-games.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const processes = new Map();
let loads = 0;

async function getInstalledGames(launchers = ['CustomGames', 'EpicGames.js', 'Lutris.js', 'Minecraft.js', 'RiotGames.js', 'RockstarGames.js', 'Steam.js', 'Uplay.js']) {
if (loads === 1) {
document.getElementById("loadingbtn").style.opacity = '1';
}
document.getElementById("loadingbtn").style.opacity = '1';
if (loads >= 1) {
launchers = launchers.filter(x => x !== 'XboxGames.js');
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/modules/banners.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function getBanners(games) {
if (alreadyProcessed === true) {
document.getElementById('game-loading-overlay').style.opacity = '0';
document.getElementById('game-loading-overlay').style.visibility = 'hidden';
return console.log('%c[BANNER] ' + '%cBanners are already loaded. Skipping.', "color:blue", "color:white");
return console.log('%c[BANNER] ' + 'Banners are already loaded. Skipping.', "color:blue");
}

const arr = [];
Expand Down Expand Up @@ -98,15 +98,15 @@ async function cacheBanners(data, res) {
if (data?.length === 0) {
document.getElementById('game-loading-overlay').style.opacity = '0';
document.getElementById('game-loading-overlay').style.visibility = 'hidden';
return console.log('%c[BANNER] ' + '%cNo games to process', "color:blue", "color:white");
return console.log('%c[BANNER] ' + 'No games to process', "color:blue");
}

let fetchProcessed = 0;

if (res.length === 0) {
document.getElementById('game-loading-overlay').style.opacity = '0';
document.getElementById('game-loading-overlay').style.visibility = 'hidden';
return console.log('%c[BANNER] ' + '%cNo banners to load.', "color:blue", "color:white");
return console.log('%c[BANNER] ' + 'No banners to load.', "color:blue");
}

res.filter(async (x) => (await x)?.startsWith('http')).forEach(async (x, i) => {
Expand All @@ -126,7 +126,7 @@ async function cacheBanners(data, res) {
if (fetchProcessed === data.length) {
document.getElementById('game-loading-overlay').style.opacity = '0';
document.getElementById('game-loading-overlay').style.visibility = 'hidden';
return console.log('%c[BANNER] ' + '%cJust finished processing banners.', "color:blue", "color:white");
return console.log('%c[BANNER] ' + 'Just finished processing banners.', "color:blue");
}
});
}
Expand Down

0 comments on commit a47a8a9

Please sign in to comment.