Skip to content

Commit

Permalink
feat(overlay): remove "loading"
Browse files Browse the repository at this point in the history
  • Loading branch information
haxgun committed Nov 3, 2023
1 parent e6bc8cb commit 64f733a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
1 change: 0 additions & 1 deletion overlay/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<link rel="icon" type="image/png" href="/img/favicon.png" />
</head>
<body>
<div style="width: 450px;height: 150px;display: flex;color: white;font-size: 24px;font-weight: 700;justify-content: center;align-items: center;" id="loading">Loading</div>
<div id="overlay"></div>
<script type="module" src="../src/js/overlay.js"></script>
</body>
Expand Down
23 changes: 23 additions & 0 deletions src/js/components/overlay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export const overlayHTML = `
<div id="elements">
<div id="rankBlock">
<img alt="rank" src="#" id="imgRank" height="80" width="80" />
</div>
<div id="playerInfo">
<h2 style="text-transform: uppercase" id="mainText">
Rating
</h2>
<h1 style="text-transform: uppercase" id="playerRank"></h1>
<div id="wlstat">
<h2 id="WLvalue">Win: <span id="winValue"></span> Lose: <span id="loseValue"></span> <span id="wlProccent"></span></h2>
</div>
<div id="progressrank"></div>
<div class="lastmatchpts">
<span id="lastmatchpts">Last Match:</span>
<span id="lastmatchptsvalue"></span>
<img src="#" id="imgPTS" height="16" width="16"/>
</div>
</div>
</div>
`

31 changes: 3 additions & 28 deletions src/js/overlay.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '../scss/overlay.scss'
import { overlayHTML } from "./components/overlay.js"
import { setIntervalAsync } from 'set-interval-async';

// Urls and Alpine Data
Expand Down Expand Up @@ -31,33 +32,9 @@ const { NICKNAME, TAG} = {
let lastMatchId = '';
let win = 0;
let lose = 0;

const loading = document.querySelector('#loading');
const overlay = document.querySelector('#overlay');

overlay.innerHTML = `
<div id="elements">
<div id="rankBlock">
<img alt="rank" src="#" id="imgRank" height="80" width="80" />
</div>
<div id="playerInfo">
<h2 style="text-transform: uppercase" id="mainText">
Rating
</h2>
<h1 style="text-transform: uppercase" id="playerRank"></h1>
<div id="wlstat">
<h2 id="WLvalue">Win: <span id="winValue"></span> Lose: <span id="loseValue"></span> <span id="wlProccent"></span></h2>
</div>
<div id="progressrank"></div>
<div class="lastmatchpts">
<span id="lastmatchpts">Last Match:</span>
<span id="lastmatchptsvalue"></span>
<img src="#" id="imgPTS" height="16" width="16"/>
</div>
</div>
</div>
`
overlay.style.display = "none";
overlay.innerHTML = overlayHTML

// Elements
const imgRank = document.getElementById('imgRank');
Expand All @@ -82,8 +59,6 @@ async function main(nickname, tag) {

await decorateCard()
await checkData(region, puuid)
loading.remove()
overlay.style.display = 'block';
setIntervalAsync(checkData, 30000, region, puuid);
}

Expand Down Expand Up @@ -211,7 +186,7 @@ async function checkData(region, puuid) {
await updatePlayerCard(region, puuid);
}
} catch (error) {
// pass
console.log(error);
}
await winlose(region, puuid)
}
Expand Down

0 comments on commit 64f733a

Please sign in to comment.