-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
267 lines (228 loc) · 7.6 KB
/
index.html
File metadata and controls
267 lines (228 loc) · 7.6 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
<!-- Generated by Gemini -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>buy-one.github.io</title>
<style>
:root {
--primary: #2563eb;
--bg: #c2d9f0;
--card: #f1f5f9;
--text: #334155;
--sidebar-width: 260px;
--sidebar-collapsed: 65px;
}
body, html {
margin: 0;
padding: 0;
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background-color: var(--bg);
overflow: hidden;
}
.wrapper {
display: flex;
height: 100vh;
}
/* Sidebar Styling */
.sidebar {
width: var(--sidebar-width);
background: var(--card);
border-right: 1px solid #cbd5e1;
display: flex;
flex-direction: column;
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
z-index: 10;
}
/* State for collapsed sidebar */
.sidebar.collapsed {
width: var(--sidebar-collapsed);
}
.sidebar-header {
padding: 10px;
border-bottom: 1px solid #cbd5e1;
display: flex;
align-items: center;
justify-content: space-between; /* Keeps button to the right */
min-height: 50px;
box-sizing: border-box;
overflow: hidden;
}
.header-text {
color: var(--primary);
font-weight: bold;
white-space: nowrap;
opacity: 1;
transition: opacity 0.2s;
}
/* Hide text when collapsed but keep the container height */
.sidebar.collapsed .header-text {
opacity: 0;
width: 0;
pointer-events: none;
}
/* Toggle Button - Stays visible */
.toggle-btn {
background: var(--primary);
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2rem;
flex-shrink: 0; /* Prevents button from shrinking */
}
.toggle-btn:hover { background: #1d4ed8; }
.nav-links {
flex-grow: 1;
padding: 10px 0;
/* ALLOW SCROLLING IF LINKS EXCEED HEIGHT */
overflow-x: hidden;
overflow-y: auto;
/* SMOOTH SCROLLING FOR CHROME 109 */
-webkit-overflow-scrolling: touch;
}
/* THIN SCROLLBAR STYLE */
.nav-links::-webkit-scrollbar {
width: 6px;
}
.nav-links::-webkit-scrollbar-thumb {
background-color: #cbd5e1;
border-radius: 3px;
}
.nav-links a {
display: flex;
align-items: center;
padding: 0.75rem 1.2rem;
color: var(--text);
text-decoration: none;
transition: background 0.2s;
white-space: nowrap;
border-left: 4px solid transparent;
}
/* The text span inside links in uncollapsed sidebar */
.nav-links a span:nth-child(2) {
white-space: normal;
word-break: break-word;
flex: 1;
transition: max-height 0.8s ease, opacity 0.3s ease; /* 0.8 good for multi-line links */
max-height: 200px; /* big enough to allow wrapping */
overflow: hidden;
}
/* When sidebar is collapsed, nowrap */
.sidebar.collapsed .nav-links a span:nth-child(2) {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-height: 1.2em; /* effectively one line */
}
/* Icon styling */
.icon {
margin-right: 20px;
font-size: 1.2rem;
min-width: 24px;
text-align: center;
}
.nav-links a:hover { background: #e2e8f0; color: var(--primary); }
.nav-links a.active {
background: #e2e8f0;
color: var(--primary);
border-left-color: var(--primary);
font-weight: 600;
}
/* Hide text labels when collapsed */
.link-text {
transition: opacity 0.2s;
}
.sidebar.collapsed .link-text {
display: none; /* Completely removes text from layout to prevent overflow */
}
/* Main Content Frame */
.content-area {
flex-grow: 1;
background: var(--bg);
}
iframe {
width: 100%;
height: 100%;
border: none;
}
</style>
</head><body>
<div class="wrapper">
<nav class="sidebar" id="sidebar">
<div class="sidebar-header">
<span class="header-text">...</span>
<button class="toggle-btn" onclick="toggleSidebar()">«</button>
</div>
<!-- icons sources
https://en.wikipedia.org/wiki/Geometric_Shapes_(Unicode_block)
https://www.compart.com/en/unicode/html
-->
<div class="nav-links">
<a href="Meta changelog generator.html" target="mainFrame" class="active" onclick="setActive(this)">
<span class="icon">↻</span> <span>Meta Changelog Formatter</span>
</a>
<a href="Meta changelog duplicate line finder.html" target="mainFrame" onclick="setActive(this)">
<span class="icon">⌕</span> <span>Duplicates Finder</span>
</a>
</div>
</nav>
<main class="content-area">
<iframe name="mainFrame" src="Meta changelog generator.html"></iframe>
</main>
</div>
<script>
let threshold = 600;
// tracks if the collapse was automatic
let autoCollapsed = false;
// tracks if the user manually overrode auto-collapse while small
let manualOverride = false;
function toggleSidebar() {
const sidebar = document.getElementById('sidebar');
sidebar.classList.toggle('collapsed');
const btn = document.querySelector('.toggle-btn');
btn.innerHTML = sidebar.classList.contains('collapsed') ? '»' : '«';
// manual toggle cancels auto-collapse tracking
autoCollapsed = false;
// if we're under threshold, set manual override
if (window.innerWidth < threshold) {
manualOverride = true;
}
}
function setActive(el) {
document.querySelectorAll('.nav-links a').forEach(link => link.classList.remove('active'));
el.classList.add('active');
}
function handleAutoCollapse() {
const sidebar = document.getElementById('sidebar');
const btn = document.querySelector('.toggle-btn');
if (window.innerWidth < threshold) {
if (!sidebar.classList.contains('collapsed') && !manualOverride) {
sidebar.classList.add('collapsed');
btn.innerHTML = '»';
autoCollapsed = true;
}
} else {
// reset manual override when we're above threshold
manualOverride = false;
// reopen only if collapse was automatic
if (autoCollapsed) {
sidebar.classList.remove('collapsed');
btn.innerHTML = '«';
autoCollapsed = false;
}
}
}
window.addEventListener('resize', handleAutoCollapse);
window.addEventListener('load', handleAutoCollapse);
</script>
</body>
</html>