diff options
Diffstat (limited to 'app/Resources/static/themes/_global/js')
-rw-r--r-- | app/Resources/static/themes/_global/js/restoreScroll.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/app/Resources/static/themes/_global/js/restoreScroll.js b/app/Resources/static/themes/_global/js/restoreScroll.js index e63d06c6..9c4d7e20 100644 --- a/app/Resources/static/themes/_global/js/restoreScroll.js +++ b/app/Resources/static/themes/_global/js/restoreScroll.js | |||
@@ -1,25 +1,25 @@ | |||
1 | function supportsLocalStorage() { | 1 | function supportsLocalStorage() { |
2 | try { | 2 | try { |
3 | return 'localStorage' in window && window['localStorage'] !== null; | 3 | return 'localStorage' in window && window.localStorage !== null; |
4 | } catch (e) { | 4 | } catch (e) { |
5 | return false; | 5 | return false; |
6 | } | 6 | } |
7 | } | 7 | } |
8 | 8 | ||
9 | function savePercent(id, percent) { | 9 | function savePercent(id, percent) { |
10 | if (!supportsLocalStorage()) { return false; } | 10 | if (!supportsLocalStorage()) { return false; } |
11 | localStorage["wallabag.article." + id + ".percent"] = percent; | 11 | localStorage['wallabag.article.' + id + '.percent'] = percent; |
12 | return true; | 12 | return true; |
13 | } | 13 | } |
14 | 14 | ||
15 | function retrievePercent(id) { | 15 | function retrievePercent(id) { |
16 | if (!supportsLocalStorage()) { return false; } | 16 | if (!supportsLocalStorage()) { return false; } |
17 | 17 | ||
18 | var bheight = $(document).height(); | 18 | var bheight = $(document).height(); |
19 | var percent = localStorage["wallabag.article." + id + ".percent"]; | 19 | var percent = localStorage['wallabag.article.' + id + '.percent']; |
20 | var scroll = bheight * percent; | 20 | var scroll = bheight * percent; |
21 | 21 | ||
22 | $('html,body').animate({scrollTop: scroll}, 'fast'); | 22 | $('html,body').animate({ scrollTop: scroll }, 'fast'); |
23 | 23 | ||
24 | return true; | 24 | return true; |
25 | } | 25 | } |