Mercurial > hg > index.fcgi > www > www-1
diff pics3/static/np_keys.js @ 124:9b57b90aea31
initial add for pics3
author | paulo |
---|---|
date | Thu, 25 Mar 2021 00:33:42 -0700 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/pics3/static/np_keys.js Thu Mar 25 00:33:42 2021 -0700 1.3 @@ -0,0 +1,23 @@ 1.4 +function getKeypress(e) { 1.5 + c = null 1.6 + 1.7 + if (e.which == null) 1.8 + c = String.fromCharCode(e.keyCode); // IE 1.9 + else if (e.which != 0 && e.charCode != 0) 1.10 + c = String.fromCharCode(e.which); // All others 1.11 + 1.12 + if (c != null) { 1.13 + if (c == 'n') 1.14 + goHref('next'); 1.15 + else if (c == 'p') 1.16 + goHref('prev'); 1.17 + else if (c == 'u') 1.18 + goHref('up'); 1.19 + } 1.20 +} 1.21 + 1.22 +function goHref(id) { 1.23 + window.location.href = document.getElementById(id).href; 1.24 +} 1.25 + 1.26 +document.onkeypress = getKeypress