diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-02-15 22:10:45 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-02-15 22:10:45 +0000 |
commit | 8b69393986926fc37c510ce9d9450ea05d410d77 (patch) | |
tree | 224a61ab596acd3d822028aef3063763c5557490 | |
parent | 6112911c933f099423cabdbd3276f569ecc06903 (diff) |
enhance keyboard navigation on picture page (first,last,thumbs)
git-svn-id: http://piwigo.org/svn/trunk@2211 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | template/yoga/picture.tpl | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl index 3f7a59f5c..7c5f34231 100644 --- a/template/yoga/picture.tpl +++ b/template/yoga/picture.tpl @@ -229,25 +229,30 @@ <!-- END comments --> <script type="text/javascript"> +function keyboardNavigation(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) { <!-- BEGIN next --> -var nextUrl = "{next.U_IMG}".replace( "&", "&" ); + case 63235: case 39: if (e.ctrlKey || docElem.scrollLeft==docElem.scrollWidth-docElem.clientWidth ){window.location="{next.U_IMG}".replace( "&", "&" ); return false; } break; <!-- END next --> <!-- BEGIN previous --> -var prevUrl = "{previous.U_IMG}".replace( "&", "&" ); + case 63234: case 37: if (e.ctrlKey || docElem.scrollLeft==0){ window.location="{previous.U_IMG}".replace("&","&"); return false; } break; <!-- 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; +<!-- BEGIN first --> + /*Home*/case 36: if (e.ctrlKey){window.location="{first.U_IMG}".replace("&","&"); return false; } break; +<!-- END first --> +<!-- BEGIN last --> + /*End*/case 35: if (e.ctrlKey){window.location="{last.U_IMG}".replace("&","&"); return false; } break; +<!-- END last --> + /*Up*/case 38: if (e.ctrlKey){window.location="{U_UP}".replace("&","&"); return false; } break; + } + return true; } -document.onkeydown = keypress; +document.onkeydown=keyboardNavigation; </script>
\ No newline at end of file |