From 045c39e1145fda695da243d70e221588f6549567 Mon Sep 17 00:00:00 2001 From: WingChunWong Date: Sun, 1 Mar 2026 11:25:07 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E9=87=8D=E6=9E=84=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=AD=98=E5=82=A8=E6=94=AF=E6=8C=81=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=8E=92=E5=BA=8F=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 69 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index e5049b5..9c40de7 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,24 @@ --- -
+ + +
排序:
@@ -37,10 +54,35 @@

{{ post.title }}

\ No newline at end of file From 7546978a8302ea4ff7dcee620c70f5350c2b281f Mon Sep 17 00:00:00 2001 From: WingChunWong Date: Sun, 1 Mar 2026 11:26:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E6=B3=A8=E9=87=8A=EF=BC=8C=E4=BC=98=E5=8C=96=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E9=80=BB=E8=BE=91=E7=9A=84=E4=BB=A3=E7=A0=81=E5=8F=AF?= =?UTF-8?q?=E8=AF=BB=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/index.html b/index.html index 9c40de7..38259dd 100644 --- a/index.html +++ b/index.html @@ -80,7 +80,6 @@

{{ post.title }}

try { window.localStorage.setItem(STORAGE_KEY, value); } catch (err) { - // localStorage 在某些隐私模式下不可用,忽略即可 } } @@ -104,18 +103,15 @@

{{ post.title }}

const dateB = parseInt(b.dataset.date, 10); const dateDiff = sortType === 'newest' ? dateB - dateA : dateA - dateB; if (dateDiff !== 0) return dateDiff; - // 同日期时用链接做次级排序,保证顺序稳定 const linkA = a.querySelector('a')?.getAttribute('href') || ''; const linkB = b.querySelector('a')?.getAttribute('href') || ''; return sortType === 'newest' ? linkB.localeCompare(linkA) : linkA.localeCompare(linkB); }); - // 重新排列 DOM 元素(使用 DocumentFragment 减少重排) const frag = document.createDocumentFragment(); articles.forEach(article => frag.appendChild(article)); postList.appendChild(frag); } - // 初始化:优先使用 localStorage,否则默认按最早排序 const saved = safeGetSort(); const initialValue = saved || 'oldest'; setActiveButton(initialValue); From ba417fb78c10a2c1b7e5b6b0c1c743c5520e98e6 Mon Sep 17 00:00:00 2001 From: WingChunWong Date: Sun, 1 Mar 2026 11:28:13 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE=E4=BF=9D=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E8=8E=B7=E5=8F=96=E7=9A=84=E5=AE=89=E5=85=A8=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 38259dd..b1abf4b 100644 --- a/index.html +++ b/index.html @@ -103,8 +103,10 @@

{{ post.title }}

const dateB = parseInt(b.dataset.date, 10); const dateDiff = sortType === 'newest' ? dateB - dateA : dateA - dateB; if (dateDiff !== 0) return dateDiff; - const linkA = a.querySelector('a')?.getAttribute('href') || ''; - const linkB = b.querySelector('a')?.getAttribute('href') || ''; + const anchorA = a.querySelector('a'); + const anchorB = b.querySelector('a'); + const linkA = anchorA ? (anchorA.getAttribute('href') || '') : ''; + const linkB = anchorB ? (anchorB.getAttribute('href') || '') : ''; return sortType === 'newest' ? linkB.localeCompare(linkA) : linkA.localeCompare(linkB); }); const frag = document.createDocumentFragment();