diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-09-17 13:27:16 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-09-17 13:27:16 +0200 |
commit | a8778dc23e60e65b47e2aae5d4cdf92660ee4c02 (patch) | |
tree | 09fd049dd660502b04b6a352ecb4ecca14c0fff6 /tpl/view.twig | |
parent | d62dfd88d2519f84b418700bcf7e08f1a4081662 (diff) | |
download | wallabag-a8778dc23e60e65b47e2aae5d4cdf92660ee4c02.tar.gz wallabag-a8778dc23e60e65b47e2aae5d4cdf92660ee4c02.tar.zst wallabag-a8778dc23e60e65b47e2aae5d4cdf92660ee4c02.zip |
fix bug #105: Scroll position save / sync
Diffstat (limited to 'tpl/view.twig')
-rw-r--r-- | tpl/view.twig | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tpl/view.twig b/tpl/view.twig index 2b6d91d5..f9405f45 100644 --- a/tpl/view.twig +++ b/tpl/view.twig | |||
@@ -37,4 +37,23 @@ | |||
37 | <p>{% trans "this article appears wrong?" %} <a href="https://github.com/inthepoche/poche/issues/new">{% trans "create an issue" %}</a> {% trans "or" %} <a href="mailto:support@inthepoche.com?subject=Wrong%20display%20in%20poche&body={{ entry.url|url_encode }}">{% trans "contact us by mail" %}</a></p> | 37 | <p>{% trans "this article appears wrong?" %} <a href="https://github.com/inthepoche/poche/issues/new">{% trans "create an issue" %}</a> {% trans "or" %} <a href="mailto:support@inthepoche.com?subject=Wrong%20display%20in%20poche&body={{ entry.url|url_encode }}">{% trans "contact us by mail" %}</a></p> |
38 | </div> | 38 | </div> |
39 | </div> | 39 | </div> |
40 | <script src="./tpl/js/restoreScroll.js"></script> | ||
41 | <script type="text/javascript"> | ||
42 | $(document).ready(function() { | ||
43 | |||
44 | $(window).scroll(function(e){ | ||
45 | var scrollTop = $(window).scrollTop(); | ||
46 | var docHeight = $(document).height(); | ||
47 | var scrollPercent = (scrollTop) / (docHeight); | ||
48 | var scrollPercentRounded = Math.round(scrollPercent*100)/100; | ||
49 | savePercent({{ entry.id|e }}, scrollPercentRounded); | ||
50 | }); | ||
51 | |||
52 | retrievePercent({{ entry.id|e }}); | ||
53 | |||
54 | $(window).resize(function(){ | ||
55 | retrievePercent({{ entry.id|e }}); | ||
56 | }); | ||
57 | }); | ||
58 | </script> | ||
40 | {% endblock %} \ No newline at end of file | 59 | {% endblock %} \ No newline at end of file |