-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
442 lines (416 loc) · 17.9 KB
/
Copy pathindex.html
File metadata and controls
442 lines (416 loc) · 17.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
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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta content="自我刻度·记录:个人文章、技术笔记、投资思考与生活感悟。" name="description"/>
<meta content="#111310" name="theme-color"/>
<meta content="自我刻度·记录" property="og:title"/>
<meta content="个人文章、技术笔记、投资思考与生活感悟。" property="og:description"/>
<meta content="website" property="og:type"/>
<title>自我刻度·记录 — 主页</title>
<link href="uploads/favicon-32.png" rel="icon" sizes="32x32" type="image/png"/>
<link href="uploads/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180"/>
<link href="/site.css?v=2563a04a3cea" rel="stylesheet"/>
<script defer="" src="/site.js?v=0d8e0332d3cf"></script>
</head>
<body class="home-page">
<a class="skip-link" href="#main-content">跳到主要内容</a>
<main class="apple-blog" id="main-content" tabindex="-1">
<header class="blog-header">
<h1>
自我刻度·记录
<span class="thin">为己,克己,成己</span>
</h1>
<span aria-hidden="true" class="hero-orbit"></span>
<div class="search-wrapper">
<div class="search-container" id="search-container">
<span aria-hidden="true" class="search-icon">⌕</span>
<input aria-autocomplete="list" aria-controls="suggestions" aria-expanded="false" aria-label="搜索文章" class="search-input" id="global-search" maxlength="200" placeholder="搜索文章..." role="combobox" type="text"/>
<button aria-label="清空搜索" class="clear-btn" type="button">✕</button>
</div>
<div aria-label="搜索建议" class="suggestions" id="suggestions" role="listbox"></div>
</div>
<div class="header-meta">
<a class="nav-chip" href="about.html">关于我</a>
<div class="site-update">
<span class="meta-label">联系我</span>
<nav aria-label="社交链接" class="social-icons">
<a aria-label="Facebook" href="https://www.facebook.com/people/Hx-Hwang/pfbid0JoDqMefLXPuWEmUfU7z5hZTgb1LQ82qX9yWCZxEmPcLc61mNuqZTicLP57NttWe7l/" rel="noopener noreferrer" target="_blank">
<svg fill="currentColor" height="20" viewbox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg">
<path d="M22.676 0H1.324C0.593 0 0 0.593 0 1.324v21.352C0 23.407 0.593 24 1.324 24h11.494v-9.294H9.689v-3.621h3.129V8.41c0-3.1 1.893-4.788 4.659-4.788 1.325 0 2.463 0.099 2.795 0.143v3.24l-1.918 0.001c-1.504 0-1.795 0.715-1.795 1.763v2.313h3.587l-0.467 3.621h-3.12V24h6.116c0.73 0 1.323-0.593 1.323-1.324V1.324C24 0.593 23.407 0 22.676 0z"></path>
</svg>
</a>
<a aria-label="X" href="https://x.com/Rayfon66" rel="noopener noreferrer" target="_blank">
<svg fill="currentColor" height="20" viewbox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg">
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"></path>
</svg>
</a>
</nav>
<a class="email-link" href="mailto:Rays688888@gmail.com">Rays688888@gmail.com</a>
</div>
</div>
</header>
<!-- 模块区域,由 JS 动态生成 -->
<div class="modules-grid" id="modules-grid">
<section class="card">
<div class="card-header">
<h2>投资与思想</h2>
<div class="module-desc">记录投资理念、市场周期与思维模型</div>
</div>
<ul class="article-list">
<li class="article-list-entry">
<a class="list-item" href="article/%E6%84%9F%E6%83%B3%E4%B8%80%E5%88%9926.7.1.html">
<div class="title-wrap">
<span class="sticky-icon"></span>
<span class="item-title">感想一则26.7.1</span>
</div>
<span class="item-date">2026-07-01</span>
</a>
</li>
<li class="article-list-entry">
<a class="list-item" href="article/%E6%84%9F%E6%83%B3%E4%B8%80%E5%88%9926.6.21.html">
<div class="title-wrap">
<span class="sticky-icon"></span>
<span class="item-title">感想一则26.6.21</span>
</div>
<span class="item-date">2026-06-21</span>
</a>
</li>
<li class="article-list-entry">
<a class="list-item" href="article/%E6%84%9F%E6%83%B3%E4%B8%80%E5%88%9926.6.4.html">
<div class="title-wrap">
<span class="sticky-icon"></span>
<span class="item-title">感想一则26.6.4</span>
</div>
<span class="item-date">2026-06-04</span>
</a>
</li>
</ul>
<div class="card-more-row"><a class="more-btn" href="module/%E6%8A%95%E8%B5%84%E6%80%9D%E6%83%B3.html">更多文章</a></div>
<div class="card-footer"><span>共 276 篇</span><span>最近更新 2026-07-01</span></div>
</section>
<section class="card">
<div class="card-header">
<h2>感悟与反省</h2>
<div class="module-desc">生活感悟、自我反省与情绪记录</div>
</div>
<ul class="article-list">
<li class="article-list-entry">
<a class="list-item" href="article/%E9%9A%8F%E7%AC%94%E4%B8%80%E5%88%9926.7.7.html">
<div class="title-wrap">
<span class="sticky-icon"></span>
<span class="item-title">随笔一则26.7.7</span>
</div>
<span class="item-date">2026-07-07</span>
</a>
</li>
<li class="article-list-entry">
<a class="list-item" href="article/%E9%9A%8F%E7%AC%94%E4%B8%80%E5%88%9926.6.27.html">
<div class="title-wrap">
<span class="sticky-icon"></span>
<span class="item-title">随笔一则26.6.27</span>
</div>
<span class="item-date">2026-06-27</span>
</a>
</li>
<li class="article-list-entry">
<a class="list-item" href="article/%E9%9A%8F%E7%AC%94%E4%B8%80%E5%88%9926.6.15.html">
<div class="title-wrap">
<span class="sticky-icon"></span>
<span class="item-title">随笔一则26.6.15</span>
</div>
<span class="item-date">2026-06-15</span>
</a>
</li>
</ul>
<div class="card-more-row"><a class="more-btn" href="module/%E6%84%9F%E6%82%9F%E5%8F%8D%E7%9C%81.html">更多文章</a></div>
<div class="card-footer"><span>共 264 篇</span><span>最近更新 2026-07-07</span></div>
</section>
<section class="card">
<div class="card-header">
<h2>技术与网络</h2>
<div class="module-desc">编程、工具、网络协议与技术思考</div>
</div>
<ul class="article-list">
<li class="article-list-entry">
<a class="list-item" href="article/%E4%B8%AA%E4%BA%BA%E7%BD%91%E7%AB%99%E5%8F%91%E5%B8%83%E9%93%BE%E8%B7%AF%EF%BC%9A%E4%BB%8E%E6%9C%AC%E5%9C%B0%E7%AE%A1%E7%90%86%E5%88%B0%E9%9D%99%E6%80%81%E7%AB%99%E7%82%B9%E6%8E%A8%E9%80%81.html">
<div class="title-wrap">
<span class="sticky-icon"></span>
<span class="item-title">个人网站发布链路:从本地管理到静态站点推送</span>
</div>
<span class="item-date">2026-07-07</span>
</a>
</li>
<li class="article-list-entry">
<a class="list-item" href="article/AI%E5%A4%A7%E5%8F%99%E4%BA%8B%E4%B8%8B%EF%BC%8C%E6%80%8E%E6%A0%B7%E8%AF%86%E5%88%AB%E7%9C%9F%E6%AD%A3%E6%9C%89%E7%BA%A7%E5%88%AB%E7%9A%84%E4%BA%A7%E4%B8%9A%E5%8F%98%E5%8C%96.html">
<div class="title-wrap">
<span class="sticky-icon"></span>
<span class="item-title">AI大叙事下,怎样识别真正有级别的产业变化</span>
</div>
<span class="item-date">2026-07-07</span>
</a>
</li>
<li class="article-list-entry">
<a class="list-item" href="article/PowerShell%20UTF-8%20%E4%B9%B1%E7%A0%81%E7%9A%84%E6%A0%B9%E5%9B%A0%E4%B8%8E%E5%BD%BB%E5%BA%95%E4%BF%AE%E5%A4%8D.html">
<div class="title-wrap">
<span class="sticky-icon"></span>
<span class="item-title">PowerShell UTF-8 乱码的根因与彻底修复</span>
</div>
<span class="item-date">2026-06-28</span>
</a>
</li>
</ul>
<div class="card-more-row"><a class="more-btn" href="module/%E6%8A%80%E6%9C%AF%E7%BD%91%E7%BB%9C.html">更多文章</a></div>
<div class="card-footer"><span>共 22 篇</span><span>最近更新 2026-07-07</span></div>
</section>
</div>
<footer class="blog-footer">
<div class="footer-left">
<span>© 2026 取譬不远 · 昊天不忒</span>
<span class="copy-protect">重趋势,重时机,重成本</span>
</div>
</footer>
</main>
<script>
(function() {
let searchIndexPromise = null;
function escapeHtml(text) {
const div = document.createElement('div');
div.textContent = text;
return div.innerHTML;
}
function normalizeSearchText(value) {
return String(value || '').normalize('NFKC').toLowerCase().replace(/\s+/g, ' ').trim();
}
function tokenizeSearchQuery(value) {
const normalized = normalizeSearchText(value).slice(0, 200);
const terms = normalized.match(/[一-鿿]+|[a-z0-9]+/gi) || [];
const tokens = [];
const seen = new Set();
const addToken = token => {
if (tokens.length >= 32 || seen.has(token)) return;
seen.add(token);
tokens.push(token);
};
terms.some(term => {
addToken(term);
if (/^[一-鿿]{3,}$/.test(term)) {
for (let i = 0; i < term.length - 1 && tokens.length < 32; i += 1) {
addToken(term.slice(i, i + 2));
}
}
return tokens.length >= 32;
});
if (!tokens.length && normalized) addToken(normalized);
return tokens;
}
function decodeSearchBits(value) {
if (!value) return null;
try {
const binary = atob(value);
return Uint8Array.from(binary, character => character.charCodeAt(0));
} catch (error) {
return null;
}
}
async function hashSearchTokens(tokens) {
if (!globalThis.crypto || !globalThis.crypto.subtle) return new Map();
const encoder = new TextEncoder();
const entries = await Promise.all(tokens.map(async token => {
const digest = await globalThis.crypto.subtle.digest('SHA-256', encoder.encode(token));
const view = new DataView(digest);
return [token, Array.from({ length: 5 }, (_, index) => view.getUint32(index * 4, false))];
}));
return new Map(entries);
}
function bloomIncludes(item, hashes) {
const bits = item._searchBits;
const size = Number(item.searchSize) || 0;
if (!bits || !size || !hashes) return false;
return hashes.every(hash => {
const position = hash % size;
return Boolean(bits[position >> 3] & (1 << (position & 7)));
});
}
function scoreSearchItem(item, rawQuery, tokens, tokenHashes) {
const title = item._searchTitle ?? normalizeSearchText(item.title);
const moduleName = item._searchModule ?? normalizeSearchText(item.module);
const date = item._searchDate ?? normalizeSearchText(item.date);
const phrase = normalizeSearchText(rawQuery).slice(0, 200);
let score = 1;
const matched = new Set();
let phraseHit = false;
const fields = [
[title, { exact: 800, phrase: 360, token: 150 }],
[moduleName, { exact: 120, phrase: 110, token: 55 }],
[date, { exact: 80, phrase: 70, token: 35 }],
];
fields.forEach(([field, weights]) => {
if (phrase && field.includes(phrase)) {
phraseHit = true;
score += weights.phrase;
if (field === phrase) score += weights.exact;
}
tokens.forEach(token => {
if (field.includes(token)) {
matched.add(token);
score += weights.token;
}
});
});
tokens.forEach(token => {
if (bloomIncludes(item, tokenHashes.get(token))) {
matched.add(token);
score += 14;
}
});
if (!phraseHit && matched.size === 0) return 0;
if (tokens.length) {
const coverage = matched.size / tokens.length;
score += Math.round(coverage * 80);
if (matched.size === tokens.length) score += 80;
else if (tokens.length >= 3 && matched.size >= 2) score += 30;
}
if (phraseHit) score += 70;
if (item.sticky) score += 5;
return score;
}
function loadSearchIndex() {
if (!searchIndexPromise) {
searchIndexPromise = fetch('data/search-index.json?v=5f95898f8800')
.then(res => {
if (!res.ok) throw new Error(`Search index returned ${res.status}`);
return res.json();
})
.then(items => items.map(item => ({
...item,
_searchTitle: normalizeSearchText(item.title),
_searchModule: normalizeSearchText(item.module),
_searchDate: normalizeSearchText(item.date),
_searchBits: decodeSearchBits(item.searchBits),
})))
.catch(error => {
searchIndexPromise = null;
throw error;
});
}
return searchIndexPromise;
}
async function searchArticles(rawQuery, limit = 8) {
const articlesMeta = await loadSearchIndex();
const tokens = tokenizeSearchQuery(rawQuery);
const tokenHashes = await hashSearchTokens(tokens);
return articlesMeta
.map(item => ({ item, score: scoreSearchItem(item, rawQuery, tokens, tokenHashes) }))
.filter(entry => entry.score > 0)
.sort((a, b) => b.score - a.score || String(b.item.date || '').localeCompare(String(a.item.date || '')))
.slice(0, limit)
.map(entry => entry.item);
}
function initSearch() {
const input = document.getElementById('global-search');
const suggestions = document.getElementById('suggestions');
const clearBtn = document.querySelector('.clear-btn');
const searchContainer = document.querySelector('.search-container');
const searchWrapper = document.querySelector('.search-wrapper');
if (!input) return;
let activeSuggestion = -1;
let searchRequestId = 0;
function setSuggestionsOpen(open) {
suggestions.style.display = open ? 'block' : 'none';
input.setAttribute('aria-expanded', String(open));
if (!open) {
activeSuggestion = -1;
input.removeAttribute('aria-activedescendant');
suggestions.querySelectorAll('.suggestion-item').forEach(item => item.setAttribute('aria-selected', 'false'));
}
}
function moveSuggestion(direction) {
const items = Array.from(suggestions.querySelectorAll('.suggestion-item'));
if (!items.length) return;
activeSuggestion = (activeSuggestion + direction + items.length) % items.length;
items.forEach((item, index) => item.setAttribute('aria-selected', String(index === activeSuggestion)));
const selected = items[activeSuggestion];
input.setAttribute('aria-activedescendant', selected.id);
selected.scrollIntoView({ block: 'nearest' });
}
let searchTimer = null;
input.addEventListener('input', function(e) {
const keyword = e.target.value.trim().toLowerCase().slice(0, 200);
const requestId = ++searchRequestId;
clearTimeout(searchTimer);
setSuggestionsOpen(false);
if (!keyword) {
searchContainer.classList.remove('has-text');
suggestions.removeAttribute('aria-busy');
return;
}
searchContainer.classList.add('has-text');
suggestions.setAttribute('aria-busy', 'true');
searchTimer = setTimeout(async () => {
let matches = [];
try {
matches = await searchArticles(keyword, 8);
} catch (err) {
console.error('搜索失败', err);
}
if (requestId !== searchRequestId || input.value.trim().toLowerCase() !== keyword) return;
suggestions.removeAttribute('aria-busy');
if (matches.length === 0) {
setSuggestionsOpen(false);
return;
}
suggestions.innerHTML = matches.map((item, index) =>
`<a class="suggestion-item" id="search-option-${index}" role="option" aria-selected="false" tabindex="-1" href="article/${encodeURIComponent(item.title)}.html">
<span class="suggestion-main">
<span class="suggestion-title">${escapeHtml(item.title)}</span>
<span class="suggestion-excerpt">${escapeHtml(item.excerpt || item.module || '')}</span>
</span>
<span class="suggestion-date">${escapeHtml(item.module || '')} · ${escapeHtml(item.date || '')}</span>
</a>`
).join('');
activeSuggestion = -1;
setSuggestionsOpen(true);
}, 140);
});
input.addEventListener('keydown', function(e) {
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
if (suggestions.style.display !== 'block') return;
e.preventDefault();
moveSuggestion(e.key === 'ArrowDown' ? 1 : -1);
} else if (e.key === 'Enter' && activeSuggestion >= 0) {
e.preventDefault();
suggestions.querySelectorAll('.suggestion-item')[activeSuggestion]?.click();
} else if (e.key === 'Escape') {
setSuggestionsOpen(false);
}
});
if (clearBtn) {
clearBtn.addEventListener('click', function() {
input.value = '';
searchContainer.classList.remove('has-text');
setSuggestionsOpen(false);
input.focus();
});
}
document.addEventListener('click', (e) => {
if (!searchWrapper.contains(e.target)) {
setSuggestionsOpen(false);
}
});
searchWrapper.addEventListener('focusout', function() {
requestAnimationFrame(() => {
if (!searchWrapper.contains(document.activeElement)) setSuggestionsOpen(false);
});
});
}
initSearch();
const visitorSpan = document.getElementById('visitor-count');
if (visitorSpan) {
visitorSpan.style.display = 'none';
}
}());
</script>
</body>
</html>