+
+ // 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");
+ });
+
+ // set percent of read on startup
+ if ( $(document).height() <= $(window).innerHeight() ) {
+ pp = 100;
+ }
+ else {
+ pp = 0;
+ }
+ $('#readLeftPercent').text( pp + '%' );
+