-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathproject-list.html
More file actions
266 lines (233 loc) · 6.92 KB
/
project-list.html
File metadata and controls
266 lines (233 loc) · 6.92 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="memes and other garbage">
<meta name="keywords" content="website, memes">
<meta name="author" content="Unknown07724">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="/favicon.png">
<link rel="stylesheet" href="/styles/main.css">
<title>Project List - by Unknown07724</title>
<style>
/* Gallery CSS */
/* Gallery container */
#projects-list.gallery {
display: flex;
flex-wrap: wrap;
gap: 20px;
justify-content: center;
padding: 10px 0;
}
/* Each project card */
.gallery-item {
border-radius: 12px;
flex: 1 1 calc(25% - 20px);
min-width: 220px;
max-width: 300px;
overflow: hidden;
transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s, border-color 0.3s;
cursor: pointer;
}
/* Hover effect */
.gallery-item:hover {
transform: translateY(-5px);
}
/* Inner box for content */
.gallery-box {
padding: 15px;
}
/* Titles */
.gallery-box h4 {
margin: 0 0 10px 0;
font-size: 1.1em;
}
/* Descriptions */
.gallery-box p {
font-size: 0.9em;
line-height: 1.2em;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
/* Author label */
.gallery-box span {
display: block;
margin-top: 8px;
font-size: 0.8em;
}
/* Dark mode */
@media screen and (prefers-color-scheme: dark) {
.gallery-item {
background-color: #282828;
border: 2px solid #334BFF;
color: white;
}
.gallery-item:hover {
box-shadow: 0 8px 20px rgba(51, 75, 255, 0.5);
}
.gallery-box h4 { color: orange; }
.gallery-box p { color: orange; }
.gallery-box span { color: #6495ED; }
}
/* Light mode */
@media screen and (prefers-color-scheme: light) {
.gallery-item {
background-color: #f7f7f7;
border: 2px solid #040273;
color: black;
}
.gallery-item:hover {
box-shadow: 0 8px 20px rgba(0, 4, 115, 0.5);
}
.gallery-box h4 { color: #040273; }
.gallery-box p { color: black; }
.gallery-box span { color: #334BFF; }
}
/* Responsive */
@media (max-width: 900px) {
.gallery-item { flex: 1 1 calc(50% - 20px); }
}
@media (max-width: 500px) {
.gallery-item { flex: 1 1 100%; }
}
</style>
</head>
<body>
<!-- Banner for Old List (commented out) -->
<div id="update-banner" style="background: #6495ED; color: black; text-align: center; padding: 10px; border-radius: 15px; display: none;">
<p>We've changed how the project list works! <a href="other/old/project-list.html">Click here for the old version.</a></p>
<button onclick="hideBanner()">Don't Show Again</button>
</div>
<script>
if (!localStorage.getItem("hideBanner")) {
document.getElementById("update-banner").style.display = "block";
}
function hideBanner() {
document.getElementById("update-banner").style.display = "none";
localStorage.setItem("hideBanner", "true");
}
</script>
<p>hello, this is the project list</p>
<p>it is to show projects</p>
<!-- Sorting Dropdown -->
<label for="sort-options">Sort by:</label>
<select id="sort-options" onchange="sortProjects()">
<option value="last_updated">Last Updated</option>
<option value="alphabetical">Alphabetical</option>
</select>
<!-- Ads Filter Dropdown -->
<label for="ads-filter">Filter by Ads:</label>
<select id="ads-filter" onchange="filterByAds()">
<option value="all">All Projects</option>
<option value="true">Has Ads</option>
<option value="false">No Ads</option>
</select>
<!-- Gallery Toggle -->
<label>
<input type="checkbox" id="gallery-toggle" onchange="toggleGallery()"> Gallery View
</label>
<!-- Projects Container -->
<div id="projects-list"></div>
<script>
let projectsData = [];
let filteredProjects = [];
// Fetch projects
fetch('projects.json?t=' + Date.now())
.then(response => {
if (!response.ok) throw new Error(`Network response was not ok: ${response.statusText}`);
return response.json();
})
.then(data => {
projectsData = flattenProjects(data.projects);
filteredProjects = [...projectsData];
sortProjects();
})
.catch(error => {
console.error("Error loading projects.json:", error);
alert("Failed to load projects. Please try again later.");
});
// Flatten nested structure
function flattenProjects(authors) {
let allProjects = [];
authors.forEach(author => {
author.projects.forEach(project => {
allProjects.push({
author: author.author,
name: project.name,
description: project.description,
url: project.url,
last_updated: project.last_updated,
HasAds: project.HasAds || false
});
});
});
return allProjects;
}
function sortProjects() {
if (filteredProjects.length === 0) return;
const sortBy = document.getElementById("sort-options").value;
let sortedProjects = [...filteredProjects];
if (sortBy === "last_updated") {
sortedProjects.sort((a, b) => new Date(b.last_updated) - new Date(a.last_updated));
} else if (sortBy === "alphabetical") {
sortedProjects.sort((a, b) => a.name.localeCompare(b.name));
}
displayProjects(sortedProjects);
}
function filterByAds() {
const adsFilter = document.getElementById("ads-filter").value;
if (adsFilter === "all") filteredProjects = [...projectsData];
else if (adsFilter === "true") filteredProjects = projectsData.filter(p => p.HasAds === true);
else if (adsFilter === "false") filteredProjects = projectsData.filter(p => p.HasAds === false);
sortProjects();
}
function toggleGallery() {
sortProjects(); // re-render projects
}
function displayProjects(projects) {
let container = document.getElementById('projects-list');
container.innerHTML = "";
const galleryOn = document.getElementById('gallery-toggle').checked;
container.className = galleryOn ? "gallery" : "";
if (projects.length === 0) {
container.innerHTML = "<p>No projects available at the moment.</p>";
return;
}
let currentAuthor = "";
projects.forEach(project => {
if (!galleryOn) {
if (currentAuthor !== project.author) {
currentAuthor = project.author;
container.innerHTML += `<hr><a href="author.html?auth=${encodeURIComponent(project.author)}"><h2>${project.author}</h2></a><hr>`;
}
let projectDiv = document.createElement('div');
projectDiv.innerHTML = `
<a href="${project.url}">
<h4>${project.name}</h4>
</a>
<p>${project.description}</p>
`;
container.appendChild(projectDiv);
} else {
// Gallery mode
let projectDiv = document.createElement('div');
projectDiv.className = 'gallery-item';
projectDiv.innerHTML = `
<a href="${project.url}">
<div class="gallery-box">
<h4>${project.name}</h4>
<p>${project.description}</p>
<span>${project.author}</span>
</div>
</a>
`;
container.appendChild(projectDiv);
}
});
}
</script>
</body>
</html>