From f9fe9094e4fd90bcd775b810ef78f0558d873e47 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Fri, 13 May 2016 15:37:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=AF=E5=88=A4=E7=9A=84?= =?UTF-8?q?=E8=8B=B1=E6=96=87=E5=AD=97=E7=AC=A6=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/resources/js/translate.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/resources/js/translate.js b/public/resources/js/translate.js index e8d6a3c22c..ab4c356b04 100644 --- a/public/resources/js/translate.js +++ b/public/resources/js/translate.js @@ -3,7 +3,7 @@ _.each(nodes, function (node) { if (isTranslationResult(node)) { var prevNode = node.previousElementSibling; - if (prevNode && isOriginalEnglish(prevNode.innerText) && !prevNode.classList.contains('nav-list-item')) { + if (prevNode && isPureEnglish(prevNode.innerText) && !prevNode.classList.contains('nav-list-item')) { if (location.hostname === 'localhost') { prevNode.classList.add('original-english-debug'); } else { @@ -14,8 +14,8 @@ } }); - function isOriginalEnglish(text) { - return /^[\1-\255—]*$/.test(text); + function isPureEnglish(text) { + return /^[\1-\255—’]*$/.test(text); } function isClonedNode(node1, node2) { @@ -37,6 +37,6 @@ function isTranslationResult(node) { var prevNode = node.previousElementSibling; - return indexOf(node) % 2 === 1 && prevNode && isClonedNode(node, prevNode) && isOriginalEnglish(prevNode.innerText); + return indexOf(node) % 2 === 1 && prevNode && isClonedNode(node, prevNode) && isPureEnglish(prevNode.innerText); } })();