-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
376 lines (269 loc) · 6.72 KB
/
index.html
File metadata and controls
376 lines (269 loc) · 6.72 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CS50 Project Ideas</title>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<style>
html {
scroll-behavior: smooth;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial;
background-color: #f6f8fa;
margin: 0;
}
/* Header */
header {
background: #161b22;
color: white;
padding: 28px 40px;
}
header h1 {
margin: 0;
font-size: 28px;
}
header p {
margin-top: 6px;
color: #8b949e;
}
/* Layout */
.container {
display: flex;
}
/* Sidebar */
.sidebar {
width: 260px;
background: white;
border-right: 1px solid #e1e4e8;
height: 100vh;
padding: 24px;
position: sticky;
top: 0;
}
.sidebar h3 {
margin-top: 0;
font-size: 16px;
}
.sidebar a {
display: block;
padding: 6px 0;
color: #0969da;
text-decoration: none;
font-size: 14px;
}
.sidebar a:hover {
text-decoration: underline;
}
/* Content */
.content {
padding: 40px;
flex-grow: 1;
}
/* Project Grid */
.project-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
}
/* Cards */
.project {
background: white;
border: 1px solid #d0d7de;
border-radius: 8px;
padding: 20px;
transition: all 0.15s ease;
}
.project:hover {
border-color: #0969da;
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}
.project h2 {
margin-top: 0;
font-size: 18px;
}
.project p {
color: #57606a;
font-size: 14px;
}
.tag {
display: inline-block;
background: #eaeef2;
padding: 3px 8px;
font-size: 12px;
border-radius: 4px;
margin-bottom: 10px;
}
/* Markdown Viewer */
#viewer {
background: white;
border: 1px solid #d0d7de;
border-radius: 8px;
padding: 30px;
margin-top: 40px;
}
#viewer pre {
background: #f6f8fa;
padding: 15px;
border-radius: 6px;
overflow-x: auto;
}
footer {
margin-top: 40px;
color: #57606a;
font-size: 14px;
}
</style>
</head>
<body>
<header>
<h1>CS50 Project Ideas</h1>
<p>A curated library of ideas for CS50 final projects.</p>
</header>
<div class="container">
<div class="sidebar">
<h3>Courses</h3>
<a href="#cs50x">CS50x</a>
<a href="#cs50p">CS50P</a>
<a href="#cs50w">CS50W</a>
<a href="#cs50ai">CS50AI</a>
<a href="#cs50sql">CS50SQL</a>
</div>
<div class="content">
<!-- CS50P -->
<h2 id="cs50p">CS50P – Python Projects</h2>
<div class="project-grid">
<div class="project">
<span class="tag">Beginner</span>
<h2>Flashcard Learning App</h2>
<p>A CLI flashcard study tool.</p>
<a href="#" onclick="loadIdea('CS50P-Project-Ideas','flashcard-learning-app.md')">Read more →</a>
</div>
<div class="project">
<span class="tag">Beginner</span>
<h2>Pomodoro Timer</h2>
<p>A productivity timer.</p>
<a href="#" onclick="loadIdea('CS50P-Project-Ideas','pomodoro-timer.md')">Read more →</a>
</div>
</div>
<!-- CS50x -->
<h2 id="cs50x">CS50x – Computer Science Projects</h2>
<div class="project-grid">
<div class="project">
<span class="tag">Intermediate</span>
<h2>Mini Shell</h2>
<p>Build a basic command shell in C.</p>
<a href="#" onclick="loadIdea('CS50x-Project-Ideas','mini-shell.md')">Read more →</a>
</div>
</div>
<!-- CS50W -->
<h2 id="cs50w">CS50W – Web Programming</h2>
<div class="project-grid">
<div class="project">
<span class="tag">Advanced</span>
<h2></h2>
<p></p>
<a href="#" onclick="loadIdea('CS50W-Project-Ideas','')">Read more →</a>
</div>
</div>
<!-- CS50AI -->
<h2 id="cs50ai">CS50AI – Artificial Intelligence</h2>
<div class="project-grid">
<div class="project">
<span class="tag">Advanced</span>
<h2>Chess AI</h2>
<p>Build an AI that plays chess.</p>
<a href="#" onclick="loadIdea('CS50AI-Project-Ideas','chess-ai.md')">Read more →</a>
</div>
</div>
<!-- CS50SQL -->
<h2 id="cs50sql">CS50SQL – Database Projects</h2>
<div class="project-grid">
<div class="project">
<span class="tag">Intermediate</span>
<h2>Library Database</h2>
<p>A SQL system for managing library books.</p>
<a href="#" onclick="loadIdea('CS50SQL-Project-Ideas','library-database.md')">Read more →</a>
</div>
</div>
<div id="viewer">
<h2>Project details will appear here</h2>
<p>Click “Read more” on a project.</p>
</div>
<footer>
<p>Part of the <a href="https://github.com/AkshajSinghal/CS50-Project-Ideas">CS50 Project Ideas library</a>.</p>
<p>Maintained by <a href="https://github.com/AkshajSinghal/">Akshaj Singhal</a></p>
</footer>
</div>
</div>
<script>
const repos = {
"CS50P – Python": "CS50P-Project-Ideas",
"CS50x – Computer Science": "CS50x-Project-Ideas",
"CS50W – Web Programming": "CS50W-Project-Ideas",
"CS50AI – Artificial Intelligence": "CS50AI-Project-Ideas",
"CS50SQL – Databases": "CS50SQL-Project-Ideas"
};
const content = document.querySelector(".content");
const viewer = document.getElementById("viewer");
async function loadRepos() {
for (const [course, repo] of Object.entries(repos)) {
const section = document.createElement("section");
const id = course.split(" ")[0].toLowerCase();
section.innerHTML = `
<h2 id="${id}">${course}</h2>
<div class="project-grid"></div>
`;
content.insertBefore(section, viewer);
const grid = section.querySelector(".project-grid");
try {
const url =
`https://raw.githubusercontent.com/AkshajSinghal/${repo}/main/README.md?nocache=${Date.now()}`;
const res = await fetch(url,{cache:"no-store"});
const md = await res.text();
const html = marked.parse(md);
const parser = new DOMParser();
const doc = parser.parseFromString(html,"text/html");
const links = doc.querySelectorAll("li a");
links.forEach(link => {
const title = link.textContent.trim();
const file = link.getAttribute("href");
if(!file.endsWith(".md")) return;
const card = document.createElement("div");
card.className = "project";
card.innerHTML = `
<span class="tag">${course.split(" ")[0]}</span>
<h2>${title}</h2>
<p>Project idea from ${repo}</p>
<a href="#" data-repo="${repo}" data-file="${file}">
Read more →
</a>
`;
card.querySelector("a").onclick = function(e){
e.preventDefault();
loadIdea(this.dataset.repo,this.dataset.file);
};
grid.appendChild(card);
});
} catch(err) {
console.error("Error loading repo:",repo,err);
}
}
}
async function loadIdea(repo,file){
const url =
`https://raw.githubusercontent.com/AkshajSinghal/${repo}/main/${file}?nocache=${Date.now()}`;
const res = await fetch(url,{cache:"no-store"});
const md = await res.text();
viewer.innerHTML = marked.parse(md);
window.scrollTo({
top: viewer.offsetTop - 40,
behavior: "smooth"
});
}
loadRepos();
</script>
</body>
</html>