fix: 自动把中文元素的id设置为相应英文元素的
This commit is contained in:
parent
3dfa29b36d
commit
2a60ad27a7
|
@ -84,6 +84,7 @@ a(id='toc')
|
||||||
1. [Single responsibility](#single-responsibility)
|
1. [Single responsibility](#single-responsibility)
|
||||||
|
|
||||||
[单一职责](#single-responsibility)
|
[单一职责](#single-responsibility)
|
||||||
|
|
||||||
1. [Naming](#naming)
|
1. [Naming](#naming)
|
||||||
|
|
||||||
[命名](#naming)
|
[命名](#naming)
|
||||||
|
@ -95,6 +96,7 @@ a(id='toc')
|
||||||
1. [App structure and Angular modules](#application-structure-and-angular-modules)
|
1. [App structure and Angular modules](#application-structure-and-angular-modules)
|
||||||
|
|
||||||
[应用结构与 Angular 模块](#app-structure-and-angular-modules)
|
[应用结构与 Angular 模块](#app-structure-and-angular-modules)
|
||||||
|
|
||||||
1. [Components](#components)
|
1. [Components](#components)
|
||||||
|
|
||||||
[组件](#components)
|
[组件](#components)
|
||||||
|
@ -114,6 +116,7 @@ a(id='toc')
|
||||||
1. [Lifecycle hooks](#lifecycle-hooks)
|
1. [Lifecycle hooks](#lifecycle-hooks)
|
||||||
|
|
||||||
[生命周期钩子](#lifecycle-hooks)
|
[生命周期钩子](#lifecycle-hooks)
|
||||||
|
|
||||||
1. [Appendix](#appendix)
|
1. [Appendix](#appendix)
|
||||||
|
|
||||||
[附录](#appendix)
|
[附录](#appendix)
|
||||||
|
|
|
@ -30,6 +30,11 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
||||||
var prevNode = node.previousElementSibling;
|
var prevNode = node.previousElementSibling;
|
||||||
var $english = $(prevNode);
|
var $english = $(prevNode);
|
||||||
if (isCorrespondingNode(node, prevNode) && !isTranslation(prevNode.textContent)) {
|
if (isCorrespondingNode(node, prevNode) && !isTranslation(prevNode.textContent)) {
|
||||||
|
var id = $english.attr('id');
|
||||||
|
if (id) {
|
||||||
|
$translated.attr('id', id);
|
||||||
|
$english.removeAttr('id');
|
||||||
|
}
|
||||||
$translated.after($english);
|
$translated.after($english);
|
||||||
$translated.addClass('translated');
|
$translated.addClass('translated');
|
||||||
$translated.addClass('translated-cn');
|
$translated.addClass('translated-cn');
|
||||||
|
|
Loading…
Reference in New Issue