Skip to content

Commit d85be5f

Browse files
committed
up
1 parent 7b3f455 commit d85be5f

File tree

12 files changed

+47
-93
lines changed

12 files changed

+47
-93
lines changed

2-ui/1-document/07-modifying-document/5-why-aaa/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ importance: 1
22

33
---
44

5-
# Why "ааа" remains?
5+
# Why "aaa" remains?
66

77
Run the example. Why `table.remove()` does not delete the text `"aaa"`?
88

2-ui/1-document/07-modifying-document/7-create-object-tree/innerhtml.view/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
container.innerHTML = createTreeText(obj);
2828
}
2929

30-
function createTreeText(obj) { // отдельная рекурсивная функция
30+
function createTreeText(obj) { // standalone recursive function
3131
let li = '';
3232
for (let key in obj) {
3333
li += '<li>' + key + createTreeText(obj[key]) + '</li>';
@@ -38,7 +38,6 @@
3838
return ul || '';
3939
}
4040

41-
let container = document.getElementById('container');
4241
createTree(container, data);
4342
</script>
4443
</body>

2-ui/1-document/07-modifying-document/8-tree-count/solution.view/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
let lis = document.getElementsByTagName('li');
4444

4545
for (let li of lis) {
46-
// получить количество детей
47-
let childCount = li.getElementsByTagName('li').length;
48-
if (!childCount) continue;
46+
// get the count of all <li> below this <li>
47+
let descendantsCount = li.getElementsByTagName('li').length;
48+
if (!descendantsCount) continue;
4949

50-
// добавить кол-во детей к текстовому узлу
51-
li.firstChild.data += ' [' + childCount + ']';
50+
// add directly to the text node (append to the text)
51+
li.firstChild.data += ' [' + descendantsCount + ']';
5252
}
5353
</script>
5454

2-ui/1-document/08-styles-and-classes/getiecomputedstyle.view/getiecomputedstyle.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

2-ui/1-document/08-styles-and-classes/getiecomputedstyle.view/index.html

Lines changed: 0 additions & 30 deletions
This file was deleted.

2-ui/1-document/09-size-and-scroll/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ They include the content width together with paddings, but without the scrollbar
152152

153153
![](metric-client-width-height.png)
154154

155-
On the picture above let's first consider `clientHeight`: it's easier to evaluate. There's no horizontal scrollbar, so its exactly the sum of what's inside the borders: CSS-высота `200px` plus top and bottom paddings (`2*20px`) total `240px`.
155+
On the picture above let's first consider `clientHeight`: it's easier to evaluate. There's no horizontal scrollbar, so its exactly the sum of what's inside the borders: CSS-height `200px` plus top and bottom paddings (`2*20px`) total `240px`.
156156

157157
Now `clientWidth` -- here the content width is not `300px`, but `284px`, because `16px` are occupied by the scrollbbar. So the sum is `284px` plus left and right paddings, total `324px`.
158158

2-ui/1-document/10-size-and-scroll-window/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ We can do the same for the page:
9090
9191
It should work.
9292
93-
But there's a simpler, more universal solution: special methods [window.scrollBy(x,y)](mdn:api/Window/scrollBy) и [window.scrollTo(pageX,pageY)](mdn:api/Window/scrollTo).
93+
But there's a simpler, more universal solution: special methods [window.scrollBy(x,y)](mdn:api/Window/scrollBy) and [window.scrollTo(pageX,pageY)](mdn:api/Window/scrollTo).
9494
9595
- The method `scrollBy(x,y)` scrolls the page relative to its current position. For instance, `scrollBy(0,10)` scrolls the page `10px` down.
9696

2-ui/2-events/1-introduction-browser-events/01-hide-other/source.view/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
<body>
99

10-
<input type="button" id="hider" value="Нажмите, чтобы спрятать текст" />
10+
<input type="button" id="hider" value="Click to hide the text" />
1111

12-
<div id="text">Текст</div>
12+
<div id="text">Text</div>
1313

1414
<script>
15-
/* ваш код */
15+
/* your code */
1616
</script>
17-
</body>
1817

19-
</html>
18+
</body>
19+
</html>
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11

2-
1. Изменим HTML/CSS, чтобы кнопка была в нужном месте сообщения. Кнопка -- это тег `<button>`, поэтому понадобится несколько стилей.
2+
To add the button we can use either `position:absolute` (and make the pane `position:relative`) or `float:right`. The `float:right` has the benefit that the button never overlaps the text, but `position:absolute` gives more freedom. So the choice is yours.
33

4-
Расположить кнопку справа можно при помощи `position:relative` для `pane`, а для кнопки `position:absolute + right/top`. Так как `position:absolute` вынимает элемент из потока, то кнопка может частично оказаться "сверху" текста заголовка, перекрыв его конец. Чтобы этого не произошло, можно добавить `padding-right` к заголовку.
4+
Then for each pane the code can be like:
5+
```js
6+
pane.insertAdjacentHTML("afterbegin", '<button class="remove-button">[x]</button>');
7+
```
58

6-
Если использовать `float:right`, то кнопка никогда не перекроет текст. Это, пожалуй хорошо.
7-
8-
С другой стороны, потенциальным преимуществом способа с `position` по сравнению с `float` в данном случае является возможность поместить элемент кнопки в HTML *после текста*, а не до него.
9-
2. Для того, чтобы получить кнопку из контейнера, используем `querySelectorAll`. На каждую кнопку повесим обработчик, который будет убирать родителя. Найти родителя можно через `parentNode`.
9+
Then the `<button>` becomes `pane.firstChild`, so we can add a handler to it like this:
1010

11+
```js
12+
pane.firstChild.onclick = () => pane.remove();
13+
```

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
<button class="arrow prev"></button>
1212
<div class="gallery">
1313
<ul class="images">
14-
<li><img src="https://js.cx/carousel/1.png"></li>
15-
<li><img src="https://js.cx/carousel/2.png"></li>
16-
<li><img src="https://js.cx/carousel/3.png"></li>
17-
<li><img src="https://js.cx/carousel/4.png"></li>
18-
<li><img src="https://js.cx/carousel/5.png"></li>
19-
<li><img src="https://js.cx/carousel/6.png"></li>
20-
<li><img src="https://js.cx/carousel/7.png"></li>
21-
<li><img src="https://js.cx/carousel/8.png"></li>
22-
<li><img src="https://js.cx/carousel/9.png"></li>
23-
<li><img src="https://js.cx/carousel/10.png"></li>
14+
<li><img src="https://en.js.cx/carousel/1.png"></li>
15+
<li><img src="https://en.js.cx/carousel/2.png"></li>
16+
<li><img src="https://en.js.cx/carousel/3.png"></li>
17+
<li><img src="https://en.js.cx/carousel/4.png"></li>
18+
<li><img src="https://en.js.cx/carousel/5.png"></li>
19+
<li><img src="https://en.js.cx/carousel/6.png"></li>
20+
<li><img src="https://en.js.cx/carousel/7.png"></li>
21+
<li><img src="https://en.js.cx/carousel/8.png"></li>
22+
<li><img src="https://en.js.cx/carousel/9.png"></li>
23+
<li><img src="https://en.js.cx/carousel/10.png"></li>
2424
</ul>
2525
</div>
2626
<button class="arrow next"></button>

2-ui/2-events/1-introduction-browser-events/07-carousel/source.view/index.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@
77

88
<body>
99

10-
<!-- ваша верстка виджета, ваши стили -->
10+
<!-- create your markup and styles -->
1111

1212
<button class="arrow"></button>
1313
<button class="arrow"></button>
1414

1515

1616
<ul>
17-
<li><img src="https://js.cx/carousel/1.png"></li>
18-
<li><img src="https://js.cx/carousel/2.png"></li>
19-
<li><img src="https://js.cx/carousel/3.png"></li>
20-
<li><img src="https://js.cx/carousel/4.png"></li>
21-
<li><img src="https://js.cx/carousel/5.png"></li>
22-
<li><img src="https://js.cx/carousel/6.png"></li>
23-
<li><img src="https://js.cx/carousel/7.png"></li>
24-
<li><img src="https://js.cx/carousel/8.png"></li>
25-
<li><img src="https://js.cx/carousel/9.png"></li>
26-
<li><img src="https://js.cx/carousel/10.png"></li>
17+
<li><img src="https://en.js.cx/carousel/1.png"></li>
18+
<li><img src="https://en.js.cx/carousel/2.png"></li>
19+
<li><img src="https://en.js.cx/carousel/3.png"></li>
20+
<li><img src="https://en.js.cx/carousel/4.png"></li>
21+
<li><img src="https://en.js.cx/carousel/5.png"></li>
22+
<li><img src="https://en.js.cx/carousel/6.png"></li>
23+
<li><img src="https://en.js.cx/carousel/7.png"></li>
24+
<li><img src="https://en.js.cx/carousel/8.png"></li>
25+
<li><img src="https://en.js.cx/carousel/9.png"></li>
26+
<li><img src="https://en.js.cx/carousel/10.png"></li>
2727
</ul>
2828

2929

3030
<script>
31-
// label the images, just for convenience, to visually track them
31+
// label the images to visually track them, just for convenience,
3232
// this code can be removed
3333
let i = 1;
3434
for(let li of carousel.querySelectorAll('li')) {

2-ui/2-events/1-introduction-browser-events/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ For instance, to assign a `click` handler for an `input`, we can use `onclick`,
4848

4949
On mouse click, the code inside `onclick` runs.
5050

51-
Please note that inside `onclick` we use single quotes, because the attribute itself is in double quotes. If we fforget that the code is inside the attribute and use double quotes inside, like this: `onclick="alert("Клик!")"`, then it won't work right.
51+
Please note that inside `onclick` we use single quotes, because the attribute itself is in double quotes. If we fforget that the code is inside the attribute and use double quotes inside, like this: `onclick="alert("Click!")"`, then it won't work right.
5252

5353
An HTML-attribute is not a convenient place to write a lot of code, so we'd better create a JavaScript function and call it there.
5454

@@ -340,7 +340,7 @@ Here's an example of getting mouse coordinates from the event object:
340340
<script>
341341
elem.onclick = function(*!*event*/!*) {
342342
// show event type, element and coordinates of the click
343-
alert(event.type + " на " + event.currentTarget);
343+
alert(event.type + " at " + event.currentTarget);
344344
alert(event.clientX + ":" + event.clientY);
345345
};
346346
</script>

0 commit comments

Comments
 (0)