Merge branch 'master' into merge-26-11-16

# Conflicts:
#	public/translate/cn/translate.js
This commit is contained in:
rexebin 2016-11-27 11:41:50 +00:00
commit e7caa4d947
1 changed files with 6 additions and 7 deletions

View File

@ -4,7 +4,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
var content = document.querySelector('article'); var content = document.querySelector('article');
var footer = document.querySelector('.main-footer'); var footer = document.querySelector('.main-footer');
processContainer(content); processContainer(content, true);
processContainer(footer); processContainer(footer);
if (!sourceVisible) { if (!sourceVisible) {
@ -24,8 +24,8 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
* Process container recursively. * Process container recursively.
* @param container * @param container
*/ */
function processContainer(container) { function processContainer(container, isContent) {
if (!container) { if (!container || (isContent && isPureEnglish(container.textContent))) {
return; return;
} }
var count = 0; var count = 0;
@ -58,7 +58,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
case 'UL': case 'UL':
case 'OL': case 'OL':
case 'DIV': case 'DIV':
processContainer(node); processContainer(node, ['TD','TH'].indexOf(node.tagName)!== -1);
break; break;
default: default:
if (processContainer(node) <= 1) { if (processContainer(node) <= 1) {
@ -91,8 +91,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
if (isPureEnglish(current.textContent)) { if (isPureEnglish(current.textContent)) {
if (sibling.children) { if (sibling.children) {
processContainer(sibling); processContainer(sibling);
} }
if(!isPureEnglish(sibling.textContent)){
$current.addClass('original-english'); $current.addClass('original-english');
$sibling.addClass('translated'); $sibling.addClass('translated');
$sibling.addClass('translated-cn'); $sibling.addClass('translated-cn');
@ -104,7 +103,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
}); });
// addSpacingBetweenCnAndEn(sibling); // addSpacingBetweenCnAndEn(sibling);
return true; return true;
}
} }
} }