From ace23ceadc8bde425a97d246385060477fa98ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A9=98?= Date: Thu, 16 Apr 2026 04:34:47 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=9F=E5=9C=B0=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E8=8A=82=E7=82=B9=EF=BC=8C=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=20HTML=20=E7=BB=93=E6=9E=84=E4=B8=8D=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/js/quote-translate.js | 26 +++++++++---------- docs/shared/new-saas-revolution.md | 40 +++++++++++++----------------- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/docs/js/quote-translate.js b/docs/js/quote-translate.js index d19b224..74cfe63 100644 --- a/docs/js/quote-translate.js +++ b/docs/js/quote-translate.js @@ -1,26 +1,26 @@ 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 cn = el.getAttribute('data-cn').split('|'); + // 收集所有文本节点 + const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT); + const nodes = []; + while (walker.nextNode()) nodes.push(walker.currentNode); + // 存原文 + const orig = nodes.map(n => n.textContent); let showing = 'orig'; function swap(to) { - 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('
'); + if (to === 'cn') { + cn.forEach((text, i) => { if (nodes[i]) nodes[i].textContent = text; }); + } else { + orig.forEach((text, i) => { if (nodes[i]) nodes[i].textContent = text; }); + } showing = to; } el.style.cursor = 'pointer'; el.addEventListener('mouseenter', () => swap('cn')); el.addEventListener('mouseleave', () => swap('orig')); - el.addEventListener('click', (e) => { - e.preventDefault(); - swap(showing === 'orig' ? 'cn' : 'orig'); - }); + el.addEventListener('click', () => swap(showing === 'orig' ? 'cn' : 'orig')); }); }); diff --git a/docs/shared/new-saas-revolution.md b/docs/shared/new-saas-revolution.md index 9dbf5ac..e6a7f05 100644 --- a/docs/shared/new-saas-revolution.md +++ b/docs/shared/new-saas-revolution.md @@ -13,50 +13,44 @@ echo "of the human, by the human, for the human" | sed 's/human/AI/g' --- -
-Umwertung aller Werte. - -— Nietzsche +
+

Umwertung aller Werte.

+

— Nietzsche

--- -
-Die Proletarier haben nichts in ihr zu verlieren als ihre Ketten. Sie haben eine Welt zu gewinnen. - -— Marx +
+

Die Proletarier haben nichts in ihr zu verlieren als ihre Ketten. Sie haben eine Welt zu gewinnen.

+

— Marx

---
-枪杆子里面出政权。 - -— 毛泽东 +

枪杆子里面出政权。

+

— 毛泽东

--- -
-I have a dream, today. - -— Martin Luther King Jr. +
+

I have a dream, today.

+

— Martin Luther King Jr.

--- -
-of the people, by the people, for the people. - -— Lincoln +
+

of the people, by the people, for the people.

+

— Lincoln

--- -
-Hasta la victoria siempre. - -— Che Guevara +
+

Hasta la victoria siempre.

+

— Che Guevara

---