diff options
-rw-r--r-- | phpfspot.js | 32 | ||||
-rw-r--r-- | themes/default/templates/single_photo.tpl | 2 |
2 files changed, 33 insertions, 1 deletions
diff --git a/phpfspot.js b/phpfspot.js index 26e5090..1b1f05d 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -418,6 +418,38 @@ function update_sort_order(obj) } // update_sort_order() +function keyDown(e) { + var evt = (e) ? e:(window.event) ? window.event:null; + + if(evt) { + var key = (evt.charCode) ? evt.charCode : + ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0)); + + + if(key == 37) /* left curosr */ { + if(document.getElementById('prev_link')) { + var prev_link = document.getElementById('prev_link').href; + window.location.href = prev_link; + } + return; + } + if(key == 38) /* up cursor */ { + } + if(key == 39) /* right curosr */ { + if(document.getElementById('next_link')) { + var next_link = document.getElementById('next_link').href; + window.location.href = next_link; + } + return; + } + } +} + +document.onkeydown=keyDown; +if(document.layers) { + document.captureEvents(Event.KEYDOWN); +} + var startup = 1; var calendar_shown = 0; var calendar_mode = ''; diff --git a/themes/default/templates/single_photo.tpl b/themes/default/templates/single_photo.tpl index 4e1a44e..c87118a 100644 --- a/themes/default/templates/single_photo.tpl +++ b/themes/default/templates/single_photo.tpl @@ -48,7 +48,7 @@ <hr> { if $prev_img } <u><img src="resources/photo.png" alt="photo icon" /> Previous:</u><br /> - <a href="{$previous_url}" onclick="click(this);"> + <a href="{$previous_url}" onclick="click(this);" id="prev_link"> <img src="phpfspot_img.php?idx={$prev_img}&width={$mini_width}" /><br /> </a> { /if} |