Mercurial > hg > index.fcgi > www > www-1
annotate pics3/static/np_keys.js @ 134:e3dd2ebf1299
myrss2: FEEDS: add PBS NewHour, The Drive; update Nautilus; remove Roads & Kingdom
author | paulo |
---|---|
date | Mon, 14 Mar 2022 08:10:48 +0000 |
parents | |
children |
rev | line source |
---|---|
paulo@124 | 1 function getKeypress(e) { |
paulo@124 | 2 c = null |
paulo@124 | 3 |
paulo@124 | 4 if (e.which == null) |
paulo@124 | 5 c = String.fromCharCode(e.keyCode); // IE |
paulo@124 | 6 else if (e.which != 0 && e.charCode != 0) |
paulo@124 | 7 c = String.fromCharCode(e.which); // All others |
paulo@124 | 8 |
paulo@124 | 9 if (c != null) { |
paulo@124 | 10 if (c == 'n') |
paulo@124 | 11 goHref('next'); |
paulo@124 | 12 else if (c == 'p') |
paulo@124 | 13 goHref('prev'); |
paulo@124 | 14 else if (c == 'u') |
paulo@124 | 15 goHref('up'); |
paulo@124 | 16 } |
paulo@124 | 17 } |
paulo@124 | 18 |
paulo@124 | 19 function goHref(id) { |
paulo@124 | 20 window.location.href = document.getElementById(id).href; |
paulo@124 | 21 } |
paulo@124 | 22 |
paulo@124 | 23 document.onkeypress = getKeypress |