Skip to content

Commit 3181286

Browse files
committed
fix: #94
1 parent 3128a7e commit 3181286

4 files changed

Lines changed: 78 additions & 87 deletions

File tree

options/general/userpannel/userpannel.css

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,3 @@
1-
/* Loading Screen */
2-
#loading-div {
3-
z-index: 9999;
4-
position: fixed;
5-
top: 0;
6-
left: 0;
7-
display: flex;
8-
flex-direction: column;
9-
justify-content: center;
10-
align-items: center;
11-
width: 100%;
12-
height: 100%;
13-
background-color: rgb(var(--background));
14-
}
15-
16-
.radial-loader {
17-
width: 54px;
18-
height: 54px;
19-
border: 8px solid rgba(var(--color-2));
20-
border-top: 8px solid rgb(var(--accent-1));
21-
border-radius: 50%;
22-
animation: spin .6s linear infinite;
23-
}
24-
25-
.loading-text {
26-
opacity: .7;
27-
margin-top: 20px;
28-
font-size: 24px;
29-
font-weight: 600;
30-
color: #fff;
31-
}
32-
33-
@keyframes spin {
34-
0% {
35-
transform: rotate(0deg);
36-
}
37-
100% {
38-
transform: rotate(360deg);
39-
}
40-
}
41-
42-
43-
441
/*
452
! Userpannel
463
*/

options/general/userpannel/userpannel.js

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,6 @@ const waitForElement = (selector, parent = document) => new Promise((resolve) =>
2222

2323

2424

25-
// Create Loading Screen
26-
const createLoadingDiv = () => {
27-
const loadingDiv = document.createElement('div');
28-
loadingDiv.id = 'loading-div';
29-
30-
// Text
31-
const textDiv = document.createElement('div');
32-
textDiv.className = 'loading-text';
33-
textDiv.innerText = 'Loading Steam interface';
34-
35-
// Radial Loader
36-
const loadingIndicator = document.createElement('div');
37-
loadingIndicator.className = 'radial-loader';
38-
39-
loadingDiv.appendChild(loadingIndicator);
40-
loadingDiv.appendChild(textDiv);
41-
42-
// Apply to body
43-
document.body.appendChild(loadingDiv);
44-
45-
// Timer
46-
setTimeout(() => {
47-
document.body.removeChild(loadingDiv);
48-
}, 3000);
49-
};
50-
51-
// Patch to body
52-
waitForElement('.Rp8QOGJ2DypeDniMnRBhr').then(() => {
53-
if (!document.getElementById('loading-div')) {
54-
createLoadingDiv();
55-
}
56-
});
57-
58-
59-
6025
// Move Elements
6126
(async () => {
6227
var gameListSidebar = await waitForElement('._3x1HklzyDs4TEjACrRO2tB');

src/css/libraryroot.custom.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,41 @@
88
@import url("./steam/achievementsModal.css");
99

1010

11+
12+
#st-loading-div {
13+
z-index: 9999;
14+
position: fixed;
15+
top: 0;
16+
left: 0;
17+
display: flex;
18+
flex-direction: column;
19+
justify-content: center;
20+
align-items: center;
21+
width: 100%;
22+
height: 100%;
23+
background-color: rgb(var(--background));
24+
}
25+
26+
.st-radial-loader {
27+
width: 54px;
28+
height: 54px;
29+
border: 8px solid rgba(var(--color-2));
30+
border-top: 8px solid rgb(var(--accent-1));
31+
border-radius: 50%;
32+
animation: st-spin .6s linear infinite;
33+
}
34+
35+
@keyframes st-spin {
36+
0% {
37+
transform: rotate(0deg);
38+
}
39+
100% {
40+
transform: rotate(360deg);
41+
}
42+
}
43+
44+
45+
1146
/* Base */
1247
._1ENHEsrSLcTRtPQFl1F-wL {
1348
border: none;

src/js/libraryroot.custom.js

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,59 @@
1-
const waitForElement = (selector, parent = document) => {
2-
return new Promise((resolve) => {
1+
const waitForElement = (selector, parent = document) => new Promise((resolve) => {
32
const el = parent.querySelector(selector);
43
if (el) {
5-
resolve(el);
4+
resolve(el);
65
}
76

87
const observer = new MutationObserver(() => {
9-
const el = parent.querySelector(selector);
10-
if (el) {
8+
const el = parent.querySelector(selector);
9+
if (!el) {
10+
return;
11+
}
12+
1113
resolve(el);
1214
observer.disconnect();
13-
}
1415
});
1516

1617
observer.observe(document.body, {
17-
subtree: true,
18-
childList: true,
18+
subtree: true,
19+
childList: true,
1920
});
20-
});
21+
});
22+
23+
24+
25+
26+
// Create Loading Screen
27+
const createLoadingDiv = () => {
28+
const loadingDiv = document.createElement('div');
29+
loadingDiv.id = 'st-loading-div';
30+
31+
// Radial Loader
32+
const loadingIndicator = document.createElement('div');
33+
loadingIndicator.className = 'st-radial-loader';
34+
35+
loadingDiv.appendChild(loadingIndicator);
36+
37+
// Apply to body
38+
document.body.appendChild(loadingDiv);
39+
40+
// Timer
41+
setTimeout(() => {
42+
document.body.removeChild(loadingDiv);
43+
}, 2500);
2144
};
2245

46+
// Patch to body
47+
waitForElement('.Rp8QOGJ2DypeDniMnRBhr').then(() => {
48+
if (!document.getElementById('st-loading-div')) {
49+
createLoadingDiv();
50+
}
51+
});
52+
53+
54+
55+
56+
// Store Sidebar Width half fix
2357
async function syncWidthIfTargetHidden() {
2458
const sourceClass = '._9sPoVBFyE_vE87mnZJ5aB';
2559
const targetClass = '.RGNMWtyj73_-WdhflrmuY';

0 commit comments

Comments
 (0)