diff options
author | Jeremy <jeremy.benoist@gmail.com> | 2015-02-23 22:55:06 +0100 |
---|---|---|
committer | Jeremy <jeremy.benoist@gmail.com> | 2015-03-01 10:49:16 +0100 |
commit | 32da2a70ef278bd42f66eb82c3fbf1905a417b87 (patch) | |
tree | 587ef3bae1f4881047eb1ceb0c005e7a8287bb71 /src/Wallabag/CoreBundle/Resources/views/themes/_global/public/js/restoreScroll.js | |
parent | fca3c757233940cbe4c431e3e05fe74893225fe0 (diff) | |
download | wallabag-32da2a70ef278bd42f66eb82c3fbf1905a417b87.tar.gz wallabag-32da2a70ef278bd42f66eb82c3fbf1905a417b87.tar.zst wallabag-32da2a70ef278bd42f66eb82c3fbf1905a417b87.zip |
Add LiipThemeBundle
Re-defined the config / user relation to be OneToOne bidirectionnal.
ConfigType is now a service so I can inject the list of available themes that are also used by LiipThemeBundle
Force sqlite for test
In case of people use a different driver in parameter.yml (yes I do :))
Diffstat (limited to 'src/Wallabag/CoreBundle/Resources/views/themes/_global/public/js/restoreScroll.js')
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/views/themes/_global/public/js/restoreScroll.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/_global/public/js/restoreScroll.js b/src/Wallabag/CoreBundle/Resources/views/themes/_global/public/js/restoreScroll.js new file mode 100644 index 00000000..331c9e19 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/_global/public/js/restoreScroll.js | |||
@@ -0,0 +1,25 @@ | |||
1 | function supportsLocalStorage() { | ||
2 | try { | ||
3 | return 'localStorage' in window && window['localStorage'] !== null; | ||
4 | } catch (e) { | ||
5 | return false; | ||
6 | } | ||
7 | } | ||
8 | |||
9 | function savePercent(id, percent) { | ||
10 | if (!supportsLocalStorage()) { return false; } | ||
11 | localStorage["poche.article." + id + ".percent"] = percent; | ||
12 | return true; | ||
13 | } | ||
14 | |||
15 | function retrievePercent(id) { | ||
16 | if (!supportsLocalStorage()) { return false; } | ||
17 | |||
18 | var bheight = $(document).height(); | ||
19 | var percent = localStorage["poche.article." + id + ".percent"]; | ||
20 | var scroll = bheight * percent; | ||
21 | |||
22 | $('html,body').animate({scrollTop: scroll}, 'fast'); | ||
23 | |||
24 | return true; | ||
25 | } \ No newline at end of file | ||