Fixes translate.js

This commit is contained in:
Yang Lin 2016-11-25 01:15:27 +08:00
parent 13d24316a5
commit ebad4e1d1b
4 changed files with 65 additions and 18 deletions

View File

@ -1163,11 +1163,9 @@ a#lazy-load
* `HeroModule`和`CrisisModule`会被惰性加载。
<a id="app-component-template"></a>
<a id="app-component-template"></a>
Let's start at the top with the new `AppComponent` template: a title, three links, and a `<router-outlet>`.
<a id="app-component-template"></a>
我们从这个`AppComponent`新模板的顶部看起:标题、三个链接和`<router-outlet>`。
+makeExample('ngmodule/ts/app/app.component.3.ts', 'template', 'app/app.component.ts (v3 - Template)')(format='.')

View File

@ -38,21 +38,27 @@
ul
li
a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") Angular Modules
li
a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") Angular模块
li
a(href="/docs/#{lang}/#{vers}/guide/animations.html") Animations
li
a(href="/docs/#{lang}/#{vers}/guide/animations.html") 动画
li
a(href="/docs/#{lang}/#{vers}/guide/attribute-directives.html") Attribute Directives
li
a(href="/docs/#{lang}/#{vers}/guide/attribute-directives.html") 属性型指令
li
a(href="/docs/#{lang}/#{vers}/guide/browser-support.html") Browser Support
li
a(href="/docs/#{lang}/#{vers}/guide/browser-support.html") 浏览器支持
li
a(href="/docs/#{lang}/#{vers}/guide/component-styles.html") Component Styles
li
a(href="/docs/#{lang}/#{vers}/guide/component-styles.html") 组件样式
li
a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") View All...
li
a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") 查看全部……
.c4.secondary-content-list
@ -61,21 +67,27 @@
ul
li
a(href="/docs/#{lang}/#{vers}/cookbook/aot-compiler.html") Ahead-of-Time Compilation
li
a(href="/docs/#{lang}/#{vers}/cookbook/aot-compiler.html") 预编译
li
a(href="/docs/#{lang}/#{vers}/cookbook/a1-a2-quick-reference.html") Angular 1 to Angular 2
li
a(href="/docs/#{lang}/#{vers}/cookbook/a1-a2-quick-reference.html") Angular 1迁移到Angular 2
li
a(href="/docs/#{lang}/#{vers}/cookbook/ngmodule-faq.html") Angular Module FAQ
li
a(href="/docs/#{lang}/#{vers}/cookbook/ngmodule-faq.html") Angular模块FAQ
li
a(href="/docs/#{lang}/#{vers}/cookbook/component-communication.html") Component Interaction
li
a(href="/docs/#{lang}/#{vers}/cookbook/component-communication.html") 组件交互
li
a(href="/docs/#{lang}/#{vers}/cookbook/component-relative-paths.html") Component-Relative Paths
li
a(href="/docs/#{lang}/#{vers}/cookbook/component-relative-paths.html") 相对于组件的路径
li
a(href="/docs/#{lang}/#{vers}/cookbook/") View All...
li
a(href="/docs/#{lang}/#{vers}/cookbook/") 查看全部...
.c4.secondary-content-list
@ -84,10 +96,15 @@
ul
li
a(target="_blank" href="https://github.com/angular/universal") Angular Universal
li
a(target="_blank" href="https://github.com/angular/universal") Angular Universal
li
a(target="_blank" href="https://augury.angular.io/") Augury
li
a(target="_blank" href="https://augury.angular.io/") Augury
li
a(target="_blank" href="https://github.com/jaxio/celerio-angular-quickstart") Celerio Angular Quickstart
li
a(target="_blank" href="https://github.com/jaxio/celerio-angular-quickstart") Celerio Angular快速起步
li
a(target="_blank" href="https://github.com/mgechev/codelyzer") Codelyzer
@ -95,4 +112,5 @@
a(target="_blank" href="https://github.com/johnpapa/lite-server") Lite-server
li
a(target="_blank" href="/resources/") View All...
li
a(target="_blank" href="/resources/") 查看全部……

View File

@ -28,10 +28,26 @@
margin-top: -($unit * 3);
}
.card {
height: auto;
min-height: 194px;
h2.original-english {
margin-top: $unit;
padding-top: $unit;
}
p.original-english {
margin-top: 0;
}
}
li {
p {
margin: 0;
}
ul {
margin: 0;
}
}
}

View File

@ -22,6 +22,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
* @param container
*/
function processContainer(container) {
var count = 0;
for (var i = 0; i < container.children.length; i++) {
var node = container.children[i];
@ -40,35 +41,43 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
case 'H5':
case 'H6':
case 'HEADER':
count++;
if (processBlock(node)) {
i++;
}
break;
case 'LI':
if($(node).find('p').length <= 1){
if (processBlock(node)) {
i++;
}
count++;
}
break;
case 'TD':
case 'TH':
case 'UL':
case 'OL':
processContainer(node);
// return; // stop
break;
default:
if (node.innerText === 'Back to top') {
var x = 0;
}
if (node.children.length > 0) {
processContainer(node);
// For <li><p>...</p></li>, processes it as block.
// if (node.children.length === 1) {
// if (processBlock(node)) {
// i++;
// }
// }
if (processContainer(node) <= 1) {
if (processBlock(node)) {
i++;
}
} else {
count++;
}
} else {
if (node.tagName === 'A' && node.classList.contains('to-top')) {
if (processBlock(node)) {
i++;
}
}
}
break;
}
}
return count;
}
/**
@ -83,13 +92,19 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
var $sibling = $(sibling);
if (sibling) {
if (sibling.tagName === 'LI') {
processBlock(sibling);
}
if (isClonedNode(current, sibling)) {
if (isPureEnglish(current.textContent)) {
$current.addClass('original-english');
$sibling.addClass('translated');
$sibling.addClass('translated-cn');
$sibling.after($current);
$sibling.on('click', function () {
$sibling.on('click', function (event) {
// for nested structure.
event.stopPropagation();
$current.toggleClass('hidden');
});
return true;