diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-02-03 10:03:41 -0800 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-02-03 10:03:41 -0800 |
commit | 38dafee05d52948fba4a06066d7b0343c8e3de9d (patch) | |
tree | 2e3f7bd3a58bfdb046742c3e65ff082e31a9859b /themes/courgette/js | |
parent | f355d2c87fa441221ca8a9339c426c1c95e7c2ac (diff) | |
parent | fa0bfb775a53a074e0a9d642298685b5ed1af83f (diff) | |
download | wallabag-38dafee05d52948fba4a06066d7b0343c8e3de9d.tar.gz wallabag-38dafee05d52948fba4a06066d7b0343c8e3de9d.tar.zst wallabag-38dafee05d52948fba4a06066d7b0343c8e3de9d.zip |
Merge pull request #427 from wallabag/dev1.4.0
changelog 1.4
Diffstat (limited to 'themes/courgette/js')
-rwxr-xr-x | themes/courgette/js/init.js | 6 | ||||
-rwxr-xr-x | themes/courgette/js/restoreScroll.js | 25 |
2 files changed, 31 insertions, 0 deletions
diff --git a/themes/courgette/js/init.js b/themes/courgette/js/init.js new file mode 100755 index 00000000..dca83906 --- /dev/null +++ b/themes/courgette/js/init.js | |||
@@ -0,0 +1,6 @@ | |||
1 | $.fn.ready(function () { | ||
2 | $('#menu').on('click', function(){ | ||
3 | $('body').toggleClass('menuOpen'); | ||
4 | $('#menuContainer, #article_toolbar').toggleClass('open'); | ||
5 | }); | ||
6 | }) \ No newline at end of file | ||
diff --git a/themes/courgette/js/restoreScroll.js b/themes/courgette/js/restoreScroll.js new file mode 100755 index 00000000..331c9e19 --- /dev/null +++ b/themes/courgette/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 | ||