From 18b323f96796a02b4ef36b7041a8cac18b0c1fbd Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 26 Mar 2016 11:27:55 +0000 Subject: Pass count to find commands. With this change, now *every* front-end command either accepts a count argument, or or it doesn't accept a count at all. --- content_scripts/vimium_frontend.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 66eebfdd..0a683083 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -503,8 +503,8 @@ findAndFocus = (backwards) -> else HUD.showForDuration("No matches for '#{FindMode.query.rawQuery}'", 1000) -performFind = -> findAndFocus false -performBackwardsFind = -> findAndFocus true +performFind = (count) -> findAndFocus false for [0...count] by 1 +performBackwardsFind = (count) -> findAndFocus true for [0...count] by 1 getLinkFromSelection = -> node = window.getSelection().anchorNode -- cgit v1.2.3 From 068b6513bc3226e4ef07e8cfb1ef2d5fb0ae2cc4 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 26 Mar 2016 11:34:40 +0000 Subject: This parameter wasn't being used. --- content_scripts/marks.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'content_scripts') diff --git a/content_scripts/marks.coffee b/content_scripts/marks.coffee index 067d05a8..ba0467b0 100644 --- a/content_scripts/marks.coffee +++ b/content_scripts/marks.coffee @@ -52,7 +52,7 @@ Marks = localStorage[@getLocationKey keyChar] = @getMarkString() @showMessage "Created local mark", keyChar - activateGotoMode: (registryEntry) -> + activateGotoMode: -> @mode = new Mode name: "goto-mark" indicator: "Go to mark..." -- cgit v1.2.3 From 5ab004ba38019aea32408af2bff422e6f01a7430 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 26 Mar 2016 11:45:56 +0000 Subject: passCountToCommand isn't needed. We pass the count to *all* front-end commands. All of the commands which don't use a count, just ignore it. --- content_scripts/vimium_frontend.coffee | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 0a683083..6297c729 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -121,10 +121,8 @@ class NormalMode extends KeyHandlerMode handler: "sendMessageToFrames", message: {name: "runInTopFrame", sourceFrameId: frameId, registryEntry} else if registryEntry.background chrome.runtime.sendMessage {handler: "runBackgroundCommand", frameId, registryEntry, count} - else if registryEntry.passCountToFunction - Utils.invokeCommandString registryEntry.command, [count] else - Utils.invokeCommandString registryEntry.command for i in [0...count] + Utils.invokeCommandString registryEntry.command, [count] installModes = -> # Install the permanent modes. The permanently-installed insert mode tracks focus/blur events, and -- cgit v1.2.3 From b3f9dc520a8f7245db44f843b3994d5e32b19eeb Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 26 Mar 2016 11:57:41 +0000 Subject: Simplify invokeCommandString(). There's no need to have the previous unusual calling style (passing the arguments as a list. It looks more natural to pass tham just as regular arguments, as here. --- content_scripts/vimium_frontend.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 6297c729..659acdca 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -122,7 +122,7 @@ class NormalMode extends KeyHandlerMode else if registryEntry.background chrome.runtime.sendMessage {handler: "runBackgroundCommand", frameId, registryEntry, count} else - Utils.invokeCommandString registryEntry.command, [count] + Utils.invokeCommandString registryEntry.command, count installModes = -> # Install the permanent modes. The permanently-installed insert mode tracks focus/blur events, and @@ -153,7 +153,7 @@ initializePreDomReady = -> frameFocused: -> checkEnabledAfterURLChange: checkEnabledAfterURLChange runInTopFrame: ({sourceFrameId, registryEntry}) -> - Utils.invokeCommandString registryEntry.command, [sourceFrameId, registryEntry] if DomUtils.isTopFrame() + Utils.invokeCommandString registryEntry.command, sourceFrameId, registryEntry if DomUtils.isTopFrame() chrome.runtime.onMessage.addListener (request, sender, sendResponse) -> # These requests are intended for the background page, but they're delivered to the options page too. -- cgit v1.2.3