fagun18 commited on
Commit
337118a
·
verified ·
1 Parent(s): b0bbd62

Fix loading screen to auto-hide after 2 seconds

Browse files
Files changed (1) hide show
  1. src/webui/interface.py +29 -17
src/webui/interface.py CHANGED
@@ -37,23 +37,24 @@ def create_ui(theme_name="Hacker"):
37
  css = hacker_css + """
38
  /* Custom Page Loading Screen */
39
  #loading-screen {
40
- position: fixed;
41
- top: 0;
42
- left: 0;
43
- width: 100%;
44
- height: 100%;
45
- background: linear-gradient(135deg, #0a0e27 0%, #1a0e3a 100%);
46
- display: flex;
47
- flex-direction: column;
48
- justify-content: center;
49
- align-items: center;
50
- z-index: 9999;
51
- transition: opacity 0.5s ease-out;
 
52
  }
53
 
54
  #loading-screen.hidden {
55
- opacity: 0;
56
- pointer-events: none;
57
  }
58
 
59
  .ladybug-loader {
@@ -237,16 +238,27 @@ def create_ui(theme_name="Hacker"):
237
  }
238
 
239
  // Hide loading screen after page loads
240
- window.addEventListener('load', function() {
 
 
 
 
 
 
 
 
 
 
 
241
  setTimeout(function() {
242
  const loadingScreen = document.getElementById('loading-screen');
243
  if (loadingScreen) {
244
  loadingScreen.classList.add('hidden');
245
  setTimeout(function() {
246
- loadingScreen.remove();
247
  }, 500);
248
  }
249
- }, 1000);
250
  });
251
  }
252
  """
 
37
  css = hacker_css + """
38
  /* Custom Page Loading Screen */
39
  #loading-screen {
40
+ position: fixed !important;
41
+ top: 0 !important;
42
+ left: 0 !important;
43
+ width: 100vw !important;
44
+ height: 100vh !important;
45
+ background: linear-gradient(135deg, #0a0e27 0%, #1a0e3a 100%) !important;
46
+ display: flex !important;
47
+ flex-direction: column !important;
48
+ justify-content: center !important;
49
+ align-items: center !important;
50
+ z-index: 99999 !important;
51
+ opacity: 1 !important;
52
+ transition: opacity 0.5s ease-out !important;
53
  }
54
 
55
  #loading-screen.hidden {
56
+ opacity: 0 !important;
57
+ pointer-events: none !important;
58
  }
59
 
60
  .ladybug-loader {
 
238
  }
239
 
240
  // Hide loading screen after page loads
241
+ setTimeout(function() {
242
+ const loadingScreen = document.getElementById('loading-screen');
243
+ if (loadingScreen) {
244
+ loadingScreen.classList.add('hidden');
245
+ setTimeout(function() {
246
+ loadingScreen.style.display = 'none';
247
+ }, 500);
248
+ }
249
+ }, 2000);
250
+
251
+ // Also hide on any interaction
252
+ document.addEventListener('DOMContentLoaded', function() {
253
  setTimeout(function() {
254
  const loadingScreen = document.getElementById('loading-screen');
255
  if (loadingScreen) {
256
  loadingScreen.classList.add('hidden');
257
  setTimeout(function() {
258
+ loadingScreen.style.display = 'none';
259
  }, 500);
260
  }
261
+ }, 2000);
262
  });
263
  }
264
  """