From 5e4b811ff40e3b7a7282e26fe4f4636ce4f56e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A9=98?= Date: Thu, 16 Apr 2026 04:32:32 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BA=BA=E5=90=8D=E4=B9=9F=E4=B8=80?= =?UTF-8?q?=E8=B5=B7=20toggle=EF=BC=8C=E7=94=A8=E5=8E=9F=E6=96=87=E8=A5=BF?= =?UTF-8?q?=E6=96=87=E7=BD=B2=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/js/quote-translate.js | 14 +++++++++----- docs/shared/new-saas-revolution.md | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/docs/js/quote-translate.js b/docs/js/quote-translate.js index 0d425b3..d19b224 100644 --- a/docs/js/quote-translate.js +++ b/docs/js/quote-translate.js @@ -1,17 +1,21 @@ document.addEventListener('DOMContentLoaded', function () { document.querySelectorAll('blockquote[data-cn]').forEach(function (el) { + const orig = el.getAttribute('data-orig'); const cn = el.getAttribute('data-cn'); - // 找第一个文本节点(引言正文),存原文 - const textNode = Array.from(el.childNodes).find(n => n.nodeType === Node.TEXT_NODE && n.textContent.trim()); - if (!textNode) return; - const original = textNode.textContent; let showing = 'orig'; function swap(to) { - textNode.textContent = to === 'cn' ? cn + '\n' : original; + const text = to === 'cn' ? cn : orig; + // 清空并重建文本内容,保留换行 + el.innerHTML = text.split(' ').join('\n') + .split('\n').map((line, i, arr) => { + if (i === arr.length - 1 && line === '') return ''; + return line; + }).join('
'); showing = to; } + el.style.cursor = 'pointer'; el.addEventListener('mouseenter', () => swap('cn')); el.addEventListener('mouseleave', () => swap('orig')); el.addEventListener('click', (e) => { diff --git a/docs/shared/new-saas-revolution.md b/docs/shared/new-saas-revolution.md index fd7d2cd..9dbf5ac 100644 --- a/docs/shared/new-saas-revolution.md +++ b/docs/shared/new-saas-revolution.md @@ -13,18 +13,18 @@ echo "of the human, by the human, for the human" | sed 's/human/AI/g' --- -
+
Umwertung aller Werte. -— 尼采 +— Nietzsche
--- -
+
Die Proletarier haben nichts in ihr zu verlieren als ihre Ketten. Sie haben eine Welt zu gewinnen. -— 马克思 +— Marx
--- @@ -37,26 +37,26 @@ Die Proletarier haben nichts in ihr zu verlieren als ihre Ketten. Sie haben eine --- -
+
I have a dream, today. -— 马丁·路德·金 +— Martin Luther King Jr.
--- -
+
of the people, by the people, for the people. -— 林肯 +— Lincoln
--- -
+
Hasta la victoria siempre. -— 切·格瓦拉 +— Che Guevara
---