From 6cb8a82b7cf7d6930b669fae74e1751a1e87567d Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Wed, 25 Oct 2017 01:04:58 +0100 Subject: Move goPrevious and goNext to normal mode file --- content_scripts/mode_normal.coffee | 10 ++++++++++ content_scripts/vimium_frontend.coffee | 13 ++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/content_scripts/mode_normal.coffee b/content_scripts/mode_normal.coffee index 3ddbf294..8547c9e5 100644 --- a/content_scripts/mode_normal.coffee +++ b/content_scripts/mode_normal.coffee @@ -125,6 +125,16 @@ NormalModeCommands = else new PassNextKeyMode count + goPrevious: -> + previousPatterns = Settings.get("previousPatterns") || "" + previousStrings = previousPatterns.split(",").filter( (s) -> s.trim().length ) + findAndFollowRel("prev") || findAndFollowLink(previousStrings) + + goNext: -> + nextPatterns = Settings.get("nextPatterns") || "" + nextStrings = nextPatterns.split(",").filter( (s) -> s.trim().length ) + findAndFollowRel("next") || findAndFollowLink(nextStrings) + focusInput: (count) -> # Focus the first input element on the page, and create overlays to highlight all the input elements, with # the currently-focused element highlighted specially. Tabbing will shift focus to the next input element. diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 2cdaa6c5..5549664e 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -460,16 +460,6 @@ findAndFollowRel = (value) -> followLink(element) return true -root.goPrevious = -> - previousPatterns = Settings.get("previousPatterns") || "" - previousStrings = previousPatterns.split(",").filter( (s) -> s.trim().length ) - findAndFollowRel("prev") || findAndFollowLink(previousStrings) - -root.goNext = -> - nextPatterns = Settings.get("nextPatterns") || "" - nextStrings = nextPatterns.split(",").filter( (s) -> s.trim().length ) - findAndFollowRel("next") || findAndFollowLink(nextStrings) - # If we are in the help dialog iframe, then HelpDialog is already defined with the necessary functions. root.HelpDialog ?= helpUI: null @@ -494,7 +484,8 @@ root.Frame = Frame root.windowIsFocused = windowIsFocused root.bgLog = bgLog # These are exported for find mode and link-hints mode. -extend root, {focusFoundLink, selectFoundInputElement, focusThisFrame, FocusSelector} +extend root, {focusFoundLink, selectFoundInputElement, focusThisFrame, FocusSelector, + findAndFollowRel, findAndFollowLink} # These are exported only for the tests. extend root, {installModes} extend window, root unless exports? -- cgit v1.2.3