]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
[fix] remember scroll position for baggy theme #519
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Thu, 6 Mar 2014 17:57:04 +0000 (18:57 +0100)
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Thu, 6 Mar 2014 17:57:04 +0000 (18:57 +0100)
themes/baggy/view.twig

index c925e91c16533baec75c7ba3fddc71560c9e873f..092be04ec980d2445a29e35b19813fdac19e6220 100644 (file)
                 {{ content | raw }}
             </article>
         </div>
+        <script src="{{ poche_url }}/themes/{{theme}}/js/restoreScroll.js"></script>
+        <script type="text/javascript">
+        $(document).ready(function() {
+
+            $(window).scroll(function(e){
+                var scrollTop = $(window).scrollTop();
+                var docHeight = $(document).height();
+                var scrollPercent = (scrollTop) / (docHeight);
+                var scrollPercentRounded = Math.round(scrollPercent*100)/100;
+                savePercent({{ entry.id|e }}, scrollPercentRounded);
+            });
+
+            retrievePercent({{ entry.id|e }});
+
+            $(window).resize(function(){
+                retrievePercent({{ entry.id|e }});
+            });
+        });
+        </script>
 {% endblock %}