9gag - Scroll down to current position

Scroll down back where the focus was when you clicked the arrow-up icon or scrolled up

Автор
Achernar
Установок в день
0
Всего установок
10
Оценки
0 0 0
Версия
0.3.1
Создан
19.09.2022
Обновлён
15.07.2023
Лицензия
Недоступно
Работает на

This userscript is an attempt to allow a 9gag user to easily scroll back to the position on the page focused when he clicked the "scroll to top" icon. Or if the user scrolled up to read a comment again, and wants to resume where he was.



The userscript adds one or two button to allow you to scroll back down to the position where the viewport was when you clicked 9gag's up arrow.

Once you start scrolling the page, 9gag displays the up arrow at the bottom-right corner of the window.

If you scroll up, either manually or by clicking the up arrow, the userscript displays a down arrow in the top-right corner of the page. Clicking it moves you back to the farther position that you reached when scrolling down.
This icon disappears when you have moved down at least as far as you were, either by scrolling manually or by clicking it.

A second down arrow appears under the first one when you click the up arrow and have already scrolled a little (in short, when the first down arrow is visible). Clicking this second arrow moves you down were you where when you click the up arrow. Which is not as far as the first down arrow will bring you.
This arrow disappears when you scroll down pass the position.


The script remembers the positions for all sections visited in the same "long-lived" page (when the page is dynamically update but not fully reloaded). Say you click the "Home", scroll up/down a little ; then click "Trending", scroll there too. When you click "Home" again, 9gag remember your scrolling position, and the userscript, the state of its buttons.


For more userscripts, styles, extensions, tips, ..., visit my programming page.