fix:
1. not yet translated articles 2. pure english in th and td.
This commit is contained in:
parent
3b5d85c524
commit
9e92f38e7e
|
@ -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) {
|
||||||
|
@ -92,7 +92,6 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
||||||
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;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue