-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
421 lines (364 loc) · 20.5 KB
/
index.html
File metadata and controls
421 lines (364 loc) · 20.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Context Window - Comparing Generative AI</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
/* Custom Scrollbar */
iframe::-webkit-scrollbar { width: 8px; }
iframe::-webkit-scrollbar-track { background: #1f2937; }
iframe::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 4px; }
.glass-panel {
background: rgba(17, 24, 39, 0.7);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
/* Loader Animation */
.loader-ring { display: inline-block; position: relative; width: 80px; height: 80px; }
.loader-ring div { box-sizing: border-box; display: block; position: absolute; width: 64px; height: 64px; margin: 8px; border: 4px solid #3b82f6; border-radius: 50%; animation: loader-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; border-color: #3b82f6 transparent transparent transparent; }
.loader-ring div:nth-child(1) { animation-delay: -0.45s; }
.loader-ring div:nth-child(2) { animation-delay: -0.3s; }
.loader-ring div:nth-child(3) { animation-delay: -0.15s; }
@keyframes loader-ring { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
/* CARD ANIMATION STYLES */
.ai-card {
transform-origin: center center;
transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
/* The button that appears on hover */
.fullscreen-trigger {
opacity: 0;
transform: translateY(-10px);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-card:hover .fullscreen-trigger {
opacity: 1;
transform: translateY(0);
}
/* When in fullscreen mode */
.is-fullscreen {
z-index: 9999 !important;
border-radius: 0 !important;
border: none !important;
}
/* Hide other elements when one is fullscreen */
body.has-fullscreen-active header {
opacity: 0;
pointer-events: none;
}
/* Responsive Grid Adjustments */
@media (min-width: 1280px) {
.grid-dynamic {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
@media (min-width: 1600px) {
.grid-dynamic {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
</style>
</head>
<body class="bg-gray-900 text-white h-screen w-screen flex flex-col overflow-hidden font-sans selection:bg-blue-500 selection:text-white">
<div id="info-modal" class="fixed inset-0 z-[100] flex items-center justify-center bg-black/80 backdrop-blur-sm opacity-0 pointer-events-none transition-opacity duration-500">
<div id="info-modal-card" class="bg-gray-800 border border-gray-600 rounded-xl p-6 max-w-md w-full mx-4 shadow-2xl transform scale-95 transition-transform duration-500 relative overflow-hidden">
<div class="absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-blue-500 via-purple-500 to-pink-500"></div>
<div class="text-center space-y-4">
<div class="w-12 h-12 bg-gray-700 rounded-full flex items-center justify-center mx-auto text-blue-400">
<i class="fa-solid fa-circle-info text-xl"></i>
</div>
<h3 class="text-xl font-bold text-white tracking-wide">Notice</h3>
<div class="text-gray-300 text-sm leading-relaxed space-y-2">
<p>
I do not own any of the AI models displayed in this interface. They are proprietary technologies of their respective owners.
</p>
<p class="text-gray-400 text-xs border-t border-gray-700 pt-2 mt-2">
Generated: <span class="text-blue-300 font-mono">November 19th</span>
</p>
</div>
<div class="pt-4">
<button onclick="closeModal()" class="w-full bg-blue-600 hover:bg-blue-500 text-white font-semibold py-2 px-4 rounded-lg transition-colors duration-200 shadow-lg shadow-blue-900/20">
Understood
</button>
<p class="mt-4 text-xs text-gray-500 font-mono">Developed by Veer Bajaj</p>
</div>
</div>
</div>
</div>
<!-- Prompt Modal -->
<div id="prompt-modal" class="fixed inset-0 z-[101] flex items-center justify-center bg-black/80 backdrop-blur-sm opacity-0 pointer-events-none transition-opacity duration-500">
<div id="prompt-modal-card" class="bg-gray-800 border border-gray-600 rounded-2xl p-8 max-w-2xl w-full mx-4 shadow-2xl transform scale-95 transition-transform duration-500 relative overflow-hidden">
<div class="absolute top-0 left-0 w-full h-1.5 bg-gradient-to-r from-emerald-500 via-blue-500 to-indigo-500"></div>
<div class="flex justify-between items-center mb-6">
<h3 class="text-2xl font-bold text-white tracking-tight flex items-center gap-3">
<div class="w-10 h-10 rounded-xl bg-emerald-500/10 flex items-center justify-center border border-emerald-500/20">
<i class="fa-solid fa-terminal text-emerald-400 text-lg"></i>
</div>
System Prompt
</h3>
<button onclick="closePromptModal()" class="w-10 h-10 rounded-full hover:bg-gray-700/50 flex items-center justify-center text-gray-400 hover:text-white transition-all">
<i class="fa-solid fa-xmark text-xl"></i>
</button>
</div>
<div class="bg-gray-900/80 rounded-xl p-6 border border-gray-700/50 font-mono text-emerald-400/90 text-sm leading-relaxed whitespace-pre-wrap break-words max-h-[50vh] overflow-y-auto custom-scrollbar shadow-inner">
<span id="modal-prompt-text"></span>
</div>
<div class="mt-8 flex justify-end gap-3">
<button onclick="closePromptModal()" class="bg-gray-700 hover:bg-gray-600 text-white font-semibold py-2.5 px-8 rounded-xl transition-all duration-200">
Dismiss
</button>
<button onclick="copyPrompt()" class="bg-emerald-600 hover:bg-emerald-500 text-white font-semibold py-2.5 px-8 rounded-xl transition-all duration-200 flex items-center gap-2 shadow-lg shadow-emerald-900/20">
<i class="fa-solid fa-copy text-sm"></i>
Copy Prompt
</button>
</div>
</div>
</div>
<header class="glass-panel border-b border-gray-700 flex-none z-50 shadow-xl transition-opacity duration-500 py-3">
<div class="max-w-7xl mx-auto px-6 flex items-center justify-between gap-6">
<div class="flex items-center gap-3 text-gray-300 text-sm font-black uppercase tracking-[0.2em] min-w-fit">
<div class="w-8 h-8 rounded-lg bg-blue-600 flex items-center justify-center shadow-lg shadow-blue-900/40">
<i class="fa-solid fa-wind text-white text-xs"></i>
</div>
<span id="site-title" class="hidden sm:inline">Context Window</span>
</div>
<div class="flex-1 flex justify-center max-w-xl">
<div class="flex items-center w-full gap-2">
<div class="relative flex-1">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-gray-500">
<i class="fa-solid fa-list-check text-xs"></i>
</div>
<select id="benchmark-selector" class="block w-full bg-gray-800/50 hover:bg-gray-800 border border-gray-700 text-white text-sm rounded-xl focus:ring-2 focus:ring-blue-500/50 focus:border-blue-500 p-2.5 pl-9 cursor-pointer outline-none transition-all appearance-none">
<!-- Populated by JS -->
</select>
<div class="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none text-gray-500">
<i class="fa-solid fa-chevron-down text-[10px]"></i>
</div>
</div>
<button onclick="showPrompt()" class="flex items-center gap-2.5 bg-gray-800/50 hover:bg-gray-700 border border-gray-700 hover:border-emerald-500/50 text-gray-300 hover:text-emerald-400 px-5 py-2.5 rounded-xl text-xs font-bold transition-all shadow-sm group">
<i class="fa-solid fa-terminal text-emerald-500 group-hover:animate-pulse"></i>
<span class="hidden md:inline">View Prompt</span>
</button>
</div>
</div>
<div class="flex items-center gap-4 min-w-fit">
<a href="https://github.com/coder11v/contextwindow" target="_blank" class="w-10 h-10 flex items-center justify-center bg-gray-800 hover:bg-gray-700 border border-gray-700 text-gray-400 hover:text-white rounded-xl transition-all shadow-sm" title="Contribute on GitHub">
<i class="fa-brands fa-github text-lg"></i>
</a>
<button onclick="refreshCurrent()" class="w-10 h-10 flex items-center justify-center bg-gray-800 hover:bg-gray-700 border border-gray-700 text-gray-400 hover:text-white rounded-xl transition-all" title="Reload Models">
<i class="fa-solid fa-rotate text-sm"></i>
</button>
</div>
</div>
</header>
<div id="loader-overlay" class="flex-1 flex flex-col items-center justify-center bg-gray-900 z-40 absolute inset-0 top-[60px]">
<div class="loader-ring"><div></div><div></div><div></div><div></div></div>
<h2 class="mt-6 text-blue-400 font-mono tracking-widest text-sm animate-pulse">INITIALIZING CONTEXT WINDOW...</h2>
</div>
<main id="main-grid" class="flex-1 grid grid-cols-1 md:grid-cols-2 grid-dynamic gap-1 p-1 bg-gray-900 hidden opacity-0 transition-opacity duration-500 relative overflow-y-auto">
<!-- AI cards will be injected here -->
</main>
<script>
let configData = [];
let currentBenchmarkId = null;
// --- FETCH CONFIG ---
async function fetchConfig() {
try {
const response = await fetch('config.json');
configData = await response.json();
populateBenchmarkSelector();
if (configData.length > 0) {
loadBenchmark(configData[0].id);
}
} catch (error) {
console.error('Error loading config:', error);
document.getElementById('current-prompt').innerText = "Error loading config.json";
}
}
function populateBenchmarkSelector() {
const selector = document.getElementById('benchmark-selector');
selector.innerHTML = configData.map(bench => `
<option value="${bench.id}">${bench.id.charAt(0).toUpperCase() + bench.id.slice(1)}</option>
`).join('');
selector.onchange = (e) => loadBenchmark(e.target.value);
}
function loadBenchmark(id) {
const benchmark = configData.find(b => b.id === id);
if (!benchmark) return;
currentBenchmarkId = id;
document.getElementById('modal-prompt-text').innerText = benchmark.prompt;
const grid = document.getElementById('main-grid');
grid.innerHTML = '';
benchmark.models.forEach((model, index) => {
const card = document.createElement('div');
card.id = `card-${id}-${model.id}`;
card.className = `ai-card relative group border border-gray-700 bg-white overflow-hidden bg-gray-900 h-[600px] md:h-auto min-h-[400px]`;
// Color mapping for badges
const colors = ['blue', 'teal', 'orange', 'purple', 'green', 'pink', 'yellow'];
const color = colors[index % colors.length];
card.innerHTML = `
<div class="absolute top-3 left-3 right-3 z-20 flex justify-between items-start pointer-events-none">
<div class="flex items-center gap-2 bg-gray-900/90 backdrop-blur-md border border-${color}-500/30 text-white px-3 py-1.5 rounded-full shadow-lg">
<div class="w-2 h-2 rounded-full bg-${color}-400 animate-pulse"></div>
<span class="text-xs font-semibold tracking-wide">${model.name || model.id}</span>
</div>
<button onclick="toggleFullscreen('${card.id}')" class="fullscreen-trigger pointer-events-auto bg-gray-800/80 hover:bg-${color}-600 text-white w-8 h-8 rounded-full flex items-center justify-center border border-gray-600 hover:border-${color}-400 backdrop-blur shadow-lg cursor-pointer">
<i class="fa-solid fa-expand text-xs"></i>
</button>
</div>
<iframe class="w-full h-full bg-gray-900 border-none" src="${model.path}"></iframe>
`;
grid.appendChild(card);
});
}
function refreshCurrent() {
if (currentBenchmarkId) loadBenchmark(currentBenchmarkId);
}
// --- MODAL LOGIC ---
function closeModal() {
const modal = document.getElementById('info-modal');
const modalContent = document.getElementById('info-modal-card');
modal.style.opacity = '0';
modalContent.classList.remove('scale-100');
modalContent.classList.add('scale-95');
setTimeout(() => {
modal.style.display = 'none';
modal.classList.add('pointer-events-none');
}, 500);
}
function showModal() {
const modal = document.getElementById('info-modal');
const modalContent = document.getElementById('info-modal-card');
if (!modal) return;
modal.style.display = 'flex';
modal.classList.remove('pointer-events-none');
requestAnimationFrame(() => {
modal.style.opacity = '1';
modalContent.classList.remove('scale-95');
modalContent.classList.add('scale-100');
});
}
// --- PROMPT MODAL LOGIC ---
function showPrompt() {
const modal = document.getElementById('prompt-modal');
const modalContent = document.getElementById('prompt-modal-card');
modal.style.display = 'flex';
modal.classList.remove('pointer-events-none');
requestAnimationFrame(() => {
modal.style.opacity = '1';
modalContent.classList.remove('scale-95');
modalContent.classList.add('scale-100');
});
}
function closePromptModal() {
const modal = document.getElementById('prompt-modal');
const modalContent = document.getElementById('prompt-modal-card');
modal.style.opacity = '0';
modalContent.classList.remove('scale-100');
modalContent.classList.add('scale-95');
setTimeout(() => {
modal.style.display = 'none';
modal.classList.add('pointer-events-none');
}, 500);
}
function copyPrompt() {
const text = document.getElementById('modal-prompt-text').innerText;
navigator.clipboard.writeText(text).then(() => {
const btn = document.querySelector('[onclick="copyPrompt()"]');
const originalContent = btn.innerHTML;
btn.innerHTML = '<i class="fa-solid fa-check text-sm"></i> Copied!';
btn.classList.remove('bg-emerald-600');
btn.classList.add('bg-green-600');
setTimeout(() => {
btn.innerHTML = originalContent;
btn.classList.remove('bg-green-600');
btn.classList.add('bg-emerald-600');
}, 2000);
});
}
// --- 1. LOADING SEQUENCE ---
window.addEventListener('load', () => {
fetchConfig();
setTimeout(() => {
const loader = document.getElementById('loader-overlay');
const grid = document.getElementById('main-grid');
loader.style.opacity = '0';
loader.style.transition = 'opacity 0.8s ease';
setTimeout(() => {
loader.style.display = 'none';
grid.classList.remove('hidden');
requestAnimationFrame(() => { grid.style.opacity = '1'; });
setTimeout(() => {
showModal();
}, 600);
}, 300);
}, 1000);
});
// --- 2. FLUID FULLSCREEN ANIMATION LOGIC ---
let activeCardId = null;
let originalRect = null;
function toggleFullscreen(cardId) {
const card = document.getElementById(cardId);
const btnIcon = card.querySelector('.fullscreen-trigger i');
const isExpanding = !card.classList.contains('is-fullscreen');
if (isExpanding) {
if (activeCardId && activeCardId !== cardId) return;
activeCardId = cardId;
const rect = card.getBoundingClientRect();
originalRect = rect;
card.style.position = 'fixed';
card.style.top = rect.top + 'px';
card.style.left = rect.left + 'px';
card.style.width = rect.width + 'px';
card.style.height = rect.height + 'px';
card.style.zIndex = '50';
card.style.margin = '0';
requestAnimationFrame(() => {
card.style.transition = 'all 0.5s cubic-bezier(0.16, 1, 0.3, 1)';
requestAnimationFrame(() => {
card.classList.add('is-fullscreen');
document.body.classList.add('has-fullscreen-active');
card.style.top = '0';
card.style.left = '0';
card.style.width = '100vw';
card.style.height = '100vh';
btnIcon.classList.remove('fa-expand');
btnIcon.classList.add('fa-compress');
});
});
} else {
card.style.top = originalRect.top + 'px';
card.style.left = originalRect.left + 'px';
card.style.width = originalRect.width + 'px';
card.style.height = originalRect.height + 'px';
card.classList.remove('is-fullscreen');
document.body.classList.remove('has-fullscreen-active');
btnIcon.classList.remove('fa-compress');
btnIcon.classList.add('fa-expand');
setTimeout(() => {
card.style.position = '';
card.style.top = '';
card.style.left = '';
card.style.width = '';
card.style.height = '';
card.style.zIndex = '';
card.style.transition = '';
activeCardId = null;
}, 500);
}
}
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape') {
if (activeCardId) toggleFullscreen(activeCardId);
const infoModal = document.getElementById('info-modal');
const promptModal = document.getElementById('prompt-modal');
if (infoModal && infoModal.style.opacity === '1') closeModal();
if (promptModal && promptModal.style.opacity === '1') closePromptModal();
}
});
</script>
</body>
</html>