From a469e8265ab5121bdb83935e977c8a89777572b0 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 18 Apr 2015 15:47:38 +0100 Subject: Activate vomnibar in window.top; add "labs" option. --- background_scripts/settings.coffee | 2 ++ content_scripts/vimium_frontend.coffee | 15 ++++++++------- pages/options.coffee | 1 + pages/options.html | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/background_scripts/settings.coffee b/background_scripts/settings.coffee index 3528e8a9..50a6a9f4 100644 --- a/background_scripts/settings.coffee +++ b/background_scripts/settings.coffee @@ -114,6 +114,8 @@ root.Settings = Settings = searchEngines: "w: http://www.wikipedia.org/w/index.php?title=Special:Search&search=%s wikipedia" newTabUrl: "chrome://newtab" grabBackFocus: false + # Vimium Labs settings + vomnibarInTopFrame: false settingsVersion: Utils.getCurrentVersion() diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 81e0e3b2..95c508ef 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -44,7 +44,7 @@ settings = loadedValues: 0 valuesToLoad: [ "scrollStepSize", "linkHintCharacters", "linkHintNumbers", "filterLinkHints", "hideHud", "previousPatterns", "nextPatterns", "regexFindMode", "userDefinedLinkHintCss", - "helpDialog_showAdvancedCommands", "smoothScroll", "grabBackFocus" ] + "helpDialog_showAdvancedCommands", "smoothScroll", "grabBackFocus", "vomnibarInTopFrame" ] isLoaded: false eventListeners: {} @@ -254,7 +254,7 @@ initializeOnDomReady = -> # Tell the background page we're in the dom ready state. chrome.runtime.connect({ name: "domReady" }) CursorHider.init() - Vomnibar.init() if DomUtils.isTopFrame() + Vomnibar.init() # if DomUtils.isTopFrame() registerFrame = -> # Don't register frameset containers; focusing them is no use. @@ -273,11 +273,12 @@ unregisterFrame = -> executePageCommand = (request) -> # Vomnibar commands are handled in the tab's main/top frame. if request.command.split(".")[0] == "Vomnibar" - if DomUtils.isTopFrame() - # We pass the frameId from request. That's the frame which originated the request, so that's the frame - # which should receive the focus when the vomnibar closes. - Utils.invokeCommandString request.command, [ request.frameId ] - refreshCompletionKeys request + if (DomUtils.isTopFrame() and settings.get "vomnibarInTopFrame") or + (frameId == request.frameId and not settings.get "vomnibarInTopFrame") + # We pass the frameId from request. That's the frame which originated the request, so that's the frame + # which should receive the focus when the vomnibar closes. + Utils.invokeCommandString request.command, [ request.frameId ] + refreshCompletionKeys request return # All other commands are handled in their frame. diff --git a/pages/options.coffee b/pages/options.coffee index d2950348..55b5b63a 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -261,6 +261,7 @@ initOptionsPage = -> searchEngines: TextOption searchUrl: NonEmptyTextOption userDefinedLinkHintCss: TextOption + vomnibarInTopFrame: CheckBoxOption # Populate options. The constructor adds each new object to "Option.all". for name, type of options diff --git a/pages/options.html b/pages/options.html index f89ddcbb..19298189 100644 --- a/pages/options.html +++ b/pages/options.html @@ -70,6 +70,11 @@ b: http://b.com/?q=%s description Show advanced options… + + +
Advanced Options
+ + Scroll step size @@ -233,6 +238,35 @@ b: http://b.com/?q=%s description
+ + +
Vimium Labs
+

+ These features are awesome! However, they're also not yet fully baked. They might + not always work, may be subject to substantial change in a future release, and could even be + withdrawn entirely. +

+ +

+ Please provide feedback or suggestions on + github. +

+ + + + Experiments + +
+
+ On pages with multiple frames, always open a full-size vomnibar in the tab's main frame. +
+
+ + +
-- cgit v1.2.3