From d367e58a555606b7ad232fa880484cad8a2f7844 Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Wed, 11 Nov 2009 00:21:17 -0800 Subject: Implement zoom in and zoom out. The hotkey for zoom currently doesn't work, because it's beeing eaten by insert mode. --- background_page.html | 3 +++ vimiumFrontend.js | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/background_page.html b/background_page.html index 7ba89c41..a85d8a4f 100644 --- a/background_page.html +++ b/background_page.html @@ -129,6 +129,9 @@ keyToCommandRegistry['fo'] = 'goForward'; keyToCommandRegistry['L'] = 'goForward'; + keyToCommandRegistry['zi'] = 'zoomIn'; + keyToCommandRegistry['zo'] = 'zoomOut'; + keyToCommandRegistry['J'] = nextTab; keyToCommandRegistry['K'] = previousTab; diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 2166e5c7..d6223b32 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -17,6 +17,15 @@ function reload() { window.location.reload(); } function goBack() { history.back(); } function goForward() { history.forward(); } +// TODO(philc): This should be pulled from the extension's storage when the page loads. +var currentZoomLevel = 100; + +/* + * Zoom in increments of 20%; this matches chrome's CMD+ and CMD- keystrokes. + */ +function zoomIn() { document.body.style.zoom = (currentZoomLevel += 20) + "%"; } +function zoomOut() { document.body.style.zoom = (currentZoomLevel -= 20) + "%"; } + function initializeFrontend() { document.addEventListener("keydown", onKeydown); document.addEventListener("focus", onFocusCapturePhase, true); -- cgit v1.2.3