diff options
Diffstat (limited to 'themes/default/view.twig')
-rwxr-xr-x[-rw-r--r--] | themes/default/view.twig | 69 |
1 files changed, 66 insertions, 3 deletions
diff --git a/themes/default/view.twig b/themes/default/view.twig index 916abe0d..b7d48c00 100644..100755 --- a/themes/default/view.twig +++ b/themes/default/view.twig | |||
@@ -1,19 +1,23 @@ | |||
1 | {% extends "layout.twig" %} | 1 | {% extends "layout.twig" %} |
2 | {% block title %}{{ entry.title|raw }} ({{ entry.url | e | getDomain }}){% endblock %} | 2 | {% block title %}{{ entry.title|raw }} ({{ entry.url | e | getDomain }}){% endblock %} |
3 | {% block content %} | 3 | {% block content %} |
4 | {% include '_pocheit-form.twig' %} | ||
4 | <div id="article_toolbar"> | 5 | <div id="article_toolbar"> |
5 | <ul> | 6 | <ul> |
6 | <li><a href="./" title="{% trans "Return home" %}" class="tool back"><span>{% trans "Return home" %}</span></a></li> | 7 | <li><a href="./" title="{% trans "Return home" %}" class="tool back"><span>{% trans "Return home" %}</span></a></li> |
7 | <li><a href="#top" title="{% trans "Back to top" %}" class="tool top"><span>{% trans "Back to top" %}</span></a></li> | 8 | <li><a href="#top" title="{% trans "Back to top" %}" class="tool top"><span>{% trans "Back to top" %}</span></a></li> |
8 | <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> | 9 | <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> |
9 | <li><a title="{% trans "Mark as read" %}" class="tool {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="./?action=toggle_archive&id={{ entry.id|e }}"><span>{% trans "Toggle mark as read" %}</span></a></li> | 10 | <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> |
10 | <li><a title="{% trans "Favorite" %}" class="tool {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="./?action=toggle_fav&id={{ entry.id|e }}"><span>{% trans "Toggle favorite" %}</span></a></li> | 11 | <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> |
11 | <li><a title="{% trans "Delete" %}" class="tool delete" href="./?action=delete&id={{ entry.id|e }}"><span>{% trans "Delete" %}</span></a></li> | 12 | <li><a title="{% trans "Delete" %}" class="tool delete" href="./?action=delete&id={{ entry.id|e }}"><span>{% trans "Delete" %}</span></a></li> |
12 | {% 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 %} | 13 | {% 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 %} |
13 | {% if constant('SHARE_MAIL') == 1 %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email" title="{% trans "Email" %}"><span>{% trans "Email" %}</span></a></li>{% endif %} | 14 | {% if constant('SHARE_MAIL') == 1 %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email" title="{% trans "Email" %}"><span>{% trans "Email" %}</span></a></li>{% endif %} |
14 | {% if constant('SHARE_SHAARLI') == 1 %}<li><a href="{{ constant('SHAARLI_URL') }}/index.php?post={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans "shaarli" %}"><span>{% trans "shaarli" %}</span></a></li>{% endif %} | 15 | {% if constant('SHARE_SHAARLI') == 1 %}<li><a href="{{ constant('SHAARLI_URL') }}/index.php?post={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans "shaarli" %}"><span>{% trans "shaarli" %}</span></a></li>{% endif %} |
15 | {% 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 %} | 16 | {% 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 %} |
17 | {% if constant('SHOW_PRINTLINK') == 1 %}<li><a title="{% trans "Print" %}" class="tool print" href="javascript: window.print();"><span>{% trans "Print" %}</span></a></li>{% endif %} | ||
18 | <li><a href="./?epub&method=id&id={{ entry.id|e }}" title="Generate epub file">EPUB</a></li> | ||
16 | <li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&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> | 19 | <li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&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> |
20 | {% if constant('SHOW_READPERCENT') == 1 %}<li><div id="readLeftPercent">0%</div></li>{% endif %} | ||
17 | </ul> | 21 | </ul> |
18 | </div> | 22 | </div> |
19 | <div id="article"> | 23 | <div id="article"> |
@@ -30,9 +34,63 @@ | |||
30 | </article> | 34 | </article> |
31 | {{ block('tags') }} | 35 | {{ block('tags') }} |
32 | </div> | 36 | </div> |
33 | <script src="{{ poche_url }}/themes/{{ constant('DEFAULT_THEME') }}/js/restoreScroll.js"></script> | 37 | <script src="{{ poche_url }}themes/{{theme}}/js/restoreScroll.js"></script> |
34 | <script type="text/javascript"> | 38 | <script type="text/javascript"> |
35 | $(document).ready(function() { | 39 | $(document).ready(function() { |
40 | |||
41 | // toggle read property of current article | ||
42 | $('#markAsRead').click(function(){ | ||
43 | $("body").css("cursor", "wait"); | ||
44 | $.ajax( { url: './?action=toggle_archive&id={{ entry.id|e }}' }).done( | ||
45 | function( data ) { | ||
46 | if ( data == '1' ) { | ||
47 | if ( $('#markAsRead').hasClass("archive-off") ) { | ||
48 | $('#markAsRead').removeClass("archive-off"); | ||
49 | $('#markAsRead').addClass("archive"); | ||
50 | } | ||
51 | else { | ||
52 | $('#markAsRead').removeClass("archive"); | ||
53 | $('#markAsRead').addClass("archive-off"); | ||
54 | } | ||
55 | } | ||
56 | else { | ||
57 | alert('Error! Pls check if you are logged in.'); | ||
58 | } | ||
59 | }); | ||
60 | $("body").css("cursor", "auto"); | ||
61 | }); | ||
62 | |||
63 | // toggle favorite property of current article | ||
64 | $('#setFav').click(function(){ | ||
65 | $("body").css("cursor", "wait"); | ||
66 | $.ajax( { url: './?action=toggle_fav&id={{ entry.id|e }}' }).done( | ||
67 | function( data ) { | ||
68 | if ( data == '1' ) { | ||
69 | if ( $('#setFav').hasClass("fav-off") ) { | ||
70 | $('#setFav').removeClass("fav-off"); | ||
71 | $('#setFav').addClass("fav"); | ||
72 | } | ||
73 | else { | ||
74 | $('#setFav').removeClass("fav"); | ||
75 | $('#setFav').addClass("fav-off"); | ||
76 | } | ||
77 | } | ||
78 | else { | ||
79 | alert('Error! Pls check if you are logged in.'); | ||
80 | } | ||
81 | }); | ||
82 | $("body").css("cursor", "auto"); | ||
83 | }); | ||
84 | |||
85 | // set percent of read on startup | ||
86 | if ( $(document).height() <= $(window).innerHeight() ) { | ||
87 | pp = 100; | ||
88 | } | ||
89 | else { | ||
90 | pp = 0; | ||
91 | } | ||
92 | $('#readLeftPercent').text( pp + '%' ); | ||
93 | |||
36 | 94 | ||
37 | $(window).scroll(function(e){ | 95 | $(window).scroll(function(e){ |
38 | var scrollTop = $(window).scrollTop(); | 96 | var scrollTop = $(window).scrollTop(); |
@@ -40,6 +98,10 @@ | |||
40 | var scrollPercent = (scrollTop) / (docHeight); | 98 | var scrollPercent = (scrollTop) / (docHeight); |
41 | var scrollPercentRounded = Math.round(scrollPercent*100)/100; | 99 | var scrollPercentRounded = Math.round(scrollPercent*100)/100; |
42 | savePercent({{ entry.id|e }}, scrollPercentRounded); | 100 | savePercent({{ entry.id|e }}, scrollPercentRounded); |
101 | |||
102 | // change percent of read on scroll | ||
103 | pp = Math.round(scrollTop * 100 / ( docHeight - $(window).innerHeight() )); | ||
104 | $('#readLeftPercent').text( pp + '%' ); | ||
43 | }); | 105 | }); |
44 | 106 | ||
45 | retrievePercent({{ entry.id|e }}); | 107 | retrievePercent({{ entry.id|e }}); |
@@ -55,3 +117,4 @@ | |||
55 | }); | 117 | }); |
56 | </script> | 118 | </script> |
57 | {% endblock %} | 119 | {% endblock %} |
120 | |||