Mercurial > hg > index.fcgi > www > www-1
annotate pics2/np_keys.js @ 78:f833a888c548
add cookie-based PIN system, and update laterlinks to use it
author | paulo |
---|---|
date | Thu, 02 Jun 2016 00:27:50 -0700 |
parents | |
children |
rev | line source |
---|---|
paulo@56 | 1 function getKeypress(e) { |
paulo@56 | 2 c = null |
paulo@56 | 3 |
paulo@56 | 4 if (e.which == null) |
paulo@56 | 5 c = String.fromCharCode(e.keyCode); // IE |
paulo@56 | 6 else if (e.which != 0 && e.charCode != 0) |
paulo@56 | 7 c = String.fromCharCode(e.which); // All others |
paulo@56 | 8 |
paulo@56 | 9 if (c != null) { |
paulo@56 | 10 if (c == 'n') |
paulo@56 | 11 goHref('next'); |
paulo@56 | 12 else if (c == 'p') |
paulo@56 | 13 goHref('prev'); |
paulo@56 | 14 else if (c == 'u') |
paulo@56 | 15 goHref('up'); |
paulo@56 | 16 } |
paulo@56 | 17 } |
paulo@56 | 18 |
paulo@56 | 19 function goHref(id) { |
paulo@56 | 20 window.location.href = document.getElementById(id).href; |
paulo@56 | 21 } |
paulo@56 | 22 |
paulo@56 | 23 document.onkeypress = getKeypress |