-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
296 lines (258 loc) · 7.89 KB
/
index.html
File metadata and controls
296 lines (258 loc) · 7.89 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hacktopus404/frontend — Folder Explorer</title>
<!-- Correctly encoded SVG favicon -->
<link
rel="icon"
type="image/svg+xml"
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2385beff'%3E%3Cpath d='M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3E%3C/svg%3E"
/>
<style>
* {
-webkit-tap-highlight-color: transparent;
box-sizing: border-box;
cursor: url("https://sweezy-cursors.com/wp-content/uploads/cursor/minecraft-enchanted-diamond-sword-animated/minecraft-enchanted-diamond-sword-animated-pointer-32x32.png"),
auto !important;
}
body {
font-family: monospace;
background: #0d1117;
color: #c9d1d9;
padding: 20px;
font-size: 1rem;
user-select: none;
}
h2 {
color: #58a6ff;
margin-bottom: 8px;
}
ul {
display: inline-block;
list-style-type: none;
padding-left: 16px;
margin: 0;
}
li {
line-height: 1.7;
position: relative;
cursor: url("https://sweezy-cursors.com/wp-content/uploads/cursor/minecraft-enchanted-golden-sword-animated/minecraft-enchanted-golden-sword-animated-pointer-32x32.png"),
pointer !important;
}
li.folder::before {
content: "▶";
display: inline-block;
margin-left: 5.5px;
margin-right: 0.3em;
transition: transform 0.18s ease;
width: 16px;
}
li.folder.open::before {
transform: rotate(90deg);
}
li.folder.open {
color: #79c0ff;
}
li.file::before {
content: "📄";
margin-right: 0.3em;
}
li.file {
margin-left: 3.5px;
cursor: pointer;
}
li.file:hover {
color: #79c0ff;
}
li.folder:hover {
color: #79c0ff;
}
li.folder > ul {
margin-left: 14px;
border-left: 1px dashed #30363d;
padding-left: 8px;
display: none;
}
li.folder.open > ul {
color: #c9d1d9;
display: block;
animation: fadeIn 0.15s ease-in;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
li.file.html-file {
color: #ff5555;
}
li.file.html-file:hover {
color: #ffd700;
}
/* ⭐ COOL FOLDER LOADER */
#loading {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 53px;
color: #58a6ff;
animation: fadeIn 0.4s ease-in;
font-size: 1rem;
user-select: none;
}
#folder-loader {
width: 64px;
height: 64px;
margin-bottom: -5px;
transform-origin: center;
animation: wiggle 0.7s infinite ease-in-out;
}
/* Folder colors */
.folder-top {
fill: #85beff;
}
.folder-bottom {
fill: #58a6ff;
}
/* Sparkles ✨ */
.sparkle {
fill: #ffd700;
opacity: 0;
}
.s1 {
animation: sparkle 1s infinite 0.2s;
}
.s2 {
animation: sparkle 1.2s infinite 0.4s;
}
.s3 {
animation: sparkle 1s infinite 0.6s;
}
@keyframes wiggle {
0%,
100% {
transform: rotate(0deg);
}
25% {
transform: rotate(-6deg);
}
75% {
transform: rotate(6deg);
}
}
@keyframes sparkle {
0%,
60% {
opacity: 0;
transform: scale(0.5);
}
80% {
opacity: 1;
transform: scale(1.2);
}
100% {
opacity: 0;
transform: scale(0.6);
}
}
</style>
</head>
<body>
<h2>📂 Hacktopus404/frontend — Folder Explorer</h2>
<!-- ⭐ COOL SVG LOADING ANIMATION -->
<div id="loading">
<svg id="folder-loader" viewBox="0 0 64 64">
<path class="folder-top" d="M8 18h18l4 4h26v8H8z" />
<rect class="folder-bottom" x="8" y="26" width="48" height="30" rx="3" />
<circle class="sparkle s1" cx="20" cy="12" r="1.6" />
<circle class="sparkle s2" cx="46" cy="14" r="2" />
<circle class="sparkle s3" cx="35" cy="8" r="1.4" />
</svg>
<p>Loading...</p>
</div>
<ul id="repo-tree" style="display:none;"></ul>
<script>
const owner = "Hacktopus404";
const repo = "frontend";
const branch = "main";
const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}?recursive=1`;
const pagesBase = `https://${owner}.github.io/${repo}`;
const ignoredFiles = ["LICENSE", "README.md"];
// Fetch full repo structure once
async function fetchRepoTree() {
const res = await fetch(treeUrl, {
headers: {
"User-Agent": "FolderExplorer",
Accept: "application/vnd.github+json",
},
});
const data = await res.json();
return data.tree;
}
// Build nested tree structure from paths (ignoring root index.html)
function buildNestedTree(list) {
const root = {};
list.forEach((item) => {
if (ignoredFiles.includes(item.path)) return;
if (item.path.toLowerCase() === "index.html") return;
const parts = item.path.split("/");
let current = root;
parts.forEach((part, i) => {
if (!current[part])
current[part] = { __filesize: item.size ?? null };
if (i === parts.length - 1) {
current[part].__type = item.type;
}
current = current[part];
});
});
return root;
}
// Render DOM recursively
function renderTree(obj, parentUl, path = "") {
Object.entries(obj).forEach(([name, value]) => {
if (name.startsWith("__")) return;
const li = document.createElement("li");
const newPath = path ? `${path}/${name}` : name;
if (value.__type === "blob") {
li.classList.add("file");
li.textContent = name;
if (name.toLowerCase().endsWith(".html"))
li.classList.add("html-file");
li.addEventListener("click", (e) => {
e.stopPropagation();
const fileUrl = `${pagesBase}/${newPath}`;
window.open(fileUrl, "_blank");
});
} else {
li.classList.add("folder");
li.textContent = name;
const nestedUl = document.createElement("ul");
li.appendChild(nestedUl);
li.addEventListener("click", (e) => {
e.stopPropagation();
li.classList.toggle("open");
});
renderTree(value, nestedUl, newPath);
}
parentUl.appendChild(li);
});
}
// Load everything
(async () => {
document.getElementById("loading").style.display = "flex";
document.getElementById("repo-tree").style.display = "none";
const tree = await fetchRepoTree();
const nested = buildNestedTree(tree);
renderTree(nested, document.getElementById("repo-tree"));
document.getElementById("loading").style.display = "none";
document.getElementById("repo-tree").style.display = "inline-block";
})();
</script>
</body>
</html>