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