Skip to content

Commit 947f476

Browse files
committed
feat: update translation
1 parent 960aa19 commit 947f476

File tree

18 files changed

+43
-54
lines changed

18 files changed

+43
-54
lines changed

2-ui/2-events/01-introduction-browser-events/07-carousel/solution.view/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div id="carousel" class="carousel">
1111
<button class="arrow prev"></button>
1212
<div class="gallery">
13-
<ul class="images">
13+
<ul>
1414
<li><img src="https://en.js.cx/carousel/1.png"></li>
1515
<li><img src="https://en.js.cx/carousel/2.png"></li>
1616
<li><img src="https://en.js.cx/carousel/3.png"></li>

2-ui/2-events/03-event-delegation/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# 事件委托
33

4-
捕获和冒泡允许我们实现一种被称为 **事件委托** 的强大的事件处理模式
4+
捕获和冒泡允许我们实现最强大的事件处理模式之一,即 **事件委托** 模式
55

66
这个想法是,如果我们有许多以类似方式处理的元素,那么就不必为每个元素分配一个处理程序 —— 而是将单个处理程序放在它们的共同祖先上。
77

2-ui/2-events/04-default-browser-action/3-image-gallery/solution.view/gallery.css

-10
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ body {
44
font: 75%/120% sans-serif;
55
}
66

7-
h2 {
8-
font: bold 190%/100% sans-serif;
9-
margin: 0 0 .2em;
10-
}
11-
12-
h2 em {
13-
font: normal 80%/100% sans-serif;
14-
color: #999999;
15-
}
16-
177
#largeImg {
188
border: solid 1px #ccc;
199
width: 550px;

2-ui/2-events/04-default-browser-action/3-image-gallery/source.view/gallery.css

+10-11
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ body {
44
font: 75%/120% sans-serif;
55
}
66

7-
h2 {
8-
font: bold 190%/100% sans-serif;
9-
margin: 0 0 .2em;
10-
}
11-
12-
h2 em {
13-
font: normal 80%/100% sans-serif;
14-
color: #999999;
15-
}
16-
177
#largeImg {
188
border: solid 1px #ccc;
199
width: 550px;
@@ -32,4 +22,13 @@ h2 em {
3222

3323
#thumbs a:hover {
3424
border-color: #FF9900;
35-
}
25+
}
26+
27+
#thumbs li {
28+
list-style: none;
29+
}
30+
31+
#thumbs {
32+
margin: 0;
33+
padding: 0;
34+
}

2-ui/2-events/05-dispatch-events/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ alert(event.clientX); // undefined,未知的属性被忽略了!
266266
</script>
267267
```
268268

269-
现在,`dispatchEvent` 在当前代码执行完成之后异步运行,包括 `mouse.onclick`,因此,事件处理程序是完全独立的。
269+
现在,`dispatchEvent` 在当前代码执行完成之后异步运行,包括 `menu.onclick`,因此,事件处理程序是完全独立的。
270270

271271
输出顺序变成:1 -> 2 -> nested。
272272

2-ui/3-event-details/1-mouse-events-basics/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
4242
在测试台下面记录了所有的鼠标事件,如果它们之间的延迟时间超过 1 秒,那么它们会被水平分割线分开。
4343
44-
我们还可以看出 `button` 属性允许检测鼠标按钮,演示示例如下。
44+
我们还可以看出 `button` 属性允许检测鼠标按键,演示示例如下。
4545
46-
<input onmousedown="return logMouse(event)" onmouseup="return logMouse(event)" onclick="return logMouse(event)" oncontextmenu="return logMouse(event)" ondblclick="return logMouse(event)" value="Click me with the right or the left mouse button" type="button"> <input onclick="logClear('test')" value="Clear" type="button"> <form id="testform" name="testform"> <textarea style="font-size:12px;height:150px;width:360px;"></textarea></form>
46+
<input onmousedown="return logMouse(event)" onmouseup="return logMouse(event)" onclick="return logMouse(event)" oncontextmenu="return logMouse(event)" ondblclick="return logMouse(event)" value="使用鼠标左键或右键点击我" type="button"> <input onclick="logClear('test')" value="Clear" type="button"> <form id="testform" name="testform"> <textarea style="font-size:12px;height:150px;width:360px;"></textarea></form>
4747
```
4848

4949
## 鼠标按钮

2-ui/3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/1-behavior-nested-tooltip/solution.view/index.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<style>
77
body {
88
height: 2000px;
9-
/* the tooltip should work after page scroll too */
9+
/* 在页面滚动后,工具提示也应该正常展示 */
1010
}
1111

1212
.tooltip {
@@ -49,16 +49,16 @@
4949
<body>
5050

5151

52-
<div data-tooltip="Here is the house interior" id="house">
53-
<div data-tooltip="Here is the roof" id="roof"></div>
52+
<div data-tooltip="这是房子的内部" id="house">
53+
<div data-tooltip="这里是屋顶" id="roof"></div>
5454

55-
<p>Once upon a time there was a mother pig who had three little pigs.</p>
55+
<p>从前有一个猪妈妈,她养了三只小猪。</p>
5656

57-
<p>The three little pigs grew so big that their mother said to them, "You are too big to live here any longer. You must go and build houses for yourselves. But take care that the wolf does not catch you."
57+
<p>三只小猪长得很快快,妈妈对它们说:“你们太大了,不能住在这里了,你们自己去盖房子吧,但要小心不要让狼抓到你们。</p>
5858

59-
<p>The three little pigs set off. "We will take care that the wolf does not catch us," they said.</p>
59+
<p>三只小猪出发了。 “我们会注意不要让狼抓住我们,”他们说。</p>
6060

61-
<p>Soon they met a man. <a href="https://en.wikipedia.org/wiki/The_Three_Little_Pigs" data-tooltip="Read on…">Hover over me</a></p>
61+
<p>很快,它们遇到了一个男人。<a href="https://en.wikipedia.org/wiki/The_Three_Little_Pigs" data-tooltip="继续阅读...">鼠标悬浮在我上</a></p>
6262

6363
</div>
6464

2-ui/3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/1-behavior-nested-tooltip/source.view/index.html

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<style>
77
body {
88
height: 2000px;
9-
/* the tooltip should work after page scroll too */
9+
/* 在页面滚动后,工具提示也应该正常展示 */
1010
}
1111

1212
.tooltip {
@@ -49,21 +49,21 @@
4949
<body>
5050

5151

52-
<div data-tooltip="Here is the house interior" id="house">
53-
<div data-tooltip="Here is the roof" id="roof"></div>
52+
<div data-tooltip="这是房子的内部" id="house">
53+
<div data-tooltip="这里是屋顶" id="roof"></div>
5454

55-
<p>Once upon a time there was a mother pig who had three little pigs.</p>
55+
<p>从前有一个猪妈妈,她养了三只小猪。</p>
5656

57-
<p>The three little pigs grew so big that their mother said to them, "You are too big to live here any longer. You must go and build houses for yourselves. But take care that the wolf does not catch you."
57+
<p>三只小猪长得很快快,妈妈对它们说:“你们太大了,不能住在这里了,你们自己去盖房子吧,但要小心不要让狼抓到你们。</p>
5858

59-
<p>The three little pigs set off. "We will take care that the wolf does not catch us," they said.</p>
59+
<p>三只小猪出发了。 “我们会注意不要让狼抓住我们,”他们说。</p>
6060

61-
<p>Soon they met a man. <a href="https://en.wikipedia.org/wiki/The_Three_Little_Pigs" data-tooltip="Read on…">Hover over me</a></p>
61+
<p>很快,它们遇到了一个男人。<a href="https://en.wikipedia.org/wiki/The_Three_Little_Pigs" data-tooltip="继续阅读...">鼠标悬浮在我上</a></p>
6262

6363
</div>
6464

6565
<script>
66-
// ...your code...
66+
// ...你的代码...
6767
</script>
6868

6969
</body>

2-ui/3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/1-behavior-nested-tooltip/task.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ importance: 5
1313
例如:
1414

1515
```html
16-
<div data-tooltip="Here – is the house interior" id="house">
17-
<div data-tooltip="Here – is the roof" id="roof"></div>
16+
<div data-tooltip="这是房子的内部" id="house">
17+
<div data-tooltip="这里是屋顶" id="roof"></div>
1818
...
19-
<a href="https://en.wikipedia.org/wiki/The_Three_Little_Pigs" data-tooltip="Read on…">Hover over me</a>
19+
<a href="https://en.wikipedia.org/wiki/The_Three_Little_Pigs" data-tooltip="Read on…">鼠标悬浮在我上</a>
2020
</div>
2121
```
2222

2-ui/3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/2-hoverintent/solution.view/hoverIntent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class HoverIntent {
8888
if (speed < this.sensitivity) {
8989
clearInterval(this.checkSpeedInterval);
9090
this.isHover = true;
91-
this.over.call(this.elem, event);
91+
this.over.call(this.elem);
9292
} else {
9393
// speed fast, remember new coordinates as the previous ones
9494
this.prevX = this.lastX;

2-ui/3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</div>
8181
```
8282

83-
如果我们在 `#parent` 上,然后将鼠标指针更深入地移入 `#child`但是在 `#parent` 上会得到 `mouseout`
83+
如果我们在 `#parent` 上,然后将鼠标指针更深入地移入 `#child` `#parent` 上我们会得到 `mouseout`
8484

8585
![](mouseover-to-child.svg)
8686

2-ui/3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/mouseoverout-fast.view/script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ parent.onmouseover = parent.onmouseout = parent.onmousemove = handler;
33

44
function handler(event) {
55
let type = event.type;
6-
while (type < 11) type += ' ';
6+
while (type.length < 11) type += ' ';
77

88
log(type + " target=" + event.target.id)
99
return false;

2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solution.view/soccer.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ html, body {
1010
float: left;
1111
}
1212

13-
/* heroes and the ball (dragables) */
13+
/* 英雄和球(可拖动) */
1414

1515
.hero {
1616
background: url(https://js.cx/drag-heroes/heroes.png);

2-ui/3-event-details/4-mouse-drag-and-drop/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ ball.style.top = pageY - ball.offsetHeight / 2 + 'px';
124124

125125
```js
126126
// onmousemove
127-
// 球具有 position:absoute
127+
// 球具有 position: absolute
128128
ball.style.left = event.pageX - *!*shiftX*/!* + 'px';
129129
ball.style.top = event.pageY - *!*shiftY*/!* + 'px';
130130
```

2-ui/3-event-details/7-keyboard-events/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ document.addEventListener('keydown', function(event) {
107107

108108
为了可靠地跟踪与受键盘布局影响的字符,使用 `event.key` 可能是一个更好的方式。
109109

110-
另一方面,`event.code` 的好处是,即使访问者更改了语言,绑定到物理键位置的 `event.code` 会始终保持不变。因此,即使在切换了语言的情况下,依赖于它的热键也能正常工作。
110+
另一方面,`event.code` 的好处是,绑定到物理键位置的 `event.code` 会始终保持不变。因此,即使在切换了语言的情况下,依赖于它的热键也能正常工作。
111111

112112
我们想要处理与布局有关的按键?那么 `event.key` 是我们必选的方式。
113113

2-ui/3-event-details/7-keyboard-events/keyboard-dump.view/index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@
2828

2929
<input type="text" placeholder="Press keys here" id="kinput">
3030

31-
<textarea id="area"></textarea>
31+
<textarea id="area" readonly></textarea>
3232
<input type="button" value="Clear" onclick="area.value = ''" />
3333
</form>
3434
<script src="script.js"></script>
3535

36-
3736
</body>
3837
</html>

5-network/05-fetch-crossorigin/article.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,11 @@ Access-Control-Expose-Headers: Content-Length,API-Key
207207

208208
因此,为了避免误解,任何“非标准”请求 —— 浏览器不会立即发出在过去无法完成的这类请求。即在它发送这类请求前,会先发送“预检(preflight)”请求来请求许可。
209209

210-
预检请求使用 `OPTIONS` 方法,它没有 body,但是有两个 header:
210+
预检请求使用 `OPTIONS` 方法,它没有 body,但是有三个 header:
211211

212212
- `Access-Control-Request-Method` header 带有非简单请求的方法。
213213
- `Access-Control-Request-Headers` header 提供一个以逗号分隔的非简单 HTTP-header 列表。
214+
- `Origin` header 告知了请求来自哪儿。(例如 `https://javascript.info`
214215

215216
如果服务器同意处理请求,那么它会进行响应,此响应的状态码应该为 200,没有 body,具有 header:
216217

5-network/11-websocket/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WebSocket
22

3-
[RFC 6455](http://tools.ietf.org/html/rfc6455) 规范中描述的 `WebSocket` 协议提供了一种在浏览器和服务器之间建立持久连接来交换数据的方法。数据可以作为“数据包”在两个方向上传递,而不会断开连接和其他 HTTP 请求。
3+
[RFC 6455](https://datatracker.ietf.org/doc/html/rfc6455) 规范中描述的 `WebSocket` 协议提供了一种在浏览器和服务器之间建立持久连接来交换数据的方法。数据可以作为“数据包”在两个方向上传递,而不会断开连接和其他 HTTP 请求。
44

55
对于需要连续数据交换的服务,例如网络游戏,实时交易系统等,WebSocket 尤其有用。
66

0 commit comments

Comments
 (0)