From 2d3612150720a3431151c3236d91d921484f9449 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 30 Jul 2012 03:00:54 -0400 Subject: [PATCH] moved event.preventDefault() to end of if-codition --- lib/client/keyBinding.js | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/lib/client/keyBinding.js b/lib/client/keyBinding.js index 1282ea07..d596fa14 100644 --- a/lib/client/keyBinding.js +++ b/lib/client/keyBinding.js @@ -22,9 +22,7 @@ CloudCommander.keyBinding=(function(){ /* if f3 pressed */ else if(event.keyCode===114){ if (typeof CloudCommander.Viewer === 'function'){ - CloudCommander.Viewer(); - - event.preventDefault(); + CloudCommander.Viewer(); } } /* навигация по таблице файлов*/ @@ -54,9 +52,7 @@ CloudCommander.keyBinding=(function(){ lTop % (CloudCommander.HEIGHT - CloudCommander.HEIGHT/10) < 70 && - lCurrentFile.parentElement.scrollByLines(-2); - - event.preventDefault(); + lCurrentFile.parentElement.scrollByLines(-2); } } /* если нажали клавишу в низ*/ @@ -84,9 +80,7 @@ CloudCommander.keyBinding=(function(){ lMod < 70 && lMod > 50 && console.log(lCurrentFile .parentElement - .scrollByLines(2) || '!'); - - event.preventDefault(); + .scrollByLines(2) || '!'); } } /* если нажали клавишу page up или Home @@ -194,9 +188,7 @@ CloudCommander.keyBinding=(function(){ break; } } - } - - event.preventDefault();//запрет на дальнейшее действие + } } } /* если нажали +d чистим кэш */ @@ -207,9 +199,7 @@ CloudCommander.keyBinding=(function(){ console.log('press +q to remove all key-handlers'); var lClearCache=document.getElementById('clear-cache'); - if(lClearCache && lClearCache.onclick)lClearCache.onclick(); - - event.preventDefault();//запрет на дальнейшее действие + if(lClearCache && lClearCache.onclick)lClearCache.onclick(); } /* если нажали +q * убираем все обработчики @@ -243,9 +233,11 @@ CloudCommander.keyBinding=(function(){ console.log('+r reload key-handerl - set'); console.log('+s clear cache key-handler - set'); console.log('press +q to remove them'); - } - - return false; + } + + event.preventDefault();//запрет на дальнейшее действие + + return false; }; /* добавляем обработчик клавишь */ if(document.addEventListener)