--- /dev/null
+function navigateKeyboard(leftURL, rightURL) {
+ window.addEventListener("keypress", function (event) {
+ var key = event.which || event.keyCode; // event.keyCode is used for IE8 and earlier versions
+ console.log("key pressed : " + key);
+ switch (key) {
+ case 37:
+ // left arrow
+ if (leftURL != "?view=view&id=") {
+ window.location = window.location.origin + window.location.pathname + leftURL;
+ }
+ break;
+ /*
+ case 38:
+ // top arrow
+ window.location = window.location.origin + window.location.pathname + window.location.search + "#top";
+ break;
+ */
+ case 39:
+ //right arrow
+ if (rightURL != "?view=view&id=") {
+ window.location = window.location.origin + window.location.pathname + rightURL;
+ }
+ break;
+ }
+
+ }, false);
+}
\ No newline at end of file
<script src="{{ poche_url }}themes/{{theme}}/js/init.js"></script>
<script src="{{ poche_url }}themes/_global/js/saveLink.js"></script>
<script src="{{ poche_url }}themes/_global/js/popupForm.js"></script>
+ <script src="{{ poche_url }}themes/_global/js/keyboard.js"></script>
<script src="{{ poche_url }}themes/{{theme}}/js/closeMessage.js"></script>
font-size: 1.5em;
}
+.leftPosF {
+ position: fixed;
+ right: 24%;
+ bottom: 2em;
+ font-size: 1.5em;
+}
+
+.rightPosF {
+ position: fixed;
+ right: 16%;
+ bottom: 2em;
+ font-size: 1.5em;
+}
+
#article_toolbar {
margin-bottom: 1em;
}
.topPosF {
right: 2.5em;
}
+ .leftPosF {
+ right: 4.5em;
+ }
+ .rightPosF {
+ right: 0.5em;
+ }
}
@media screen and (max-width: 700px) {
display: none;
}
+ #article_toolbar .leftPosF {
+ display: none;
+ }
+
+ #article_toolbar .rightPosF {
+ display: none;
+ }
+
#article {
width: 100%;
}
<div id="article_toolbar">
<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>
- {% if navigate.previous %}<li><a href="./?view=view&id={{ navigate.previousid|e }}" class="tool icon icon-previous"><span>{% trans "Previous Article" %}</span></a></li>{% endif %}
+ {% if navigate.next %}<li class="leftPosF"><a href="./?view=view&id={{ navigate.nextid|e }}" class="top tool icon icon-previous"><span>{% trans "Next Article" %}</span></a></li>{% endif %}
<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="javascript: void(null);" id="markAsRead"><span>{% trans "Toggle mark as read" %}</span></a></li>
{% 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&id={{ entry.id|e }}" id="markAsReadAndNext"><span>{% trans "Toggle mark as read and go to next article" %}</span></a></li>{% endif %}
{% if constant('MOBI') == 1 %}<li><a href="./?mobi&method=id&value={{ entry.id|e }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
{% if constant('PDF') == 1 %}<li><a href="./?pdf&method=id&value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %}
<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 icon icon-delete"><span>{% trans "Does this article appear wrong?" %}</span></a></li>
- {% if navigate.next %}<li><a href="./?view=view&id={{ navigate.nextid|e }}" class="tool icon icon-next"><span>{% trans "Next Article" %}</span></a></li>{% endif %}
+ {% if navigate.previous %}<li class="rightPosF"><a href="./?view=view&id={{ navigate.previousid|e }}" class="tool icon icon-next"><span>{% trans "Previous Article" %}</span></a></li>{% endif %}
</ul>
</div>
<div id="article">
retrievePercent({{ entry.id|e }});
});
});
+ navigateKeyboard('?view=view&id={{ navigate.nextid|e }}','?view=view&id={{ navigate.previousid|e }}');
</script>
{% endblock %}
<script src="{{ poche_url }}themes/_global/js/autoClose.js"></script>
<script src="{{ poche_url }}themes/default/js/closeMessage.js"></script>
<script src="{{ poche_url }}themes/_global/js/saveLink.js"></script>
+ <script src="{{ poche_url }}themes/_global/js/keyboard.js"></script>
<script src="{{ poche_url }}themes/_global/js/popupForm.js"></script>
{% include '_pocheit-form.twig' %}
<div id="article_toolbar">
<ul>
- {% if navigate.previous %}<li><a href="./?view=view&id={{ navigate.previousid|e }}" class="tool previous"><span>{% trans "Previous Article" %}</span></a></li>{% endif %}
+ {% if navigate.next %}<li><a href="./?view=view&id={{ navigate.nextid|e }}" class="tool previous"><span>{% trans "Next Article" %}</span></a></li>{% endif %}
<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>
{% if constant('PDF') == 1 %}<li><a href="./?pdf&method=id&value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %}
<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>
{% if constant('SHOW_READPERCENT') == 1 %}<li><div id="readLeftPercent">0%</div></li>{% endif %}
- {% if navigate.next %}<li><a href="./?view=view&id={{ navigate.nextid|e }}" class="tool next"><span>{% trans "Next Article" %}</span></a></li>{% endif %}
+ {% if navigate.previous %}<li><a href="./?view=view&id={{ navigate.previousid|e }}" class="tool next"><span>{% trans "Previous Article" %}</span></a></li>{% endif %}
</ul>
</div>
<div id="article">
$('#article_toolbar .tool.top').parent().hide();
}
});
+ navigateKeyboard('?view=view&id={{ navigate.nextid|e }}','?view=view&id={{ navigate.previousid|e }}');
</script>
{% endblock %}