From b5486dff729d87d51b7f57f3b40ce26cdee60de6 Mon Sep 17 00:00:00 2001 From: rexebin Date: Thu, 24 Nov 2016 19:55:45 +0000 Subject: [PATCH] fix code tag and IsPureEnglish --- public/translate/cn/translate.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/translate/cn/translate.js b/public/translate/cn/translate.js index e598f8ef1b..c14015ad2c 100644 --- a/public/translate/cn/translate.js +++ b/public/translate/cn/translate.js @@ -29,7 +29,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true'; // ignore example code. if (node.classList.contains('code-example') || node.tagName === 'CODE-EXAMPLE' || - node.tagName === 'SCRIPT') { + node.tagName === 'SCRIPT' || node.tagName === 'CODE') { continue; } @@ -107,7 +107,8 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true'; function isPureEnglish(text) { if(text){ - return !/\p{Han}/.test(text); + text = text.replace('在线例子', ''); + return /^[\1-\255—’“”ç®…à\u200B]*$/.test(text); } return false;