门户:在首页上改地址栏的旧地址(#/gallery、#0003…)也会跳到新页面;资源版本号 v2

Browse Source
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
yws
2026-10-06 06:22:44 +00:00
co-authored by Claude Opus 5.5
parent fd72f7192e
commit f9f406f54b
7 changed files with 37 additions and 36 deletions
+2 -1
View File
@@ -71,12 +71,13 @@
})();
/* ---------- 旧链接兼容:原来的单页版地址(#/gallery、#/universe、#0001 …)跳到对应的新页面 ---------- */
if (page === 'home' && location.hash) {
function legacy() {
var h = location.hash.replace(/^#\/?/, '').replace(/\/+$/, '');
var map = { gallery: 'gallery.html', apps: 'tools.html', universe: 'universe.html', rack: 'universe.html', links: 'links.html', about: 'about.html' };
if (map[h]) location.replace(map[h] + location.search);
else if (/^\d{4}$/.test(h)) location.replace('universe.html' + location.search + '#' + h);
}
if (page === 'home') { if (location.hash) legacy(); addEventListener('hashchange', legacy); } // 在首页上改地址栏的 # 也要跳
/* ---------- 共用小件 ---------- */
var GALLERY = (C.gallery || []).filter(function (g) { return !g.hidden; });