diff --git a/docs/js/quote-translate.js b/docs/js/quote-translate.js index 8684803..0d425b3 100644 --- a/docs/js/quote-translate.js +++ b/docs/js/quote-translate.js @@ -1,13 +1,22 @@ document.addEventListener('DOMContentLoaded', function () { document.querySelectorAll('blockquote[data-cn]').forEach(function (el) { const cn = el.getAttribute('data-cn'); - const tip = document.createElement('div'); - tip.className = 'quote-cn'; - tip.textContent = cn; - el.appendChild(tip); + // 找第一个文本节点(引言正文),存原文 + 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'; - el.addEventListener('mouseenter', () => tip.classList.add('show')); - el.addEventListener('mouseleave', () => tip.classList.remove('show')); - el.addEventListener('click', () => tip.classList.toggle('show')); + function swap(to) { + textNode.textContent = to === 'cn' ? cn + '\n' : original; + showing = to; + } + + el.addEventListener('mouseenter', () => swap('cn')); + el.addEventListener('mouseleave', () => swap('orig')); + el.addEventListener('click', (e) => { + e.preventDefault(); + swap(showing === 'orig' ? 'cn' : 'orig'); + }); }); }); diff --git a/docs/shared/new-saas-revolution.md b/docs/shared/new-saas-revolution.md index 482c4e5..fd7d2cd 100644 --- a/docs/shared/new-saas-revolution.md +++ b/docs/shared/new-saas-revolution.md @@ -45,7 +45,7 @@ I have a dream, today. --- -
+
of the people, by the people, for the people. — 林肯