1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

Extract Scroll Storage controller

This commit is contained in:
Yassine Guedidi 2025-03-02 13:43:18 +01:00
parent 019d252446
commit d515e11fe4
4 changed files with 22 additions and 50 deletions

View file

@ -23,7 +23,7 @@ import '@fontsource/oswald';
/* Tools */
import {
savePercent, retrievePercent, initPreviewText,
initPreviewText,
} from './js/tools';
/* Import shortcuts */
@ -34,7 +34,7 @@ import './js/shortcuts/entry';
import './scss/index.scss';
/* ==========================================================================
Annotations & Remember position
Annotations
========================================================================== */
$(document).ready(() => {
@ -70,20 +70,6 @@ $(document).ready(() => {
app.start().then(() => {
app.annotations.load({ entry: x.entryId });
});
$(window).scroll(() => {
const scrollTop = $(window).scrollTop();
const docHeight = $(document).height();
const scrollPercent = (scrollTop) / (docHeight);
const scrollPercentRounded = Math.round(scrollPercent * 100) / 100;
savePercent(x.entryId, scrollPercentRounded);
});
retrievePercent(x.entryId);
$(window).resize(() => {
retrievePercent(x.entryId, true);
});
}
document.querySelectorAll('[data-handler=tag-rename]').forEach((item) => {