+ <script src="{{ poche_url }}themes/_global/js/restoreScroll.js"></script>
+ <script type="text/javascript">
+ $(document).ready(function() {
+
+ // toggle read property of current article
+ $('#markAsRead').click(function(){
+ $("body").css("cursor", "wait");
+ $.ajax( { url: './?action=toggle_archive&id={{ entry.id|e }}' }).done(
+ function( data ) {
+ if ( data == '1' ) {
+ if ( $('#markAsRead').hasClass("archive-off") ) {
+ $('#markAsRead').removeClass("archive-off");
+ $('#markAsRead').addClass("archive");
+ }
+ else {
+ $('#markAsRead').removeClass("archive");
+ $('#markAsRead').addClass("archive-off");
+ }
+ }
+ else {
+ alert('Error! Pls check if you are logged in.');
+ }
+ });
+ $("body").css("cursor", "auto");
+ });
+
+ // toggle favorite property of current article
+ $('#setFav').click(function(){
+ $("body").css("cursor", "wait");
+ $.ajax( { url: './?action=toggle_fav&id={{ entry.id|e }}' }).done(
+ function( data ) {
+ if ( data == '1' ) {
+ if ( $('#setFav').hasClass("fav-off") ) {
+ $('#setFav').removeClass("fav-off");
+ $('#setFav').addClass("fav");
+ }
+ else {
+ $('#setFav').removeClass("fav");
+ $('#setFav').addClass("fav-off");
+ }
+ }
+ else {
+ alert('Error! Pls check if you are logged in.');
+ }
+ });
+ $("body").css("cursor", "auto");
+ });
+
+ $(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>