-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
320 lines (265 loc) · 7.9 KB
/
Copy pathindex.html
File metadata and controls
320 lines (265 loc) · 7.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Start</title>
<style>
:root {
--body-width: 96%;
--body-width-max: 1600px;
--space: 1rem;
--space-small: 0.6rem;
--font-family: system-ui, -apple-system, 'Segoe UI', 'Roboto', Ubuntu, Cantarell, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
--line-height: 1.618034; /* Golden Ratio */
--heading-size: 1.25rem;
--heading-weight: 600;
--text-size: 1rem;
/* Tailwind color, https://tailwindcss.com/docs/colors */
--color-primary: oklch(54.6% 0.245 262.881); /* Blue-700 */
--color-accent: oklch(51.8% 0.253 323.949); /* Fuchsia-700 */
--color-gray-light: oklch(98.4% 0.003 247.858); /* Slate-50 */
--color-gray: oklch(97% 0 0); /* Neutal-100 */
--color-gray-dark: oklch(87% 0 0); /* Neutal-300 */
--color-gray-darker: oklch(55.6% 0 0); /* Neutal-500 */
--color-gray-darkest: oklch(26.9% 0 0); /* Neutal-800 */
--color-border: var(--color-gray-dark);
--color-text: var(--color-gray-darkest);
--color-link: var(--color-primary);
--color-link-hover: var(--color-accent);
--border-radius: 7px;
}
*,
::before,
::after {
box-sizing: border-box;
}
html, body {
height: 100%;
}
body {
width: var(--body-width);
max-width: var(--body-width-max);
margin: var(--space) auto;
padding: 0;
font-family: var(--font-family);
font-size: var(--text-size);
line-height: var(--line-height);
color: var(--color-text);
background: var(--color-gray);
}
h2 {
margin: 0;
padding: var(--space-small) var(--space);
font-size: var(--heading-size);
font-weight: var(--heading-weight);
background: var(--color-gray);
color: var(--color-text);
border-radius: var(--border-radius) var(--border-radius) 0 0;
border-bottom: 1px solid var(--color-gray-dark);
}
a, a:visited {
color: var(--color-link);
text-decoration: none;
}
a:hover, a:active {
color: var(--color-link-hover);
text-decoration: underline;
}
ul, ol {
list-style: none;
margin: var(--space) 0;
padding: 0;
}
li {
margin: 0;
padding: 0 var(--space);
border: 2px solid transparent;
}
li:hover, li:active {
color: var(--color-gray-darker);
background: var(--color-gray);
border-left-color: var(--color-gray-darker);
border-right-color: var(--color-gray-darker);
}
hr {
margin: var(--space);
background: none;
height: 0;
border: 0 none;
border-bottom: 1px solid var(--color-gray-dark);
}
main {
display: flex;
flex-direction: column;
gap: var(--space);
}
bookmark-primary {
display: flex;
flex-wrap: wrap;
gap: var(--space);
}
bookmark-favorites,
bookmark-main,
bookmark-sidebar {
flex: 1;
min-width: calc(33.333% - var(--space) * 2/3); /* Ensure equal width with gap consideration */
}
bookmark-tmp {
width: 100%;
margin-top: calc(2 * var(--space));
}
/* Tablet layout: 2 columns */
@media (max-width: 800px) {
bookmark-favorites,
bookmark-main,
bookmark-sidebar {
min-width: calc(50% - var(--space) / 2); /* Two columns on tablet */
}
/* Ensure the third item takes full width in the next row */
bookmark-sidebar {
flex-basis: 100%;
}
}
/* Mobile layout: 1 column */
@media (max-width: 640px) {
bookmark-favorites,
bookmark-main,
bookmark-sidebar {
min-width: 100%; /* Full width on mobile */
}
}
bookmark-favorites,
bookmark-main,
bookmark-sidebar,
bookmark-tmp {
padding: 0;
background: var(--color-gray-light);
border-radius: var(--border-radius);
border: 1px solid var(--color-border);
box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
}
/* tmp columnar layout - process ’EM */
bookmark-tmp ul {
column-count: 3;
column-gap: 0;
column-rule: 1px solid var(--color-gray-dark);
padding: 0;
}
bookmark-tmp li {
break-inside: avoid;
page-break-inside: avoid;
}
/* Tablet layout: 2 columns */
@media (max-width: 800px) {
bookmark-tmp ul {
column-count: 2;
}
}
/* Mobile layout: 1 column */
@media (max-width: 640px) {
bookmark-tmp ul {
column-count: 1;
column-rule: none; /* Remove vertical line when there's only one column */
}
}
footer {
margin: 0;
padding: var(--space);
}
</style>
</head>
<body>
<main>
<bookmark-primary>
<bookmark-favorites><content-md data-src="1-favorites.md"></content-md></bookmark-favorites>
<bookmark-main><content-md data-src="2-main.md"></content-md></bookmark-main>
<bookmark-sidebar><content-md data-src="3-sidebar.md"></content-md></bookmark-sidebar>
</bookmark-primary>
<bookmark-tmp><content-md data-src="4-tmp.md"></content-md></bookmark-tmp>
</main>
<footer>
<p>
<small>
<a href="https://start.oinam.com">Start</a> by <a href="https://brajeshwar.com">Brajeshwar</a>.
<a href="https://github.com/oinam/start">Source</a>.
Edited on Nov 26, 2025.
</small>
</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
// Define the "content-md" custom element
class ContentMd extends HTMLElement {
constructor() {
super();
}
async connectedCallback() {
const src = this.getAttribute('data-src');
if (!src) {
this.innerHTML = '<p>Error: No source file specified</p>';
return;
}
try {
const response = await fetch(src);
if (!response.ok) {
throw new Error(`Failed to load ${src}: ${response.status} ${response.statusText}`);
}
const markdown = await response.text();
this.innerHTML = marked.parse(markdown);
} catch (error) {
console.error(`Error loading markdown file: ${error}`);
this.innerHTML = `<p>Error loading ${src}: ${error.message}</p>`;
}
}
}
// Register the custom element for Markdown Replacement
customElements.define('content-md', ContentMd);
// Initialize "content-md" elements
document.addEventListener('DOMContentLoaded', () => {
console.log('DOM loaded, initializing markdown content…');
});
// Sort bookmark-tmp list items alphabetically after markdown is rendered
function sortBookmarkTmpList() {
const bookmarkTmp = document.querySelector('bookmark-tmp');
if (!bookmarkTmp) return;
const ul = bookmarkTmp.querySelector('ul');
if (!ul) return;
// Get all list items
const listItems = Array.from(ul.querySelectorAll('li'));
// Sort list items alphabetically by their text content
listItems.sort((a, b) => {
const textA = a.textContent.trim().toLowerCase();
const textB = b.textContent.trim().toLowerCase();
return textA.localeCompare(textB);
});
// Clear the ul and append sorted items
ul.innerHTML = '';
listItems.forEach(item => ul.appendChild(item));
}
// Use MutationObserver to detect when markdown content is loaded and rendered
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === 'childList') {
const bookmarkTmp = document.querySelector('bookmark-tmp');
if (bookmarkTmp && bookmarkTmp.querySelector('ul')) {
// Delay sorting slightly to ensure all content is fully rendered
setTimeout(sortBookmarkTmpList, 100);
observer.disconnect(); // Stop observing once we've sorted
}
}
});
});
// Start observing when DOM is ready
document.addEventListener('DOMContentLoaded', () => {
observer.observe(document.body, {
childList: true,
subtree: true
});
});
</script>
</body>
</html>