From 22120005b7610614d030f445a753efaae3cf4892 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Thu, 18 Jul 2013 13:37:55 +0200 Subject: [PATCH] Removing code duplication --- web/viewer.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/web/viewer.js b/web/viewer.js index 02c7f6fd2..b4d409b3c 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -2973,12 +2973,18 @@ window.addEventListener('keydown', function keydown(evt) { if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) { // either CTRL or META key with optional SHIFT. switch (evt.keyCode) { - case 70: + case 70: // f if (!PDFView.supportsIntegratedFind) { PDFFindBar.toggle(); handled = true; } break; + case 71: // g + if (!PDFView.supportsIntegratedFind) { + PDFFindBar.dispatchEvent('again', cmd === 5 || cmd === 12); + handled = true; + } + break; case 61: // FF/Mac '=' case 107: // FF '+' and '=' case 187: // Chrome '+' @@ -3000,18 +3006,6 @@ window.addEventListener('keydown', function keydown(evt) { } } - // CTRL or META with or without SHIFT. - if (cmd == 1 || cmd == 8 || cmd == 5 || cmd == 12) { - switch (evt.keyCode) { - case 71: // g - if (!PDFView.supportsIntegratedFind) { - PDFFindBar.dispatchEvent('again', cmd == 5 || cmd == 12); - handled = true; - } - break; - } - } - if (handled) { evt.preventDefault(); return;