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/baggy | |
parent | 46a54f5debe317ccb3a473ec4b54d3755fe6606c (diff) | |
download | wallabag-5fe9aadc0e84bac277db7e6ab78b8731c2ba31fc.tar.gz wallabag-5fe9aadc0e84bac277db7e6ab78b8731c2ba31fc.tar.zst wallabag-5fe9aadc0e84bac277db7e6ab78b8731c2ba31fc.zip |
Set progressprogress
Diffstat (limited to 'app/Resources/static/themes/baggy')
-rwxr-xr-x | app/Resources/static/themes/baggy/index.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/Resources/static/themes/baggy/index.js b/app/Resources/static/themes/baggy/index.js index 39ad49aa..27e3e374 100755 --- a/app/Resources/static/themes/baggy/index.js +++ b/app/Resources/static/themes/baggy/index.js | |||
@@ -9,6 +9,9 @@ import './js/shortcuts/entry'; | |||
9 | 9 | ||
10 | /* Tools */ | 10 | /* Tools */ |
11 | import toggleSaveLinkForm from './js/uiTools'; | 11 | import toggleSaveLinkForm from './js/uiTools'; |
12 | import {savePercent, retrievePercent, throttle} from '../_global/js/tools'; | ||
13 | |||
14 | global.jquery = $; | ||
12 | 15 | ||
13 | /* Theme style */ | 16 | /* Theme style */ |
14 | import './css/index.scss'; | 17 | import './css/index.scss'; |
@@ -50,6 +53,39 @@ $(document).ready(() => { | |||
50 | }); | 53 | }); |
51 | } | 54 | } |
52 | 55 | ||
56 | /* ========================================================================== | ||
57 | Annotations & Remember position | ||
58 | ========================================================================== */ | ||
59 | |||
60 | if ($('article').length) { | ||
61 | const app = new annotator.App(); | ||
62 | |||
63 | app.include(annotator.ui.main, { | ||
64 | element: document.querySelector('article'), | ||
65 | }); | ||
66 | |||
67 | const x = JSON.parse($('#annotationroutes').html()); | ||
68 | app.include(annotator.storage.http, x); | ||
69 | |||
70 | app.start().then(() => { | ||
71 | app.annotations.load({ entry: x.entryId }); | ||
72 | }); | ||
73 | |||
74 | window.addEventListener('unload', () => { | ||
75 | const scrollTop = $(window).scrollTop(); | ||
76 | const docHeight = $(document).height(); | ||
77 | const scrollPercent = (scrollTop) / (docHeight); | ||
78 | const scrollPercentRounded = Math.round(scrollPercent * 100) / 100; | ||
79 | savePercent(x.entryId, scrollPercentRounded); | ||
80 | }); | ||
81 | |||
82 | retrievePercent(x.entryId); | ||
83 | |||
84 | $(window).resize(() => { | ||
85 | retrievePercent(x.entryId); | ||
86 | }); | ||
87 | } | ||
88 | |||
53 | /** | 89 | /** |
54 | * Close window after adding entry if popup | 90 | * Close window after adding entry if popup |
55 | */ | 91 | */ |