annotate pics2/np_keys.js @ 123:b2aebd4994ea

myrss2: update FEEDS again to remove The Browser
author paulo
date Thu, 25 Mar 2021 00:23:17 -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