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