]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
print view fixed in baggy; print link added; read percent added in default theme...
authorMaryana Rozhankivska <mariroz@mr.lviv.ua>
Tue, 22 Apr 2014 07:45:09 +0000 (10:45 +0300)
committerMaryana Rozhankivska <mariroz@mr.lviv.ua>
Tue, 22 Apr 2014 07:45:09 +0000 (10:45 +0300)
13 files changed:
inc/poche/Poche.class.php
inc/poche/config.inc.php.new
themes/baggy/css/main.css
themes/baggy/css/print.css
themes/baggy/fonts/icomoon.eot [changed mode: 0755->0644]
themes/baggy/fonts/icomoon.svg [changed mode: 0755->0644]
themes/baggy/fonts/icomoon.ttf [changed mode: 0755->0644]
themes/baggy/fonts/icomoon.woff [changed mode: 0755->0644]
themes/baggy/view.twig
themes/default/css/style-default.css [changed mode: 0644->0755]
themes/default/css/style.css
themes/default/img/default/print.png [new file with mode: 0755]
themes/default/view.twig

index 811895dcacf5312666c98ae73262168506abea4c..dcfdc167da34611c581efea18cf18619e438c0b7 100755 (executable)
@@ -434,12 +434,24 @@ class Poche
             case 'toggle_fav' :
                 $this->store->favoriteById($id, $this->user->getId());
                 Tools::logm('mark as favorite link #' . $id);
-                Tools::redirect();
+                if ( Tools::isAjaxRequest() ) {
+                  echo 1;
+                  exit;
+                }
+                else {
+                  Tools::redirect();
+                }
                 break;
             case 'toggle_archive' :
                 $this->store->archiveById($id, $this->user->getId());
                 Tools::logm('archive link #' . $id);
-                Tools::redirect();
+                if ( Tools::isAjaxRequest() ) {
+                  echo 1;
+                  exit;
+                }
+                else {
+                  Tools::redirect();
+                }
                 break;
             case 'archive_all' :
                 $this->store->archiveAll($this->user->getId());
index 83b3c4c02971248e2f0bfbfd4cc35190cf0505bd..3b08c212fffc0f50a1aeb934ec0ce39bac8dff11 100755 (executable)
@@ -42,6 +42,10 @@ define ('FLATTR_API', 'https://api.flattr.com/rest/v2/things/lookup/?url=');
 define ('NOT_FLATTRABLE', '0');
 define ('FLATTRABLE', '1');
 define ('FLATTRED', '2');
+// display or not print link in article view 
+define ('SHOW_PRINTLINK', '1');
+// display or not percent of read in article view. Affects only default theme. 
+define ('SHOW_READPERCENT', '1');
 define ('ABS_PATH', 'assets/');
 
 define ('DEFAULT_THEME', 'baggy');
index 0991dbedee9acd53e2db19b200d48657fc6870dd..52d8ecaa4320eaaa146a7019430ebde1ccd847e6 100755 (executable)
@@ -746,6 +746,9 @@ margin-top:1em;
 .icon-rss:before {
   content: "\e808";
 }
+.icon-print:before {
+  content: "\e80d";
+}
 
 /* ==========================================================================
    Icon selected
index 9aefa779e76bdac3e7e72d84c0ff65edb4aa56ed..9dd6d295cf27c3c2f47f431d875660cf120f98d5 100755 (executable)
@@ -17,6 +17,7 @@ img {
 
 /* Hide useless blocks */
 body > header,
+#article_toolbar,
 #links,
 #sort,
 body > footer,
@@ -46,3 +47,16 @@ abbr[title]:after {
 .pagination span.current {
     border-style: dashed;
 }
+
+#main {
+               width: 100%;
+               padding: 0;
+               margin: 0;
+               margin-left: 0;
+         padding-right: 0;
+       padding-bottom: 0;
+}
+
+#article {
+               width: 100%;
+}
old mode 100755 (executable)
new mode 100644 (file)
index 02f53b3..5632351
Binary files a/themes/baggy/fonts/icomoon.eot and b/themes/baggy/fonts/icomoon.eot differ
old mode 100755 (executable)
new mode 100644 (file)
index d9c35b9..b458613
@@ -1,7 +1,21 @@
 <?xml version="1.0" standalone="no"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
 <svg xmlns="http://www.w3.org/2000/svg">
-<metadata>Generated by IcoMoon</metadata>
+<metadata>
+<json>
+{
+       "fontFamily": "icomoon",
+       "majorVersion": 1,
+       "minorVersion": 0,
+       "version": "Version 1.0",
+       "fontId": "icomoon",
+       "psName": "icomoon",
+       "subFamily": "Regular",
+       "fullName": "icomoon",
+       "description": "Generated by IcoMoon"
+}
+</json>
+</metadata>
 <defs>
 <font id="icomoon" horiz-adv-x="512">
 <font-face units-per-em="512" ascent="480" descent="-32" />
@@ -23,4 +37,5 @@
 <glyph unicode="&#xe80a;" d="M475.648 50.432v219.136q-9.216-10.24-19.968-18.944-76.288-58.368-121.856-96.256-14.336-12.288-23.552-19.456t-24.576-13.824-29.184-6.656h-1.024q-13.312 0-29.184 6.656t-24.576 13.824-23.552 19.456q-45.056 37.888-121.856 96.256-10.752 8.704-19.968 18.944v-219.136q0-4.096 3.072-6.656t6.144-2.56h420.864q3.584 0 6.144 2.56t3.072 6.656zM475.648 350.464v7.168t-0.512 3.584-0.512 3.584-1.536 2.56-2.56 2.048-4.096 1.024h-420.864q-3.584 0-6.144-3.072t-3.072-6.144q0-48.128 41.984-81.408 55.296-43.52 114.688-90.624 2.048-1.024 10.24-8.192t12.8-10.752 12.8-9.216 14.336-7.68 12.288-2.56h1.024q5.632 0 12.288 2.56t14.336 7.68 12.8 9.216 12.8 10.752 10.24 8.192q59.392 47.104 114.688 90.624 15.36 12.288 28.672 33.28t13.312 37.376zM512 361.216v-310.784q0-18.944-13.312-32.256t-32.256-13.824h-420.864q-18.432 0-32.256 13.824t-13.312 32.256v310.784q0 18.944 13.312 32.256t32.256 13.312h420.864q18.944 0 32.256-13.312t13.312-32.256z" />
 <glyph unicode="&#xe80b;" d="M0 133.888l256 256 256-256-75.776-75.776-180.224 179.712-180.224-179.712z" />
 <glyph unicode="&#xe80c;" d="M25.6 279.296q62.464-35.84 168.96-35.84t168.96 35.84l-27.648-248.832q-1.024-7.168-17.92-18.432t-51.2-22.016-72.192-10.752-71.68 10.752-51.2 22.016-18.432 18.432zM275.456 432.896q48.128-9.216 80.896-28.16t32.768-36.352v-5.12q0-29.696-57.344-50.688t-137.216-20.992-137.216 20.992-57.344 50.688v5.12q0 17.408 32.768 36.352t80.896 28.16l21.504 24.576q11.264 13.312 35.84 13.312h47.104q26.624 0 35.84-13.312zM247.808 375.552h43.008q-47.104 56.32-53.248 64.512-7.168 8.192-16.384 8.192h-52.224q-11.264 0-16.384-8.192l-54.272-64.512h43.008l32.768 33.792h41.984z" horiz-adv-x="389" />
+<glyph unicode="&#xe80d;" d="M128 448h256v-64h-256zM480 352h-448c-17.6 0-32-14.4-32-32v-160c0-17.6 14.398-32 32-32h96v-128h256v128h96c17.6 0 32 14.4 32 32v160c0 17.6-14.4 32-32 32zM352 32h-192v160h192v-160zM487.2 304c0-12.813-10.387-23.2-23.199-23.2-12.813 0-23.201 10.387-23.201 23.2s10.388 23.2 23.201 23.2c12.813 0 23.199-10.387 23.199-23.2z" />
 </font></defs></svg>
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 3860dd0..bb1f21f
Binary files a/themes/baggy/fonts/icomoon.ttf and b/themes/baggy/fonts/icomoon.ttf differ
old mode 100755 (executable)
new mode 100644 (file)
index c3a91ed..bab1377
Binary files a/themes/baggy/fonts/icomoon.woff and b/themes/baggy/fonts/icomoon.woff differ
index ffb512a388059ea6f27f3befc6bd1e319d868799..62af2516ef0e2dc0044b5b9a20ab8d22a7f7ae0a 100755 (executable)
@@ -8,13 +8,14 @@
             <ul class="links">
                 <li class="topPosF"><a href="#top" title="{% trans "Back to top" %}" class="tool top icon icon-arrow-up-thick"><span>{% trans "Back to top" %}</span></a></li>
                 <li><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.url | e | getDomain }}</span></a></li>
-                <li><a title="{% trans "Mark as read" %}" class="tool icon icon-check {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="./?action=toggle_archive&amp;id={{ entry.id|e }}"><span>{% trans "Toggle mark as read" %}</span></a></li>
-                <li><a title="{% trans "Favorite" %}" class="tool icon icon-star {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="./?action=toggle_fav&amp;id={{ entry.id|e }}"><span>{% trans "Toggle favorite" %}</span></a></li>
+                <li><a title="{% trans "Mark as read" %}" class="tool icon icon-check {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="javascript: void(null);" id="markAsRead"><span>{% trans "Toggle mark as read" %}</span></a></li>
+                <li><a title="{% trans "Favorite" %}" class="tool icon icon-star {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="javascript: void(null);" id="setFav"><span>{% trans "Toggle favorite" %}</span></a></li>
                 <li><a title="{% trans "Delete" %}" class="tool delete icon icon-trash" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans "Delete" %}</span></a></li>
                 {% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans "Tweet" %}"><span>{% trans "Tweet" %}</span></a></li>{% endif %}
                 {% if constant('SHARE_MAIL') == 1 %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans "Email" %}"><span>{% trans "Email" %}</span></a></li>{% endif %}
                 {% if constant('SHARE_SHAARLI') == 1 %}<li><a href="{{ constant('SHAARLI_URL') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans "shaarli" %}"><span>{% trans "shaarli" %}</span></a></li>{% endif %}
                 {% if constant('FLATTR') == 1 %}{% if flattr.status == constant('FLATTRABLE') %}<li><a href="http://flattr.com/submit/auto?url={{ entry.url }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans "flattr" %}"><span>{% trans "flattr" %}</span></a></li>{% elseif flattr.status == constant('FLATTRED') %}<li><a href="{{ flattr.flattrItemURL }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans "flattr" %}"><span>{% trans "flattr" %}</span> ({{ flattr.numflattrs }})</a></li>{% endif %}{% endif %}
+                {% if constant('SHOW_PRINTLINK') == 1 %}<li><a title="{% trans "Print" %}" class="tool icon icon-print" href="javascript: window.print();"><span>{% trans "Print" %}</span></a></li>{% endif %}
                 <li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{% trans "Does this article appear wrong?" %}" class="tool bad-display icon icon-delete"><span>{% trans "Does this article appear wrong?" %}</span></a></li>
             </ul>
         </div>
         <script src="{{ poche_url }}themes/{{theme}}/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();
old mode 100644 (file)
new mode 100755 (executable)
index 9dc7c0b..889a9f5
@@ -52,4 +52,8 @@ a.link span {
 
 a.bad-display span {
     background-image: url('../img/default/bad-display.png');
+}
+
+a.print span {
+               background-image: url('../img/default/print.png');
 }
\ No newline at end of file
index e536ac6b5c0cdb47b09bf5061ded7c506bc3d37b..11a8ea1c0b0db9e224d25a446932eb1b900e5a71 100755 (executable)
@@ -331,7 +331,8 @@ a.email span,
 a.delete span,
 a.link span,
 a.bad-display span,
-a.reading-time span {
+a.reading-time span,
+a.print span {
     background-repeat: no-repeat;
 }
 
@@ -402,3 +403,13 @@ a#bagit-form-close {
 .opacity03 {
   /*opacity: 0.3;*/
 }
+
+#readLeftPercent {
+               display: inline-block;
+    /* Show textual content */
+    overflow: visible;
+    text-align: left;
+    text-indent: 0;
+               color: black;
+               width: 50px;
+}
\ No newline at end of file
diff --git a/themes/default/img/default/print.png b/themes/default/img/default/print.png
new file mode 100755 (executable)
index 0000000..83d6445
Binary files /dev/null and b/themes/default/img/default/print.png differ
index cc491c77cc225f249b543e7bd7e0e7532d3909a7..983cc1cd3ee45ae485fc9edd63f07d52a49ef0f0 100755 (executable)
@@ -7,14 +7,16 @@
                 <li><a href="./" title="{% trans "Return home" %}" class="tool back"><span>{% trans "Return home" %}</span></a></li>
                 <li><a href="#top" title="{% trans "Back to top" %}" class="tool top"><span>{% trans "Back to top" %}</span></a></li>
                 <li><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}" class="tool link"><span>{{ entry.url | e | getDomain }}</span></a></li>
-                <li><a title="{% trans "Mark as read" %}" class="tool {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="./?action=toggle_archive&amp;id={{ entry.id|e }}"><span>{% trans "Toggle mark as read" %}</span></a></li>
-                <li><a title="{% trans "Favorite" %}" class="tool {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="./?action=toggle_fav&amp;id={{ entry.id|e }}"><span>{% trans "Toggle favorite" %}</span></a></li>
+                <li><a title="{% trans "Mark as read" %}" class="tool {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="javascript: void(null);" id="markAsRead"><span>{% trans "Toggle mark as read" %}</span></a></li>
+                <li><a title="{% trans "Favorite" %}" class="tool {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="javascript: void(null);" id="setFav"><span>{% trans "Toggle favorite" %}</span></a></li>
                 <li><a title="{% trans "Delete" %}" class="tool delete" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans "Delete" %}</span></a></li>
                 {% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter" title="{% trans "Tweet" %}"><span>{% trans "Tweet" %}</span></a></li>{% endif %}
                 {% if constant('SHARE_MAIL') == 1 %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email" title="{% trans "Email" %}"><span>{% trans "Email" %}</span></a></li>{% endif %}
                 {% if constant('SHARE_SHAARLI') == 1 %}<li><a href="{{ constant('SHAARLI_URL') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans "shaarli" %}"><span>{% trans "shaarli" %}</span></a></li>{% endif %}
                 {% if constant('FLATTR') == 1 %}{% if flattr.status == constant('FLATTRABLE') %}<li><a href="http://flattr.com/submit/auto?url={{ entry.url }}" class="tool flattr" target="_blank" title="{% trans "flattr" %}"><span>{% trans "flattr" %}</span></a></li>{% elseif flattr.status == constant('FLATTRED') %}<li><a href="{{ flattr.flattrItemURL }}" class="tool flattr" target="_blank" title="{% trans "flattr" %}"><span>{% trans "flattr" %}</span>{{ flattr.numflattrs }}</a></li>{% endif %}{% endif %}
+                {% if constant('SHOW_PRINTLINK') == 1 %}<li><a title="{% trans "Print" %}" class="tool print" href="javascript: window.print();"><span>{% trans "Print" %}</span></a></li>{% endif %}
                 <li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{% trans "Does this article appear wrong?" %}" class="tool bad-display"><span>{% trans "Does this article appear wrong?" %}</span></a></li>
+                {% if constant('SHOW_READPERCENT') == 1 %}<li><div id="readLeftPercent">0%</div></li>{% endif %}
             </ul>
         </div>
         <div id="article">
         <script src="{{ poche_url }}themes/{{theme}}/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");
+                                         });
+        
+                                               // set percent of read on startup       
+                       if ( $(document).height() <= $(window).innerHeight() ) {
+                         pp = 100;
+                       }
+                       else {
+                               pp = 0;
+                       }
+                       $('#readLeftPercent').text( pp + '%' );
+                       
 
             $(window).scroll(function(e){
                 var scrollTop = $(window).scrollTop();
                 var scrollPercent = (scrollTop) / (docHeight);
                 var scrollPercentRounded = Math.round(scrollPercent*100)/100;
                 savePercent({{ entry.id|e }}, scrollPercentRounded);
+                
+                // change percent of read on scroll
+                pp = Math.round(scrollTop * 100 / ( docHeight - $(window).innerHeight() ));
+                $('#readLeftPercent').text( pp + '%' );
             });
 
             retrievePercent({{ entry.id|e }});