File tree Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,13 @@ async function loadMatches() {
267267 }
268268 }
269269}
270+
271+ function hideIframeLoader ( iframe ) {
272+ const wrapper = iframe . parentElement ;
273+ wrapper . querySelector ( '.iframe-loader' ) . style . display = 'none' ;
274+ iframe . style . visibility = 'visible' ;
275+ }
276+
270277/*
271278// Reload matches every 30 seconds
272279setInterval(() => {
Original file line number Diff line number Diff line change @@ -25,7 +25,10 @@ <h1>Welcome to the Year 8 Chess Tournament</h1>
2525 < div id ="game-panel " style ="display:none; text-align: center; ">
2626 < h2 > Your Current Game</ h2 >
2727 < a id ="game-link " href ="# " target ="_blank "> Join Game</ a > < br > < br >
28- < iframe id ="userGame " src ="" allowfullscreen > </ iframe >
28+ < div class ="iframe-wrapper ">
29+ < div class ="iframe-loader "> </ div >
30+ < iframe id ="userGame " src ="" width ="240 " height ="240 " onload ="hideIframeLoader(this) "> </ iframe >
31+ </ div >
2932 < br >
3033 < button onclick ="reportTroll() "> Report Opponent</ button >
3134 </ div >
Original file line number Diff line number Diff line change @@ -90,6 +90,38 @@ iframe#userGame {
9090 margin : 1rem auto;
9191 box-shadow : 0 2px 8px rgba (0 , 0 , 0 , 0.1 );
9292 }
93+
94+ .iframe-wrapper {
95+ position : relative;
96+ width : 240px ;
97+ height : 240px ;
98+ }
99+
100+ .iframe-loader {
101+ position : absolute;
102+ top : 50% ;
103+ left : 50% ;
104+ width : 40px ;
105+ height : 40px ;
106+ margin : -20px 0 0 -20px ;
107+ border : 4px solid # ccc ;
108+ border-top : 4px solid # 4CAF50 ;
109+ border-radius : 50% ;
110+ animation : spin 1s linear infinite;
111+ z-index : 2 ;
112+ }
113+
114+ .iframe-wrapper iframe {
115+ position : relative;
116+ z-index : 1 ;
117+ visibility : hidden;
118+ }
119+
120+ @keyframes spin {
121+ to {
122+ transform : rotate (360deg );
123+ }
124+ }
93125
94126# leaderboard {
95127 margin : 2rem auto;
You can’t perform that action at this time.
0 commit comments