|
71 | 71 | return; |
72 | 72 | } |
73 | 73 |
|
74 | | - if (e.keyCode === 188 && $('#help').hasClass('hidden')) { // question mark |
| 74 | + if (e.which === 191 && $('#help').hasClass('hidden')) { // question mark |
75 | 75 | e.preventDefault(); |
76 | 76 | $('#help').removeClass('hidden'); |
77 | | - } else if (e.keyCode === 27) { // esc |
| 77 | + } else if (e.which === 27) { // esc |
78 | 78 | if (!$('#help').hasClass('hidden')) { |
79 | 79 | e.preventDefault(); |
80 | 80 | $('#help').addClass('hidden'); |
|
83 | 83 | $('#search').addClass('hidden'); |
84 | 84 | $('#main').removeClass('hidden'); |
85 | 85 | } |
86 | | - } else if (e.keyCode === 83) { // S |
| 86 | + } else if (e.which === 83) { // S |
87 | 87 | e.preventDefault(); |
88 | 88 | $('.search-input').focus(); |
89 | 89 | } |
|
361 | 361 | $(document).on('keypress.searchnav', function(e) { |
362 | 362 | var $active = $results.filter('.highlighted'); |
363 | 363 |
|
364 | | - if (e.keyCode === 38) { // up |
| 364 | + if (e.which === 38) { // up |
365 | 365 | e.preventDefault(); |
366 | 366 | if (!$active.length || !$active.prev()) { |
367 | 367 | return; |
368 | 368 | } |
369 | 369 |
|
370 | 370 | $active.prev().addClass('highlighted'); |
371 | 371 | $active.removeClass('highlighted'); |
372 | | - } else if (e.keyCode === 40) { // down |
| 372 | + } else if (e.which === 40) { // down |
373 | 373 | e.preventDefault(); |
374 | 374 | if (!$active.length) { |
375 | 375 | $results.first().addClass('highlighted'); |
376 | 376 | } else if ($active.next().length) { |
377 | 377 | $active.next().addClass('highlighted'); |
378 | 378 | $active.removeClass('highlighted'); |
379 | 379 | } |
380 | | - } else if (e.keyCode === 13) { // return |
| 380 | + } else if (e.which === 13) { // return |
381 | 381 | e.preventDefault(); |
382 | 382 | if ($active.length) { |
383 | 383 | document.location.href = $active.find('a').prop('href'); |
|
0 commit comments