Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrolling #224

Conversation

rkonkin
Copy link
Contributor

@rkonkin rkonkin commented Jun 2, 2019

No description provided.

@javascript-translate-bot javascript-translate-bot added the review needed Review needed, please approve or request changes label Jun 2, 2019
@javascript-translate-bot javascript-translate-bot requested a review from a team June 2, 2019 09:52
Copy link
Member

@xcurveballx xcurveballx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и там еще есть файлы в папках view - там тоже могут быть англ. тексты.

2-ui/3-event-details/8-onscroll/article.md Outdated Show resolved Hide resolved
2-ui/3-event-details/8-onscroll/3-load-visible-img/task.md Outdated Show resolved Hide resolved
2-ui/3-event-details/8-onscroll/3-load-visible-img/task.md Outdated Show resolved Hide resolved
@javascript-translate-bot javascript-translate-bot added changes requested Waiting for changes and /done from PR author and removed review needed Review needed, please approve or request changes labels Jun 2, 2019
@javascript-translate-bot
Copy link
Contributor

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@rkonkin
Copy link
Contributor Author

rkonkin commented Jun 2, 2019

@xcurveballx по поводу папок view.
В 3-ем задании тут куски текстов из английской википедии.
Есть аналогичная статья на русской

Имеет тут смысл заменить куски из английской на куски из русской? Там они правда немного по другому сконструированы, но, думаю, этот тут не особо важно. Просто вставить максимально аналогичные абзацы.
Или перевести только то, что в теге script?

@xcurveballx
Copy link
Member

@rkonkin да, я думаю можно вставить аналогичный текст с вики, ну и + скрипт

// disable caching
// this line should be removed in production code
// отключение кэширования
// эта строка должна быть удалена в "боевом" коде
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут большие сомнения на счет правильного перевода production code.
Перевел как "боевой" код. Норм?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

как вариант, можно написать "в окончательной версии кода" или по-простому "на проде".

Copy link
Contributor Author

@rkonkin rkonkin Jun 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в окончательной версии кода

Так наверно будет не совсем очевидно, что значит "окончательная версия".

на проде

Я приблизительно так и хотел сначала, но потом подумал, что тем, кто еще не работал нигде разработчиком, это будет каким-то неизвестным термином. Мне показалось, что "боевой" - более-менее понятное слово для всех.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да, можно и так оставить - я заапрувил.

@rkonkin
Copy link
Contributor Author

rkonkin commented Jun 2, 2019

/done

@javascript-translate-bot javascript-translate-bot added review needed Review needed, please approve or request changes and removed changes requested Waiting for changes and /done from PR author labels Jun 2, 2019
@javascript-translate-bot javascript-translate-bot requested a review from a team June 2, 2019 12:05
@javascript-translate-bot javascript-translate-bot added needs +1 One more review needed and removed review needed Review needed, please approve or request changes labels Jun 2, 2019
Copy link
Member

@iliakan iliakan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Спасибо, пожалуйста, внеси изменения. В основном улучшения изложения.

@@ -1,65 +1,65 @@
The core of the solution is a function that adds more dates to the page (or loads more stuff in real-life) while we're at the page end.
Суть решения -- это функция, которая добавляет больше дат на страницу (или загружает больше материала в реальной жизни), пока мы находимся в конце этой страницы.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Основа решения -- функция, которая добавляет больше дат на страницу (или загружает больше материала в реальной жизни), пока мы находимся в конце этой страницы.


The document is represented (and contained) within `<html>` tag, that is `document.documentElement`.
Документ представлен (и содержится) в теге `<html>`, то есть `document.documentElement`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Документ представлен тегом <html> (и содержится в нём же) , который доступен как document.documentElement.


We can get window-relative coordinates of the whole document as `document.documentElement.getBoundingClientRect()`. And the `bottom` property will be window-relative coordinate of the document end.
Мы можем получить координаты относительно окна так `document.documentElement.getBoundingClientRect()`. И свойство `bottom` будет координатой относительно окна для конца документа.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мы можем получить координаты относительно окна как document.documentElement.getBoundingClientRect(). И свойство bottom будет координатой конца документа (относительно окна).


P.S. The solution also has a variant of `isVisible` that "pre-loads" images that are within 1 page above/below (the page height is `document.documentElement.clientHeight`).
P.S. У этого решения также есть вариант `isVisible`, который предварительно загружает изображения, находящиеся в пределах одной страницы выше/ниже (высота страницы -- `document.documentElement.clientHeight`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P.S. В решении этой задачи есть также вариант isVisible, который предварительно загружает изображения, находящиеся в пределах одной страницы выше/ниже (высота страницы -- document.documentElement.clientHeight).


```html
<img *!*src="placeholder.svg"*/!* width="128" height="128" *!*data-src="real.jpg"*/!*>
```

So, initially all images are `placeholder.svg`. When the page scrolls to the position where the user can see the image -- we change `src` to the one in `data-src`, and so the image loads.
Итак, изначально все изображения -- `placeholder.svg`. Когда страница прокручивается до того положения, где пользователь может увидеть изображение -- мы меняем `src` на значение из `data-src`, и таким образом изображение загружается.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

То есть, изначально, все изображения - ...


Scroll events allow to react on a page or element scrolling. There are quite a few good things we can do here.
События прокрутки позволяют реагировать на прокрутку страницы или элемента. Есть немало хороших вещей, которые можно сделать.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Есть немало хороших вещей, которые можно сделать. -> Есть много хороших вещей, которые можно сделать при этом.


But we can prevent scrolling by `event.preventDefault()` on an event that causes the scroll.
Но можно предотвратить прокрутку, используя `event.preventDefault()` на событии, которое вызывает её.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

, которое вызывает прокрутку.

- `wheel` event -- a mouse wheel roll (a "scrolling" touchpad action generates it too).
- `keydown` event for `key:pageUp` and `key:pageDown`.
Например:
- Событие `wheel` -- прокрутка колеса мыши ("прокручивание" тачпада также его генерирует).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • На событии...

- `keydown` event for `key:pageUp` and `key:pageDown`.
Например:
- Событие `wheel` -- прокрутка колеса мыши ("прокручивание" тачпада также его генерирует).
- Событие `keydown` для клавиш `key:pageUp` и `key:pageDown`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • На событии...


Sometimes that may help. But there are more ways to scroll, so it's quite hard to handle all of them. So it's more reliable to use CSS to make something unscrollable, like `overflow` property.
Иногда это может помочь. Но есть и другие способы прокрутки, то есть достаточно сложно учесть все возможные варианты. Более надёжный способ -- использовать CSS, чтобы сделать что-то непрокручиваемым, например, свойство `overflow`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если поставить на них обработчики, в которых вызвать event.preventDefault(), то прокрутка не начнётся.

Иногда это может помочь, но более надёжный способ -- использовать CSS, чтобы сделать что-то непрокручиваемым, например, свойство overflow.

@javascript-translate-bot javascript-translate-bot added the changes requested Waiting for changes and /done from PR author label Jun 2, 2019
@javascript-translate-bot
Copy link
Contributor

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@rkonkin
Copy link
Contributor Author

rkonkin commented Jun 2, 2019

/done

@javascript-translate-bot javascript-translate-bot added review needed Review needed, please approve or request changes and removed changes requested Waiting for changes and /done from PR author labels Jun 2, 2019
@javascript-translate-bot javascript-translate-bot requested a review from a team June 2, 2019 15:22

Sometimes that may help. But there are more ways to scroll, so it's quite hard to handle all of them. So it's more reliable to use CSS to make something unscrollable, like `overflow` property.
Если поставить на них обработчики, в которых вызвать event.preventDefault(), то прокрутка не начнётся.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Если поставить на них обработчики, в которых вызвать event.preventDefault(), то прокрутка не начнётся.
Если поставить на них обработчики, в которых вызвать `event.preventDefault()`, то прокрутка не начнётся.

@@ -208,8 +208,8 @@ <h1>Neptune</h1>
if (!realSrc) continue;

if (isVisible(img)) {
// disable caching
// this line should be removed in production code
// отключение кэширования
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// отключение кэширования
// отключение кеширования

@@ -208,8 +208,8 @@ <h1>Neptune</h1>
if (!realSrc) continue;

if (isVisible(img)) {
// disable caching
// this line should be removed in production code
// отключение кэширования
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// отключение кэширования
// отключение кеширования

@rkonkin
Copy link
Contributor Author

rkonkin commented Jun 2, 2019

@lex111 поправил слово "кеширование".
Оно везде вроде через "э" пишется. Но хз.

И кавычки добавил, спс)
b5b0ada

@iliakan
Copy link
Member

iliakan commented Jun 3, 2019

🚀

@javascript-translate-bot javascript-translate-bot merged commit 6021f7c into javascript-tutorial:master Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs +1 One more review needed review needed Review needed, please approve or request changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants