diff options
author | Thomas Citharel <tcit@tcit.fr> | 2017-03-31 14:54:34 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2017-06-23 09:39:04 +0200 |
commit | 5fe9aadc0e84bac277db7e6ab78b8731c2ba31fc (patch) | |
tree | 0e1e6605eb0b39c1e2e66c27f553b0df0ca465a3 /app/Resources/static/themes/material | |
parent | 46a54f5debe317ccb3a473ec4b54d3755fe6606c (diff) | |
download | wallabag-progress.tar.gz wallabag-progress.tar.zst wallabag-progress.zip |
Set progressprogress
Diffstat (limited to 'app/Resources/static/themes/material')
-rwxr-xr-x | app/Resources/static/themes/material/index.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/app/Resources/static/themes/material/index.js b/app/Resources/static/themes/material/index.js index d6afbb8a..408528ea 100755 --- a/app/Resources/static/themes/material/index.js +++ b/app/Resources/static/themes/material/index.js | |||
@@ -75,4 +75,37 @@ $(document).ready(() => { | |||
75 | const scrollPercent = (s / (d - c)) * 100; | 75 | const scrollPercent = (s / (d - c)) * 100; |
76 | $('.progress .determinate').css('width', `${scrollPercent}%`); | 76 | $('.progress .determinate').css('width', `${scrollPercent}%`); |
77 | }); | 77 | }); |
78 | |||
79 | /* ========================================================================== | ||
80 | Annotations & Remember position | ||
81 | ========================================================================== */ | ||
82 | |||
83 | if ($('article').length) { | ||
84 | const app = new annotator.App(); | ||
85 | const x = JSON.parse($('#annotationroutes').html()); | ||
86 | |||
87 | app.include(annotator.ui.main, { | ||
88 | element: document.querySelector('article'), | ||
89 | }); | ||
90 | |||
91 | app.include(annotator.storage.http, x); | ||
92 | |||
93 | app.start().then(() => { | ||
94 | app.annotations.load({ entry: x.entryId }); | ||
95 | }); | ||
96 | |||
97 | window.addEventListener('unload', () => { | ||
98 | const scrollTop = $(window).scrollTop(); | ||
99 | const docHeight = $(document).height(); | ||
100 | const scrollPercent = (scrollTop) / (docHeight); | ||
101 | const scrollPercentRounded = Math.round(scrollPercent * 100) / 100; | ||
102 | savePercent(x.entryId, scrollPercentRounded); | ||
103 | }); | ||
104 | |||
105 | retrievePercent(x.entryId); | ||
106 | |||
107 | $(window).resize(() => { | ||
108 | retrievePercent(x.entryId); | ||
109 | }); | ||
110 | } | ||
78 | }); | 111 | }); |