From aec03312b0f3d170e666e506205168709c305189 Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 17 Mar 2011 17:46:42 -0700 Subject: Don't gobble escape unless we're on a Google domain -- for the good people at Quora. --- vimiumFrontend.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 2ab54427..cc97da93 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -44,6 +44,7 @@ var textInputXPath = '//input[' + frameId = Math.floor(Math.random()*999999999) var hasModifiersRegex = /^<([amc]-)+.>/; +var googleRegex = /:\/\/[^/]*google[^/]+/; function getSetting(key) { if (!settingPort) @@ -399,8 +400,8 @@ function onKeydown(event) { exitInsertMode(); // Added to prevent Google Instant from reclaiming the keystroke and putting us back into the search box. - // TOOD(ilya): Revisit this. Not sure it's the absolute best approach. - event.stopPropagation(); + if (isGoogleSearch()) + event.stopPropagation(); } } else if (findMode) @@ -459,6 +460,12 @@ function checkIfEnabledForUrl() { }); } +// TODO(ilya): This just checks if "google" is in the domain name. Probably should be more targeted. +function isGoogleSearch() { + var url = window.location.toString(); + return !!url.match(googleRegex); +} + function refreshCompletionKeys(response) { if (response) { currentCompletionKeys = response.completionKeys; -- cgit v1.2.3