Removing code duplication

This commit is contained in:
Tim van der Meij 2013-07-18 13:37:55 +02:00
parent 5fa609584e
commit 22120005b7

View File

@ -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;