fix a few translate.js bugs.
This commit is contained in:
parent
63f1414c7d
commit
cf32bc26c8
|
@ -1,4 +1,4 @@
|
|||
.docs-content {
|
||||
.docs-content, .l-content, .main-footer {
|
||||
display: none;
|
||||
.original-english {
|
||||
border-top: 1px dashed $regal;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// TODO: refactor me!
|
||||
var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
||||
(function ($) {
|
||||
var content = document.querySelector('article.docs-content');
|
||||
var content = document.querySelector('article');
|
||||
var footer = document.querySelector('.main-footer');
|
||||
|
||||
processContainer(content);
|
||||
processContainer(footer);
|
||||
|
||||
if (!sourceVisible) {
|
||||
var nodes = document.querySelectorAll('.original-english');
|
||||
|
@ -40,6 +40,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
|||
case 'H5':
|
||||
case 'H6':
|
||||
case 'HEADER':
|
||||
case 'LI':
|
||||
if (processBlock(node)) {
|
||||
i++;
|
||||
}
|
||||
|
@ -47,7 +48,8 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
|||
case 'TD':
|
||||
case 'TH':
|
||||
processContainer(node);
|
||||
return; // stop
|
||||
// return; // stop
|
||||
break;
|
||||
default:
|
||||
if (node.children.length > 0) {
|
||||
processContainer(node);
|
||||
|
@ -81,7 +83,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
|||
$sibling.addClass('translated');
|
||||
$sibling.addClass('translated-cn');
|
||||
$sibling.after($current);
|
||||
$sibling.on('click', function() {
|
||||
$sibling.on('click', function () {
|
||||
$current.toggleClass('hidden');
|
||||
});
|
||||
return true;
|
||||
|
@ -95,8 +97,12 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
|||
}
|
||||
|
||||
function isPureEnglish(text) {
|
||||
if(text){
|
||||
return !/\p{Han}/.test(text);
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
function attributesToString(node) {
|
||||
return _.chain(node.attributes)
|
||||
|
|
Loading…
Reference in New Issue