Aichatbot12321 commited on
Commit
c5e5c8e
·
verified ·
1 Parent(s): 69572b9

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +254 -319
index.html CHANGED
@@ -1,99 +1,55 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>AI Pro Suite - Dashboard</title>
7
-
8
- <link rel="manifest" href="/manifest.json">
9
- <meta name="theme-color" content="#0f172a">
10
- <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
11
-
12
- <link rel="stylesheet" href="style.css">
13
-
14
- <style>
15
- /* Featured Hero Card for Lens Studio */
16
- .featured-hero {
17
- background: linear-gradient(135deg, #007aff, #a855f7);
18
- border-radius: 20px;
19
- padding: 24px;
20
- margin-bottom: 25px;
21
- display: flex;
22
- align-items: center;
23
- gap: 20px;
24
- cursor: pointer;
25
- box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
26
- transition: transform 0.3s ease, box-shadow 0.3s ease;
27
- color: white;
28
- position: relative;
29
- overflow: hidden;
30
- }
31
- .featured-hero:hover {
32
- transform: translateY(-5px);
33
- box-shadow: 0 15px 35px rgba(168, 85, 247, 0.4);
34
- }
35
- .featured-hero::after {
36
- content: '';
37
- position: absolute;
38
- top: -50%; right: -20%;
39
- width: 150px; height: 150px;
40
- background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
41
- border-radius: 50%;
42
- }
43
- .hero-icon {
44
- font-size: 42px;
45
- background: rgba(255, 255, 255, 0.2);
46
- width: 70px; height: 70px;
47
- display: flex;
48
- justify-content: center;
49
- align-items: center;
50
- border-radius: 18px;
51
- backdrop-filter: blur(10px);
52
- flex-shrink: 0;
53
- }
54
- .hero-text h2 {
55
- margin: 0 0 4px 0;
56
- font-size: 22px;
57
- font-weight: 700;
58
- letter-spacing: 0.5px;
59
- }
60
- .hero-text p {
61
- margin: 0;
62
- font-size: 14px;
63
- opacity: 0.9;
64
- font-weight: 400;
65
- }
66
- .pin-badge {
67
- position: absolute;
68
- top: 12px; right: 15px;
69
- background: rgba(255,255,255,0.25);
70
- padding: 4px 10px;
71
- border-radius: 12px;
72
- font-size: 11px;
73
- font-weight: 700;
74
- text-transform: uppercase;
75
- backdrop-filter: blur(5px);
76
- }
77
- </style>
78
- </head>
79
- <body>
80
- <div id="appLoader">
81
- <div class="loader-logo">AI Pro Suite</div>
82
- <div class="loader-bar-container">
83
- <div class="loader-bar" id="loaderBar"></div>
84
- </div>
85
- <div class="loader-text" id="loaderText">Initializing Engine...</div>
86
- </div>
87
- <div class="overlay" id="overlay"></div>
88
-
89
- <div class="topbar">
90
- <div class="menuBtn" onclick="toggleSidebar()">☰</div>
91
- <div class="appTitle">AI Pro Suite</div>
92
- </div>
93
-
94
  <div class="sidebar" id="sidebar">
95
  <button class="sidebar-close-btn" onclick="toggleSidebar()">✖ Close Menu</button>
96
- <button onclick="window.location.href='index.html'" style="border-left: 4px solid var(--primary); color: var(--primary); background: var(--border-light);">🏠 Dashboard</button>
97
  <button onclick="window.location.href='lens.html'">✨ Lens Studio</button>
98
  <button onclick="window.location.href='books.html'">📚 Book Deep Study</button>
99
  <button onclick="window.location.href='maths.html'">🧮 Math Solver</button>
@@ -112,229 +68,208 @@
112
  <button onclick="window.location.href='history.html'">🕒 History & Downloads</button>
113
  </div>
114
 
115
- <div class="page active" id="homePage" style="top: 70px;">
116
- <div style="text-align: center; margin-bottom: 30px; margin-top: 20px;">
117
- <h1 style="font-size: 28px; background: linear-gradient(90deg, #3b82f6, #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">Welcome to AI Pro Suite</h1>
118
- <p style="color: var(--muted); margin-top: 10px;">Select a tool below to get started</p>
119
- </div>
120
-
121
- <div class="card" style="margin-bottom: 25px; border-top: 3px solid #3b82f6;">
122
- <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
123
- <div>
124
- <div class="cardTitle" style="margin: 0;">📊 Live API Usage</div>
125
- <div id="apiResetTimer" style="font-size: 13px; color: #f59e0b; font-weight: 600; margin-top: 4px; letter-spacing: 0.5px;">
126
- ⏳ Quota Reset: Calculating...
127
- </div>
128
- </div>
129
- <button class="actionBtnSmall blue" onclick="fetchApiUsage()" title="Refresh Stats">🔄</button>
130
- </div>
131
-
132
- <div id="apiUsageContainer" style="display: flex; flex-wrap: wrap; gap: 10px;">
133
- <div style="color: var(--muted); font-size: 14px;">Loading server stats...</div>
134
- </div>
135
- </div>
136
-
137
- <div class="featured-hero" onclick="window.location.href='lens.html'">
138
- <div class="pin-badge">📌 Top Tool</div>
139
- <div class="hero-icon">✨</div>
140
- <div class="hero-text">
141
- <h2>Lens Studio</h2>
142
- <p>Advanced AI Vision, OCR Text Selection & Translation.</p>
143
- </div>
144
- </div>
145
-
146
- <div class="dashboard-grid">
147
- <div class="dash-card" onclick="window.location.href='books.html'">
148
- <div class="dash-icon">📚</div>
149
- <div class="dash-title">Book Deep Study</div>
150
- </div>
151
- <div class="dash-card" onclick="window.location.href='search.html'">
152
- <div class="dash-icon">🔎</div>
153
- <div class="dash-title">Deep Search</div>
154
- </div>
155
-
156
- <div class="dash-card" onclick="window.location.href='board.html'">
157
- <div class="dash-icon">📋</div>
158
- <div class="dash-title">Whiteboard</div>
159
- </div>
160
- <div class="dash-card" onclick="window.location.href='runhtml.html'">
161
- <div class="dash-icon">🌐</div>
162
- <div class="dash-title">Write HTML</div>
163
- </div>
164
- <div class="dash-card" onclick="window.location.href='youtube.html'">
165
- <div class="dash-icon">▶️</div>
166
- <div class="dash-title">YouTube Search</div>
167
- </div>
168
- <div class="dash-card" onclick="window.location.href='quiz.html'">
169
- <div class="dash-icon">📝</div>
170
- <div class="dash-title">Take a Quiz!</div>
171
- </div>
172
- <div class="dash-card" onclick="window.location.href='book_quiz.html'">
173
- <div class="dash-icon">📝</div>
174
- <div class="dash-title">Take a Book Quiz!</div>
175
- </div>
176
- <div class="dash-card" onclick="window.location.href='tables.html'">
177
- <div class="dash-icon">🔢</div>
178
- <div class="dash-title">Maths Table</div>
179
- </div>
180
- <div class="dash-card" onclick="window.location.href='translator.html'">
181
- <div class="dash-icon">🎙️</div>
182
- <div class="dash-title">Text & Voice</div>
183
- </div>
184
- <div class="dash-card" onclick="window.location.href='image.html'">
185
- <div class="dash-icon">🖼️</div>
186
- <div class="dash-title">Image Translate</div>
187
- </div>
188
- <div class="dash-card" onclick="window.location.href='create.html'">
189
- <div class="dash-icon">🎨</div>
190
- <div class="dash-title">Image Creator</div>
191
- </div>
192
- <div class="dash-card" onclick="window.location.href='qa.html'">
193
- <div class="dash-icon">📚</div>
194
- <div class="dash-title">Document Q&A</div>
195
- </div>
196
- <div class="dash-card" onclick="window.location.href='history.html'">
197
- <div class="dash-icon">🕒</div>
198
- <div class="dash-title">History</div>
199
- </div>
200
- <div class="dash-card" onclick="window.location.href='chess.html'">
201
- <div class="dash-icon">♟️</div>
202
- <div class="dash-title">Chess AI</div>
203
- </div>
204
- </div>
205
- </div>
206
-
207
- <script>
208
- // Simple logic to open and close the side menu
209
- function toggleSidebar() {
210
- const sidebar = document.getElementById("sidebar");
211
- const overlay = document.getElementById("overlay");
212
- const active = !sidebar.classList.contains("active");
213
- sidebar.classList.toggle("active", active);
214
- overlay.classList.toggle("active", active);
215
- document.body.classList.toggle("sidebar-open", active);
216
- }
217
-
218
- document.getElementById("overlay").onclick = () => {
219
- document.getElementById("sidebar").classList.remove("active");
220
- document.getElementById("overlay").classList.remove("active");
221
- document.body.classList.remove("sidebar-open");
222
- };
223
-
224
- // --- 🛑 TIMER LOGIC FOR GOOGLE API RESET (PACIFIC TIME) 🛑 ---
225
- function updateResetTimer() {
226
- const now = new Date();
227
- const laTimeStr = now.toLocaleString("en-US", { timeZone: "America/Los_Angeles" });
228
- const laTime = new Date(laTimeStr);
229
-
230
- const nextMidnight = new Date(laTime);
231
- nextMidnight.setHours(24, 0, 0, 0);
232
-
233
- const diffMs = nextMidnight - laTime;
234
-
235
- const h = Math.floor(diffMs / (1000 * 60 * 60));
236
- const m = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60));
237
- const s = Math.floor((diffMs % (1000 * 60)) / 1000);
238
-
239
- const pad = (num) => num.toString().padStart(2, '0');
240
-
241
- const timerElement = document.getElementById("apiResetTimer");
242
- if (timerElement) {
243
- timerElement.innerText = `⏳ Quota resets in: ${pad(h)}h ${pad(m)}m ${pad(s)}s`;
244
- }
245
- }
246
-
247
- updateResetTimer();
248
- setInterval(updateResetTimer, 1000);
249
- // ----------------------------------------------
250
-
251
- // Fetch and render API usage
252
- async function fetchApiUsage() {
253
- const container = document.getElementById("apiUsageContainer");
254
- if (!container) return;
255
-
256
- container.innerHTML = '<div class="spinner"></div> <span style="font-size:14px; color:var(--muted);">Syncing with server...</span>';
257
-
258
- try {
259
- const res = await fetch('/api/usage');
260
- const data = await res.json();
261
-
262
- if (Object.keys(data).length === 0) {
263
- container.innerHTML = '<div style="color: var(--muted); font-size: 14px; width: 100%; text-align: center; padding: 10px;">No API requests made yet since last server restart.</div>';
264
- return;
265
- }
266
-
267
- container.innerHTML = Object.entries(data).map(([apiName, count]) => `
268
- <div style="background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.05); padding: 15px; border-radius: 16px; flex: 1; min-width: 110px; text-align: center; box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);">
269
- <div style="font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px;">${apiName}</div>
270
- <div style="font-size: 24px; font-weight: 800; color: #60a5fa;">${count} <span style="font-size:10px; color:#64748b; font-weight:500;">reqs</span></div>
271
- </div>
272
- `).join('');
273
-
274
- } catch(e) {
275
- container.innerHTML = '<div style="color: var(--red); font-size: 14px;">⚠️ Failed to connect to server.</div>';
276
- }
277
- }
278
-
279
- document.addEventListener("DOMContentLoaded", fetchApiUsage);
280
- </script>
281
- <script>
282
- document.addEventListener("DOMContentLoaded", () => {
283
- // 1. The exact texts you requested
284
- const loadingTexts = [
285
- "solve math question...",
286
- "search using ai...",
287
- "search youtube...",
288
- "get quiz...",
289
- "solve answers..."
290
- ];
291
-
292
- let textIndex = 0;
293
- const loaderText = document.getElementById("loaderText");
294
- const loaderBar = document.getElementById("loaderBar");
295
- const appLoader = document.getElementById("appLoader");
296
-
297
- // 2. Start the text loop (Changes every 2 seconds)
298
- loaderText.innerText = loadingTexts[0];
299
- const textInterval = setInterval(() => {
300
- textIndex = (textIndex + 1) % loadingTexts.length;
301
- loaderText.innerText = loadingTexts[textIndex];
302
- }, 2000);
303
-
304
- // 3. Fake a smooth progress bar while the browser thinks
305
- let progress = 0;
306
- const progressInterval = setInterval(() => {
307
- progress += Math.random() * 15;
308
- // Cap at 90% so it doesn't finish until the actual window.onload fires
309
- if (progress > 90) progress = 90;
310
- loaderBar.style.width = progress + "%";
311
- }, 250);
312
-
313
- // 4. Wait for ALL styles, scripts, and images to finish loading
314
- window.addEventListener('load', () => {
315
- // Force it to show for at least a minimum of 2.5 seconds so it looks premium
316
- // even if the page loads instantly from browser cache.
317
- const timeElapsed = performance.now();
318
- const minLoadTime = 2500;
319
- const remainingDelay = Math.max(0, minLoadTime - timeElapsed);
320
-
321
- setTimeout(() => {
322
- clearInterval(textInterval);
323
- clearInterval(progressInterval);
324
-
325
- // Snap progress to 100% and say Ready
326
- loaderBar.style.width = "100%";
327
- loaderText.innerText = "system ready.";
328
-
329
- // Wait 0.4s for the user to see 100%, then fade it out smoothly
330
- setTimeout(() => {
331
- appLoader.classList.add("hidden");
332
- }, 400);
333
-
334
- }, remainingDelay);
335
- });
336
- });
337
- </script>
338
- <script src="ui-controls.js" defer></script>
339
- </body>
340
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Pro Suite - Dashboard</title>
7
+
8
+ <meta name="theme-color" content="#0f172a">
9
+ <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
10
+
11
+ <!-- We keep your main style sheet, but inject emergency loader styles below -->
12
+ <link rel="stylesheet" href="style.css">
13
+
14
+ <style>
15
+ /* EMERGENCY INLINE STYLES: Prevents the White Screen of Death instantly */
16
+ body { background-color: #0f172a; color: white; margin: 0; font-family: 'Poppins', sans-serif; }
17
+
18
+ #appLoader { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #0f172a; display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 9999; transition: opacity 0.4s ease; }
19
+ #appLoader.hidden { opacity: 0; pointer-events: none; }
20
+ .loader-logo { font-size: 28px; font-weight: 800; background: linear-gradient(90deg, #3b82f6, #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 15px; }
21
+ .loader-bar-container { width: 220px; height: 6px; background: rgba(255,255,255,0.1); border-radius: 10px; overflow: hidden; margin-bottom: 15px; }
22
+ .loader-bar { height: 100%; background: linear-gradient(90deg, #3b82f6, #a855f7); width: 0%; transition: width 0.2s ease; }
23
+ .loader-text { font-size: 13px; color: #94a3b8; font-weight: 500; letter-spacing: 1px; }
24
+
25
+ /* Featured Hero Card for Lens Studio */
26
+ .featured-hero { background: linear-gradient(135deg, #007aff, #a855f7); border-radius: 20px; padding: 24px; margin-bottom: 25px; display: flex; align-items: center; gap: 20px; cursor: pointer; box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3); transition: transform 0.3s ease, box-shadow 0.3s ease; color: white; position: relative; overflow: hidden; }
27
+ .featured-hero:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(168, 85, 247, 0.4); }
28
+ .featured-hero::after { content: ''; position: absolute; top: -50%; right: -20%; width: 150px; height: 150px; background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%); border-radius: 50%; }
29
+ .hero-icon { font-size: 42px; background: rgba(255, 255, 255, 0.2); width: 70px; height: 70px; display: flex; justify-content: center; align-items: center; border-radius: 18px; backdrop-filter: blur(10px); flex-shrink: 0; }
30
+ .hero-text h2 { margin: 0 0 4px 0; font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
31
+ .hero-text p { margin: 0; font-size: 14px; opacity: 0.9; font-weight: 400; }
32
+ .pin-badge { position: absolute; top: 12px; right: 15px; background: rgba(255,255,255,0.25); padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; backdrop-filter: blur(5px); }
33
+ </style>
34
+ </head>
35
+ <body>
36
+ <div id="appLoader">
37
+ <div class="loader-logo">AI Pro Suite</div>
38
+ <div class="loader-bar-container">
39
+ <div class="loader-bar" id="loaderBar"></div>
40
+ </div>
41
+ <div class="loader-text" id="loaderText">Initializing Engine...</div>
42
+ </div>
43
+ <div class="overlay" id="overlay"></div>
44
+
45
+ <div class="topbar">
46
+ <div class="menuBtn" onclick="toggleSidebar()">☰</div>
47
+ <div class="appTitle">AI Pro Suite</div>
48
+ </div>
49
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  <div class="sidebar" id="sidebar">
51
  <button class="sidebar-close-btn" onclick="toggleSidebar()">✖ Close Menu</button>
52
+ <button onclick="window.location.href='index.html'" style="border-left: 4px solid #3b82f6; color: #3b82f6; background: rgba(255,255,255,0.05);">🏠 Dashboard</button>
53
  <button onclick="window.location.href='lens.html'">✨ Lens Studio</button>
54
  <button onclick="window.location.href='books.html'">📚 Book Deep Study</button>
55
  <button onclick="window.location.href='maths.html'">🧮 Math Solver</button>
 
68
  <button onclick="window.location.href='history.html'">🕒 History & Downloads</button>
69
  </div>
70
 
71
+ <div class="page active" id="homePage" style="top: 70px;">
72
+ <div style="text-align: center; margin-bottom: 30px; margin-top: 20px;">
73
+ <h1 style="font-size: 28px; background: linear-gradient(90deg, #3b82f6, #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">Welcome to AI Pro Suite</h1>
74
+ <p style="color: #94a3b8; margin-top: 10px;">Select a tool below to get started</p>
75
+ </div>
76
+
77
+ <div class="card" style="margin-bottom: 25px; border-top: 3px solid #3b82f6;">
78
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
79
+ <div>
80
+ <div class="cardTitle" style="margin: 0; font-weight: 700;">📊 Live API Usage</div>
81
+ <div id="apiResetTimer" style="font-size: 13px; color: #f59e0b; font-weight: 600; margin-top: 4px; letter-spacing: 0.5px;">
82
+ ⏳ Quota Reset: Calculating...
83
+ </div>
84
+ </div>
85
+ <button class="actionBtnSmall blue" onclick="fetchApiUsage()" title="Refresh Stats" style="background:#3b82f6; border:none; padding:8px 12px; border-radius:8px; color:white; cursor:pointer;">🔄</button>
86
+ </div>
87
+
88
+ <div id="apiUsageContainer" style="display: flex; flex-wrap: wrap; gap: 10px;">
89
+ <div style="color: #94a3b8; font-size: 14px;">Loading server stats...</div>
90
+ </div>
91
+ </div>
92
+
93
+ <div class="featured-hero" onclick="window.location.href='lens.html'">
94
+ <div class="pin-badge">📌 Top Tool</div>
95
+ <div class="hero-icon">✨</div>
96
+ <div class="hero-text">
97
+ <h2>Lens Studio</h2>
98
+ <p>Advanced AI Vision, OCR Text Selection & Translation.</p>
99
+ </div>
100
+ </div>
101
+
102
+ <div class="dashboard-grid">
103
+ <div class="dash-card" onclick="window.location.href='books.html'">
104
+ <div class="dash-icon">📚</div>
105
+ <div class="dash-title">Book Deep Study</div>
106
+ </div>
107
+ <div class="dash-card" onclick="window.location.href='search.html'">
108
+ <div class="dash-icon">🔎</div>
109
+ <div class="dash-title">Deep Search</div>
110
+ </div>
111
+ <div class="dash-card" onclick="window.location.href='board.html'">
112
+ <div class="dash-icon">📋</div>
113
+ <div class="dash-title">Whiteboard</div>
114
+ </div>
115
+ <div class="dash-card" onclick="window.location.href='runhtml.html'">
116
+ <div class="dash-icon">🌐</div>
117
+ <div class="dash-title">Write HTML</div>
118
+ </div>
119
+ <div class="dash-card" onclick="window.location.href='youtube.html'">
120
+ <div class="dash-icon">▶️</div>
121
+ <div class="dash-title">YouTube Search</div>
122
+ </div>
123
+ <div class="dash-card" onclick="window.location.href='quiz.html'">
124
+ <div class="dash-icon">📝</div>
125
+ <div class="dash-title">Take a Quiz!</div>
126
+ </div>
127
+ <div class="dash-card" onclick="window.location.href='book_quiz.html'">
128
+ <div class="dash-icon">📝</div>
129
+ <div class="dash-title">Take a Book Quiz!</div>
130
+ </div>
131
+ <div class="dash-card" onclick="window.location.href='tables.html'">
132
+ <div class="dash-icon">🔢</div>
133
+ <div class="dash-title">Maths Table</div>
134
+ </div>
135
+ <div class="dash-card" onclick="window.location.href='translator.html'">
136
+ <div class="dash-icon">🎙️</div>
137
+ <div class="dash-title">Text & Voice</div>
138
+ </div>
139
+ <div class="dash-card" onclick="window.location.href='image.html'">
140
+ <div class="dash-icon">🖼️</div>
141
+ <div class="dash-title">Image Translate</div>
142
+ </div>
143
+ <div class="dash-card" onclick="window.location.href='create.html'">
144
+ <div class="dash-icon">🎨</div>
145
+ <div class="dash-title">Image Creator</div>
146
+ </div>
147
+ <div class="dash-card" onclick="window.location.href='qa.html'">
148
+ <div class="dash-icon">📚</div>
149
+ <div class="dash-title">Document Q&A</div>
150
+ </div>
151
+ <div class="dash-card" onclick="window.location.href='history.html'">
152
+ <div class="dash-icon">🕒</div>
153
+ <div class="dash-title">History</div>
154
+ </div>
155
+ <div class="dash-card" onclick="window.location.href='chess.html'">
156
+ <div class="dash-icon">♟️</div>
157
+ <div class="dash-title">Chess AI</div>
158
+ </div>
159
+ </div>
160
+ </div>
161
+
162
+ <script>
163
+ function toggleSidebar() {
164
+ const sidebar = document.getElementById("sidebar");
165
+ const overlay = document.getElementById("overlay");
166
+ const active = !sidebar.classList.contains("active");
167
+ sidebar.classList.toggle("active", active);
168
+ if(overlay) overlay.classList.toggle("active", active);
169
+ document.body.classList.toggle("sidebar-open", active);
170
+ }
171
+
172
+ if(document.getElementById("overlay")) {
173
+ document.getElementById("overlay").onclick = () => {
174
+ document.getElementById("sidebar").classList.remove("active");
175
+ document.getElementById("overlay").classList.remove("active");
176
+ document.body.classList.remove("sidebar-open");
177
+ };
178
+ }
179
+
180
+ // Timer Logic
181
+ function updateResetTimer() {
182
+ const now = new Date();
183
+ const laTimeStr = now.toLocaleString("en-US", { timeZone: "America/Los_Angeles" });
184
+ const laTime = new Date(laTimeStr);
185
+ const nextMidnight = new Date(laTime);
186
+ nextMidnight.setHours(24, 0, 0, 0);
187
+ const diffMs = nextMidnight - laTime;
188
+
189
+ const h = Math.floor(diffMs / (1000 * 60 * 60));
190
+ const m = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60));
191
+ const s = Math.floor((diffMs % (1000 * 60)) / 1000);
192
+ const pad = (num) => num.toString().padStart(2, '0');
193
+
194
+ const timerElement = document.getElementById("apiResetTimer");
195
+ if (timerElement) timerElement.innerText = `⏳ Quota resets in: ${pad(h)}h ${pad(m)}m ${pad(s)}s`;
196
+ }
197
+
198
+ updateResetTimer();
199
+ setInterval(updateResetTimer, 1000);
200
+
201
+ // FETCH API STATS WITH 3-SECOND KILL SWITCH
202
+ async function fetchApiUsage() {
203
+ const container = document.getElementById("apiUsageContainer");
204
+ if (!container) return;
205
+
206
+ container.innerHTML = '<span style="font-size:14px; color:#94a3b8;">Syncing with server...</span>';
207
+
208
+ try {
209
+ // This AbortController stops the browser tab from spinning forever!
210
+ const controller = new AbortController();
211
+ const timeoutId = setTimeout(() => controller.abort(), 3000); // 3 Second hard limit
212
+
213
+ const res = await fetch('/api/usage', { signal: controller.signal });
214
+ clearTimeout(timeoutId);
215
+
216
+ if (!res.ok) throw new Error("Bad network response");
217
+ const data = await res.json();
218
+
219
+ if (Object.keys(data).length === 0) {
220
+ container.innerHTML = '<div style="color: #94a3b8; font-size: 14px; width: 100%; text-align: center;">No API requests made yet.</div>';
221
+ return;
222
+ }
223
+
224
+ container.innerHTML = Object.entries(data).map(([apiName, count]) => `
225
+ <div style="background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.05); padding: 15px; border-radius: 16px; flex: 1; min-width: 110px; text-align: center;">
226
+ <div style="font-size: 11px; color: #94a3b8; font-weight: 700; text-transform: uppercase;">${apiName}</div>
227
+ <div style="font-size: 24px; font-weight: 800; color: #60a5fa;">${count}</div>
228
+ </div>
229
+ `).join('');
230
+
231
+ } catch(e) {
232
+ console.error("API Usage Fetch Error:", e);
233
+ container.innerHTML = '<div style="color: #ef4444; font-size: 14px;">⚠️ Server stats offline (Request timed out).</div>';
234
+ }
235
+ }
236
+
237
+ document.addEventListener("DOMContentLoaded", fetchApiUsage);
238
+ </script>
239
+
240
+ <script>
241
+ // Bulletproof Loader Animation
242
+ document.addEventListener("DOMContentLoaded", () => {
243
+ const loadingTexts = ["solve math question...", "search using ai...", "search youtube...", "get quiz...", "solve answers..."];
244
+ let textIndex = 0;
245
+ const loaderText = document.getElementById("loaderText");
246
+ const loaderBar = document.getElementById("loaderBar");
247
+ const appLoader = document.getElementById("appLoader");
248
+
249
+ loaderText.innerText = loadingTexts[0];
250
+ const textInterval = setInterval(() => {
251
+ textIndex = (textIndex + 1) % loadingTexts.length;
252
+ loaderText.innerText = loadingTexts[textIndex];
253
+ }, 1500);
254
+
255
+ let progress = 0;
256
+ const progressInterval = setInterval(() => {
257
+ progress += Math.random() * 20;
258
+ if (progress > 95) progress = 95;
259
+ loaderBar.style.width = progress + "%";
260
+ }, 200);
261
+
262
+ // FORCED 2.5 SECOND UNLOCK: Prevents the page from being held hostage
263
+ setTimeout(() => {
264
+ clearInterval(textInterval);
265
+ clearInterval(progressInterval);
266
+
267
+ loaderBar.style.width = "100%";
268
+ loaderText.innerText = "system ready.";
269
+
270
+ setTimeout(() => { appLoader.classList.add("hidden"); }, 300);
271
+ }, 2500);
272
+ });
273
+ </script>
274
+ </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  </html>