Galerie: přepínání fotek klávesnicí

This commit is contained in:
Matěj Kocián 2015-11-09 15:09:56 +01:00
parent daf6af4315
commit 03c8c1c8dd
2 changed files with 32 additions and 0 deletions

View file

@ -1,10 +1,39 @@
{% extends "galerie/Base.html" %} {% extends "galerie/Base.html" %}
{% block nadpis1a %} {% block nadpis1a %}
{{galerie.nazev}}: {{ obrazek.popis | default:"Fotka" }} {{galerie.nazev}}: {{ obrazek.popis | default:"Fotka" }}
{% endblock %} {% endblock %}
{% block script %}
{% with obrazky_predchozi|last as predchozi_obrazek %}
{% with obrazky_dalsi|first as dalsi_obrazek %}
<script type="text/javascript">
$(document).keydown(function(e) {
{% if predchozi_obrazek %}
// doleva
if (e.which == 37) {
window.location.assign("../{{ predchozi_obrazek.pk }}#nahoru");
}
{% endif %}
{% if dalsi_obrazek %}
// doprava
if (e.which == 39) {
window.location.assign("../{{ dalsi_obrazek.pk }}#nahoru");
}
{% endif %}
if (e.which == 27) {
window.location.assign("../#obsah")
}
})
</script>
{% endwith %}
{% endwith %}
{% endblock %}
{% block content %} {% block content %}
<h2> <h2>
{% for g in cesta %} {% for g in cesta %}
<a href="../../{{ g.pk }}">{{ g.nazev }}</a> > <a href="../../{{ g.pk }}">{{ g.nazev }}</a> >

View file

@ -29,6 +29,9 @@
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script> </script>
{# script specifický pro stránku #}
{% block script %}{% endblock %}
</head> </head>
<body class='{% if user.is_staff %}org-logged-in{% endif %}'> <body class='{% if user.is_staff %}org-logged-in{% endif %}'>
{% if user.is_staff %} {% if user.is_staff %}