Skip to content

Commit

Permalink
feat: add "loading" when loading the overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
haxgun committed Oct 31, 2023
1 parent 74abe15 commit f65c082
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions overlay/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<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
8 changes: 7 additions & 1 deletion src/js/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ let lastMatchId = '';
let win = 0;
let lose = 0;

document.querySelector('#overlay').innerHTML = `
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" />
Expand All @@ -54,6 +57,7 @@ document.querySelector('#overlay').innerHTML = `
</div>
</div>
`
overlay.style.display = "none";

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

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

Expand Down
1 change: 1 addition & 0 deletions src/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ input.nickname {
background-repeat: no-repeat;
background-size: cover;
position: relative;
overflow: hidden;
&::after {
content: "";
position: absolute;
Expand Down
1 change: 1 addition & 0 deletions src/scss/overlay.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ body {
box-sizing: border-box;
overflow: hidden;
}

#elements {
display: flex;
flex-direction: row;
Expand Down

0 comments on commit f65c082

Please sign in to comment.