Skip to content

Commit 35a60f8

Browse files
committed
Refactored js and css
1 parent 72efead commit 35a60f8

File tree

3 files changed

+49
-9
lines changed

3 files changed

+49
-9
lines changed
File renamed without changes.

script.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ let problemsData = {
44
vicutils: []
55
};
66

7-
const main = document.getElementById("main")
7+
const main = document.getElementById("main")
88

99

1010
async function scanForProblems() {
@@ -23,11 +23,11 @@ async function scanForProblems() {
2323
const problems = [];
2424

2525
if (platform === 'vicutils') {
26-
// For vicutils, look for generated .html files
26+
// For vicutils, ONLY look for .html files (ignore Python files)
2727
for (const item of items) {
2828
if (item.type === 'file' && item.name.endsWith('.html')) {
2929
problems.push({
30-
name: item.name, // Keep the full filename
30+
name: item.name,
3131
displayName: item.name.replace('.html', '').replace(/_/g, ' '),
3232
type: 'html',
3333
hasPage: true,
@@ -62,7 +62,11 @@ async function scanForProblems() {
6262
);
6363
const hasPng = pngFiles.length > 0;
6464

65-
const pyFiles = files.filter(file => file.name.endsWith('.vn.py'));
65+
// FIXED: Only select .vn.py files that do NOT contain .shortest.
66+
const pyFiles = files.filter(file =>
67+
file.name.endsWith('.vn.py') &&
68+
!file.name.includes('.shortest.')
69+
);
6670
const hasPy = pyFiles.length > 0;
6771

6872
let type = 'code-only';
@@ -402,4 +406,4 @@ window.addEventListener('hashchange', () => {
402406
} else if (hash === '') {
403407
location.reload(); // Reload to show main page
404408
}
405-
});
409+
});

styles.css

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
* {
32
margin: 0;
43
padding: 0;
@@ -312,13 +311,20 @@ h1 {
312311
background: white;
313312
min-height: 100vh;
314313
padding: 2rem;
314+
overflow-x: hidden;
315315
}
316316

317317
.nav-buttons {
318318
display: flex;
319319
gap: 1rem;
320320
margin-bottom: 2rem;
321321
flex-wrap: wrap;
322+
position: sticky;
323+
top: 0;
324+
background: white;
325+
padding: 1rem 0;
326+
z-index: 10;
327+
border-bottom: 2px solid #e2e8f0;
322328
}
323329

324330
.nav-btn {
@@ -363,7 +369,7 @@ h1 {
363369
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
364370
gap: 2rem;
365371
margin: 2rem 0;
366-
max-width: 1000px;
372+
max-width: 1400px;
367373
margin-left: auto;
368374
margin-right: auto;
369375
}
@@ -374,6 +380,9 @@ h1 {
374380
overflow: hidden;
375381
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
376382
transition: transform 0.3s ease;
383+
max-height: 600px;
384+
display: flex;
385+
flex-direction: column;
377386
}
378387

379388
.image-container:hover {
@@ -382,10 +391,11 @@ h1 {
382391

383392
.image-container img {
384393
width: 100%;
385-
max-width: 800px;
386394
height: auto;
395+
max-height: 550px;
396+
object-fit: contain;
387397
display: block;
388-
margin: 0 auto;
398+
background: white;
389399
}
390400

391401
.image-caption {
@@ -402,6 +412,9 @@ h1 {
402412
border-radius: 10px;
403413
padding: 2rem;
404414
margin: 2rem 0;
415+
max-width: 1400px;
416+
margin-left: auto;
417+
margin-right: auto;
405418
}
406419

407420
.code-section h3 {
@@ -419,7 +432,30 @@ h1 {
419432
line-height: 1.6;
420433
white-space: pre-wrap;
421434
overflow-x: auto;
435+
max-height: 600px;
436+
overflow-y: auto;
422437
font-weight: bold;
438+
scrollbar-width: thin;
439+
scrollbar-color: #475569 #1e293b;
440+
}
441+
442+
.code-content::-webkit-scrollbar {
443+
width: 8px;
444+
height: 8px;
445+
}
446+
447+
.code-content::-webkit-scrollbar-track {
448+
background: #1e293b;
449+
border-radius: 4px;
450+
}
451+
452+
.code-content::-webkit-scrollbar-thumb {
453+
background: #475569;
454+
border-radius: 4px;
455+
}
456+
457+
.code-content::-webkit-scrollbar-thumb:hover {
458+
background: #64748b;
423459
}
424460

425461
@media (max-width: 768px) {

0 commit comments

Comments
 (0)