diff options
Diffstat (limited to 'app/Resources/static/themes/_global/js')
-rw-r--r-- | app/Resources/static/themes/_global/js/highlight.js | 8 | ||||
-rw-r--r-- | app/Resources/static/themes/_global/js/tools.js | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/app/Resources/static/themes/_global/js/highlight.js b/app/Resources/static/themes/_global/js/highlight.js new file mode 100644 index 00000000..4025fc14 --- /dev/null +++ b/app/Resources/static/themes/_global/js/highlight.js | |||
@@ -0,0 +1,8 @@ | |||
1 | import 'highlight.js/styles/atom-one-light.css'; | ||
2 | import * as hljs from 'highlight.js'; | ||
3 | |||
4 | window.addEventListener('load', () => { | ||
5 | document.querySelectorAll('pre').forEach((node) => { | ||
6 | hljs.highlightBlock(node); | ||
7 | }); | ||
8 | }); | ||
diff --git a/app/Resources/static/themes/_global/js/tools.js b/app/Resources/static/themes/_global/js/tools.js index 774f4539..7e5a2b27 100644 --- a/app/Resources/static/themes/_global/js/tools.js +++ b/app/Resources/static/themes/_global/js/tools.js | |||
@@ -19,14 +19,16 @@ function savePercent(id, percent) { | |||
19 | return true; | 19 | return true; |
20 | } | 20 | } |
21 | 21 | ||
22 | function retrievePercent(id) { | 22 | function retrievePercent(id, resized) { |
23 | if (!supportsLocalStorage()) { return false; } | 23 | if (!supportsLocalStorage()) { return false; } |
24 | 24 | ||
25 | const bheight = $(document).height(); | 25 | const bheight = $(document).height(); |
26 | const percent = localStorage[`wallabag.article.${id}.percent`]; | 26 | const percent = localStorage[`wallabag.article.${id}.percent`]; |
27 | const scroll = bheight * percent; | 27 | const scroll = bheight * percent; |
28 | 28 | ||
29 | $('html,body').animate({ scrollTop: scroll }, 'fast'); | 29 | if (!resized) { |
30 | $('html,body').animate({ scrollTop: scroll }, 'fast'); | ||
31 | } | ||
30 | 32 | ||
31 | return true; | 33 | return true; |
32 | } | 34 | } |