]> git.immae.eu Git - github/wallabag/wallabag.git/blob - themes/default/view.twig
983cc1cd3ee45ae485fc9edd63f07d52a49ef0f0
[github/wallabag/wallabag.git] / themes / default / view.twig
1 {% extends "layout.twig" %}
2 {% block title %}{{ entry.title|raw }} ({{ entry.url | e | getDomain }}){% endblock %}
3 {% block content %}
4 {% include '_pocheit-form.twig' %}
5 <div id="article_toolbar">
6 <ul>
7 <li><a href="./" title="{% trans "Return home" %}" class="tool back"><span>{% trans "Return home" %}</span></a></li>
8 <li><a href="#top" title="{% trans "Back to top" %}" class="tool top"><span>{% trans "Back to top" %}</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>
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>
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>
12 <li><a title="{% trans "Delete" %}" class="tool delete" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans "Delete" %}</span></a></li>
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 %}
14 {% 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 %}
15 {% 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 %}
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="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>
19 {% if constant('SHOW_READPERCENT') == 1 %}<li><div id="readLeftPercent">0%</div></li>{% endif %}
20 </ul>
21 </div>
22 <div id="article">
23 <header class="mbm">
24 <h1>{{ entry.title|raw }}</h1>
25 </header>
26 {% block tags %}
27 <aside class="tags">
28 {% trans "tags:" %} {% for tag in tags %}<a href="./?view=tag&amp;id={{ tag.id }}">{{ tag.value }}</a> {% endfor %}<a href="./?view=edit-tags&amp;id={{ entry.id|e }}" title="{% trans "Edit tags" %}">✎</a>
29 </aside>
30 {% endblock %}
31 <article>
32 {{ content | raw }}
33 </article>
34 {{ block('tags') }}
35 </div>
36 <script src="{{ poche_url }}themes/{{theme}}/js/restoreScroll.js"></script>
37 <script type="text/javascript">
38 $(document).ready(function() {
39
40 // toggle read property of current article
41 $('#markAsRead').click(function(){
42 $("body").css("cursor", "wait");
43 $.ajax( { url: './?action=toggle_archive&id={{ entry.id|e }}' }).done(
44 function( data ) {
45 if ( data == '1' ) {
46 if ( $('#markAsRead').hasClass("archive-off") ) {
47 $('#markAsRead').removeClass("archive-off");
48 $('#markAsRead').addClass("archive");
49 }
50 else {
51 $('#markAsRead').removeClass("archive");
52 $('#markAsRead').addClass("archive-off");
53 }
54 }
55 else {
56 alert('Error! Pls check if you are logged in.');
57 }
58 });
59 $("body").css("cursor", "auto");
60 });
61
62 // toggle favorite property of current article
63 $('#setFav').click(function(){
64 $("body").css("cursor", "wait");
65 $.ajax( { url: './?action=toggle_fav&id={{ entry.id|e }}' }).done(
66 function( data ) {
67 if ( data == '1' ) {
68 if ( $('#setFav').hasClass("fav-off") ) {
69 $('#setFav').removeClass("fav-off");
70 $('#setFav').addClass("fav");
71 }
72 else {
73 $('#setFav').removeClass("fav");
74 $('#setFav').addClass("fav-off");
75 }
76 }
77 else {
78 alert('Error! Pls check if you are logged in.');
79 }
80 });
81 $("body").css("cursor", "auto");
82 });
83
84 // set percent of read on startup
85 if ( $(document).height() <= $(window).innerHeight() ) {
86 pp = 100;
87 }
88 else {
89 pp = 0;
90 }
91 $('#readLeftPercent').text( pp + '%' );
92
93
94 $(window).scroll(function(e){
95 var scrollTop = $(window).scrollTop();
96 var docHeight = $(document).height();
97 var scrollPercent = (scrollTop) / (docHeight);
98 var scrollPercentRounded = Math.round(scrollPercent*100)/100;
99 savePercent({{ entry.id|e }}, scrollPercentRounded);
100
101 // change percent of read on scroll
102 pp = Math.round(scrollTop * 100 / ( docHeight - $(window).innerHeight() ));
103 $('#readLeftPercent').text( pp + '%' );
104 });
105
106 retrievePercent({{ entry.id|e }});
107
108 $(window).resize(function(){
109 retrievePercent({{ entry.id|e }});
110 });
111
112 // Hide useless "back to top" link when there is no scrollbar
113 if ($("body").height() <= $(window).height()) {
114 $('#article_toolbar .tool.top').parent().hide();
115 }
116 });
117 </script>
118 {% endblock %}
119