aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2015-03-07 22:52:03 +0100
committerThomas Citharel <tcit@tcit.fr>2015-03-07 22:52:03 +0100
commit00dc7622fbb25458f82b8d81dffae6f843dadece (patch)
tree5d9e6aec0bd8243b30d5f6f4cfb2334ff820bb88
parent0ae1e652c94fded9f656876a25ca8021bc5bf727 (diff)
downloadwallabag-00dc7622fbb25458f82b8d81dffae6f843dadece.tar.gz
wallabag-00dc7622fbb25458f82b8d81dffae6f843dadece.tar.zst
wallabag-00dc7622fbb25458f82b8d81dffae6f843dadece.zip
change system for #1123 and keyboard arrows shortcuts
-rw-r--r--themes/_global/js/keyboard.js27
-rwxr-xr-xthemes/baggy/_head.twig1
-rwxr-xr-xthemes/baggy/css/main.css28
-rwxr-xr-xthemes/baggy/view.twig5
-rwxr-xr-xthemes/default/_head.twig1
-rwxr-xr-xthemes/default/view.twig5
6 files changed, 63 insertions, 4 deletions
diff --git a/themes/_global/js/keyboard.js b/themes/_global/js/keyboard.js
new file mode 100644
index 00000000..26978cb2
--- /dev/null
+++ b/themes/_global/js/keyboard.js
@@ -0,0 +1,27 @@
1function navigateKeyboard(leftURL, rightURL) {
2 window.addEventListener("keypress", function (event) {
3 var key = event.which || event.keyCode; // event.keyCode is used for IE8 and earlier versions
4 console.log("key pressed : " + key);
5 switch (key) {
6 case 37:
7 // left arrow
8 if (leftURL != "?view=view&id=") {
9 window.location = window.location.origin + window.location.pathname + leftURL;
10 }
11 break;
12 /*
13 case 38:
14 // top arrow
15 window.location = window.location.origin + window.location.pathname + window.location.search + "#top";
16 break;
17 */
18 case 39:
19 //right arrow
20 if (rightURL != "?view=view&id=") {
21 window.location = window.location.origin + window.location.pathname + rightURL;
22 }
23 break;
24 }
25
26 }, false);
27} \ No newline at end of file
diff --git a/themes/baggy/_head.twig b/themes/baggy/_head.twig
index d252130c..3799f8fb 100755
--- a/themes/baggy/_head.twig
+++ b/themes/baggy/_head.twig
@@ -36,4 +36,5 @@
36 <script src="{{ poche_url }}themes/{{theme}}/js/init.js"></script> 36 <script src="{{ poche_url }}themes/{{theme}}/js/init.js"></script>
37 <script src="{{ poche_url }}themes/_global/js/saveLink.js"></script> 37 <script src="{{ poche_url }}themes/_global/js/saveLink.js"></script>
38 <script src="{{ poche_url }}themes/_global/js/popupForm.js"></script> 38 <script src="{{ poche_url }}themes/_global/js/popupForm.js"></script>
39 <script src="{{ poche_url }}themes/_global/js/keyboard.js"></script>
39 <script src="{{ poche_url }}themes/{{theme}}/js/closeMessage.js"></script> 40 <script src="{{ poche_url }}themes/{{theme}}/js/closeMessage.js"></script>
diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css
index 1b221021..5319fd68 100755
--- a/themes/baggy/css/main.css
+++ b/themes/baggy/css/main.css
@@ -873,6 +873,20 @@ blockquote {
873 font-size: 1.5em; 873 font-size: 1.5em;
874} 874}
875 875
876.leftPosF {
877 position: fixed;
878 right: 24%;
879 bottom: 2em;
880 font-size: 1.5em;
881}
882
883.rightPosF {
884 position: fixed;
885 right: 16%;
886 bottom: 2em;
887 font-size: 1.5em;
888}
889
876#article_toolbar { 890#article_toolbar {
877 margin-bottom: 1em; 891 margin-bottom: 1em;
878} 892}
@@ -970,6 +984,12 @@ pre code {
970 .topPosF { 984 .topPosF {
971 right: 2.5em; 985 right: 2.5em;
972 } 986 }
987 .leftPosF {
988 right: 4.5em;
989 }
990 .rightPosF {
991 right: 0.5em;
992 }
973} 993}
974 994
975@media screen and (max-width: 700px) { 995@media screen and (max-width: 700px) {
@@ -1063,6 +1083,14 @@ pre code {
1063 display: none; 1083 display: none;
1064 } 1084 }
1065 1085
1086 #article_toolbar .leftPosF {
1087 display: none;
1088 }
1089
1090 #article_toolbar .rightPosF {
1091 display: none;
1092 }
1093
1066 #article { 1094 #article {
1067 width: 100%; 1095 width: 100%;
1068 } 1096 }
diff --git a/themes/baggy/view.twig b/themes/baggy/view.twig
index ae02ce48..68af03f5 100755
--- a/themes/baggy/view.twig
+++ b/themes/baggy/view.twig
@@ -8,7 +8,7 @@
8 <div id="article_toolbar"> 8 <div id="article_toolbar">
9 <ul class="links"> 9 <ul class="links">
10 <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> 10 <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>
11 {% if navigate.previous %}<li><a href="./?view=view&amp;id={{ navigate.previousid|e }}" class="tool icon icon-previous"><span>{% trans "Previous Article" %}</span></a></li>{% endif %} 11 {% if navigate.next %}<li class="leftPosF"><a href="./?view=view&amp;id={{ navigate.nextid|e }}" class="top tool icon icon-previous"><span>{% trans "Next Article" %}</span></a></li>{% endif %}
12 <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> 12 <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>
13 <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> 13 <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>
14 {% if navigate.next %}<li><a title="{% trans "Mark as read and go to next article" %}" class="tool icon archiveandnext-icon" href="./?action=archive_and_next&amp;id={{ entry.id|e }}" id="markAsReadAndNext"><span>{% trans "Toggle mark as read and go to next article" %}</span></a></li>{% endif %} 14 {% if navigate.next %}<li><a title="{% trans "Mark as read and go to next article" %}" class="tool icon archiveandnext-icon" href="./?action=archive_and_next&amp;id={{ entry.id|e }}" id="markAsReadAndNext"><span>{% trans "Toggle mark as read and go to next article" %}</span></a></li>{% endif %}
@@ -27,7 +27,7 @@
27 {% if constant('MOBI') == 1 %}<li><a href="./?mobi&amp;method=id&amp;value={{ entry.id|e }}" title="Generate Mobi file">MOBI</a></li>{% endif %} 27 {% if constant('MOBI') == 1 %}<li><a href="./?mobi&amp;method=id&amp;value={{ entry.id|e }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
28 {% if constant('PDF') == 1 %}<li><a href="./?pdf&amp;method=id&amp;value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %} 28 {% if constant('PDF') == 1 %}<li><a href="./?pdf&amp;method=id&amp;value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %}
29 <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> 29 <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>
30 {% if navigate.next %}<li><a href="./?view=view&amp;id={{ navigate.nextid|e }}" class="tool icon icon-next"><span>{% trans "Next Article" %}</span></a></li>{% endif %} 30 {% if navigate.previous %}<li class="rightPosF"><a href="./?view=view&amp;id={{ navigate.previousid|e }}" class="tool icon icon-next"><span>{% trans "Previous Article" %}</span></a></li>{% endif %}
31 </ul> 31 </ul>
32 </div> 32 </div>
33 <div id="article"> 33 <div id="article">
@@ -103,5 +103,6 @@
103 retrievePercent({{ entry.id|e }}); 103 retrievePercent({{ entry.id|e }});
104 }); 104 });
105 }); 105 });
106 navigateKeyboard('?view=view&id={{ navigate.nextid|e }}','?view=view&id={{ navigate.previousid|e }}');
106 </script> 107 </script>
107{% endblock %} 108{% endblock %}
diff --git a/themes/default/_head.twig b/themes/default/_head.twig
index 91a555cb..f3c9d886 100755
--- a/themes/default/_head.twig
+++ b/themes/default/_head.twig
@@ -33,4 +33,5 @@
33 <script src="{{ poche_url }}themes/_global/js/autoClose.js"></script> 33 <script src="{{ poche_url }}themes/_global/js/autoClose.js"></script>
34 <script src="{{ poche_url }}themes/default/js/closeMessage.js"></script> 34 <script src="{{ poche_url }}themes/default/js/closeMessage.js"></script>
35 <script src="{{ poche_url }}themes/_global/js/saveLink.js"></script> 35 <script src="{{ poche_url }}themes/_global/js/saveLink.js"></script>
36 <script src="{{ poche_url }}themes/_global/js/keyboard.js"></script>
36 <script src="{{ poche_url }}themes/_global/js/popupForm.js"></script> 37 <script src="{{ poche_url }}themes/_global/js/popupForm.js"></script>
diff --git a/themes/default/view.twig b/themes/default/view.twig
index 0d4ec174..9c9d1561 100755
--- a/themes/default/view.twig
+++ b/themes/default/view.twig
@@ -5,7 +5,7 @@
5 {% include '_pocheit-form.twig' %} 5 {% include '_pocheit-form.twig' %}
6 <div id="article_toolbar"> 6 <div id="article_toolbar">
7 <ul> 7 <ul>
8 {% if navigate.previous %}<li><a href="./?view=view&amp;id={{ navigate.previousid|e }}" class="tool previous"><span>{% trans "Previous Article" %}</span></a></li>{% endif %} 8 {% if navigate.next %}<li><a href="./?view=view&amp;id={{ navigate.nextid|e }}" class="tool previous"><span>{% trans "Next Article" %}</span></a></li>{% endif %}
9 <li><a href="./" title="{% trans "Return home" %}" class="tool back"><span>{% trans "Return home" %}</span></a></li> 9 <li><a href="./" title="{% trans "Return home" %}" class="tool back"><span>{% trans "Return home" %}</span></a></li>
10 <li><a href="#top" title="{% trans "Back to top" %}" class="tool top"><span>{% trans "Back to top" %}</span></a></li> 10 <li><a href="#top" title="{% trans "Back to top" %}" class="tool top"><span>{% trans "Back to top" %}</span></a></li>
11 <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 href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}" class="tool link"><span>{{ entry.url | e | getDomain }}</span></a></li>
@@ -27,7 +27,7 @@
27 {% if constant('PDF') == 1 %}<li><a href="./?pdf&amp;method=id&amp;value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %} 27 {% if constant('PDF') == 1 %}<li><a href="./?pdf&amp;method=id&amp;value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %}
28 <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> 28 <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>
29 {% if constant('SHOW_READPERCENT') == 1 %}<li><div id="readLeftPercent">0%</div></li>{% endif %} 29 {% if constant('SHOW_READPERCENT') == 1 %}<li><div id="readLeftPercent">0%</div></li>{% endif %}
30 {% if navigate.next %}<li><a href="./?view=view&amp;id={{ navigate.nextid|e }}" class="tool next"><span>{% trans "Next Article" %}</span></a></li>{% endif %} 30 {% if navigate.previous %}<li><a href="./?view=view&amp;id={{ navigate.previousid|e }}" class="tool next"><span>{% trans "Previous Article" %}</span></a></li>{% endif %}
31 </ul> 31 </ul>
32 </div> 32 </div>
33 <div id="article"> 33 <div id="article">
@@ -125,5 +125,6 @@
125 $('#article_toolbar .tool.top').parent().hide(); 125 $('#article_toolbar .tool.top').parent().hide();
126 } 126 }
127 }); 127 });
128 navigateKeyboard('?view=view&id={{ navigate.nextid|e }}','?view=view&id={{ navigate.previousid|e }}');
128 </script> 129 </script>
129{% endblock %} 130{% endblock %}