aboutsummaryrefslogtreecommitdiffstats
path: root/template
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-02-13 01:14:58 +0000
committerrvelices <rv-github@modusoptimus.com>2008-02-13 01:14:58 +0000
commit4cc7dfbffbdc120e144f70eff38afcf5d444eec8 (patch)
treece15367e1913c920df7b081f865a2daf2095a0bf /template
parent785dfabc00f74ad5405f0c237e55237e27c4db94 (diff)
feature 803: Implement keyboard navigation (left/right arrows) on the picture page
git-svn-id: http://piwigo.org/svn/trunk@2205 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--template/yoga/picture.tpl24
1 files changed, 24 insertions, 0 deletions
diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl
index e0c49d9af..3f7a59f5c 100644
--- a/template/yoga/picture.tpl
+++ b/template/yoga/picture.tpl
@@ -227,3 +227,27 @@
</div>
<!-- END comments -->
+
+<script type="text/javascript">
+<!-- BEGIN next -->
+var nextUrl = "{next.U_IMG}".replace( "&amp;", "&" );
+<!-- END next -->
+<!-- BEGIN previous -->
+var prevUrl = "{previous.U_IMG}".replace( "&amp;", "&" );
+<!-- END previous -->
+function keypress(e)
+{
+ if(!e) var e=window.event;
+ if (e.altKey) return true;
+ var target = e.target || e.srcElement;
+ if (target && target.type) return true; //an input editable element
+ var keyCode=e.keyCode || e.which;
+ var docElem = document.documentElement;
+ switch(keyCode) {
+ case 63235: case 39: if (nextUrl && (e.ctrlKey || docElem.scrollLeft==docElem.scrollWidth-docElem.clientWidth) ){window.location=nextUrl; return false; } break;
+ case 63234: case 37: if (prevUrl && (e.ctrlKey || docElem.scrollLeft==0) ){ window.location=prevUrl; return false; } break;
+ }
+ return true;
+}
+document.onkeydown = keypress;
+</script> \ No newline at end of file