annotate pics3/static/np_keys.js @ 124:9b57b90aea31

initial add for pics3
author paulo
date Thu, 25 Mar 2021 00:33:42 -0700
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