Last change
on this file since 14729 was
12534,
checked in by plg, 13 years ago
|
bug fixed: keyboard navigation available on Luciano (thanks to sichr.net for the tip)
bug fixed: compatibility with Google+1 plugin on picture.php
|
File size:
1.7 KB
|
Rev | Line | |
---|
[12534] | 1 | {* Allows going thru the photogallery using left/right keys *} |
---|
| 2 | |
---|
| 3 | <script type="text/javascript">// <![CDATA[ |
---|
| 4 | {literal} |
---|
| 5 | function keyboardNavigation(e) |
---|
| 6 | { |
---|
| 7 | if(!e) e=window.event; |
---|
| 8 | if (e.altKey) return true; |
---|
| 9 | var target = e.target || e.srcElement; |
---|
| 10 | if (target && target.type) return true; //an input editable element |
---|
| 11 | var keyCode=e.keyCode || e.which; |
---|
| 12 | var docElem = document.documentElement; |
---|
| 13 | switch(keyCode) { |
---|
| 14 | {/literal} |
---|
| 15 | {if isset($next)} |
---|
| 16 | case 63235: case 39: if (e.ctrlKey || docElem.scrollLeft==docElem.scrollWidth-docElem.clientWidth ){ldelim}window.location="{$next.U_IMG}".replace( "&", "&" ); return false; } break; |
---|
| 17 | {/if} |
---|
| 18 | {if isset($previous)} |
---|
| 19 | case 63234: case 37: if (e.ctrlKey || docElem.scrollLeft==0){ldelim}window.location="{$previous.U_IMG|@escape:jasvascript}".replace("&","&"); return false; } break; |
---|
| 20 | {/if} |
---|
| 21 | {if isset($first)} |
---|
| 22 | /*Home*/case 36: if (e.ctrlKey){ldelim}window.location="{$first.U_IMG|@escape:jasvascript}".replace("&","&"); return false; } break; |
---|
| 23 | {/if} |
---|
| 24 | {if isset($last)} |
---|
| 25 | /*End*/case 35: if (e.ctrlKey){ldelim}window.location="{$last.U_IMG|@escape:jasvascript}".replace("&","&"); return false; } break; |
---|
| 26 | {/if} |
---|
| 27 | {if isset($U_UP) and !isset($slideshow)} |
---|
| 28 | /*Up*/case 38: if (e.ctrlKey){ldelim}window.location="{$U_UP|@escape:jasvascript}".replace("&","&"); return false; } break; |
---|
| 29 | {/if} |
---|
| 30 | |
---|
| 31 | {if isset($slideshow.U_START_PLAY)} |
---|
| 32 | /*Pause*/case 32: {ldelim}window.location="{$slideshow.U_START_PLAY|@escape:jasvascript}".replace("&","&"); return false; } break; |
---|
| 33 | {/if} |
---|
| 34 | {if isset($slideshow.U_STOP_PLAY)} |
---|
| 35 | /*Play*/case 32: {ldelim}window.location="{$slideshow.U_STOP_PLAY|@escape:jasvascript}".replace("&","&"); return false; } break; |
---|
| 36 | {/if} |
---|
| 37 | } |
---|
| 38 | return true; |
---|
| 39 | } |
---|
| 40 | document.onkeydown=keyboardNavigation; |
---|
| 41 | // ]]></script> |
---|
Note: See
TracBrowser
for help on using the repository browser.