增加误判的英文字符

重构名称
This commit is contained in:
Zhicheng Wang 2016-05-13 15:37:56 +08:00
parent 478ead7d4d
commit f9fe9094e4
1 changed files with 4 additions and 4 deletions

View File

@ -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);
}
})();