aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2018-02-14 09:37:58 +0000
committerGitHub2018-02-14 09:37:58 +0000
commitdc68113c223babd75d808d32d318f69cc85b3b41 (patch)
treebf0dea2f76fcb4617439ca72b6f7e347fff09c2a
parentb9a84b2edf83c74de89c128b1a31a08982b41e32 (diff)
parent2128ef3a4b6bb989323200578b230dfb1e178c2e (diff)
downloadvimium-dc68113c223babd75d808d32d318f69cc85b3b41.tar.bz2
Merge pull request #2951 from smblott-github/add-count-for-reload
Make the reload command accept a count.
-rw-r--r--background_scripts/commands.coffee2
-rw-r--r--background_scripts/main.coffee9
-rw-r--r--content_scripts/mode_normal.coffee5
3 files changed, 11 insertions, 5 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index f3ae3bd9..0573b9c1 100644
--- a/background_scripts/commands.coffee
+++ b/background_scripts/commands.coffee
@@ -336,7 +336,7 @@ commandDescriptions =
scrollFullPageDown: ["Scroll a full page down"]
scrollFullPageUp: ["Scroll a full page up"]
- reload: ["Reload the page", { noRepeat: true }]
+ reload: ["Reload the page", { background: true }]
toggleViewSource: ["View page source", { noRepeat: true }]
copyCurrentUrl: ["Copy the current URL to the clipboard", { noRepeat: true }]
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 70d97ca0..78bfce4c 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -235,6 +235,15 @@ BackgroundCommands =
tabIds = BgUtils.tabRecency.getTabsByRecency().filter (tabId) -> tabId != tab.id
if 0 < tabIds.length
selectSpecificTab id: tabIds[(count-1) % tabIds.length]
+ reload: ({count, tabId, registryEntry, tab: {windowId}})->
+ bypassCache = registryEntry.options.hard ? false
+ chrome.tabs.query {windowId}, (tabs) ->
+ position = do ->
+ for tab, index in tabs
+ return index if tab.id == tabId
+ tabs = [tabs[position...]..., tabs[...position]...]
+ count = Math.min count, tabs.length
+ chrome.tabs.reload tab.id, {bypassCache} for tab in tabs[...count]
# Remove tabs before, after, or either side of the currently active tab
removeTabsRelative = (direction, {tab: activeTab}) ->
diff --git a/content_scripts/mode_normal.coffee b/content_scripts/mode_normal.coffee
index 1fe0618e..0cfcfc66 100644
--- a/content_scripts/mode_normal.coffee
+++ b/content_scripts/mode_normal.coffee
@@ -59,10 +59,7 @@ NormalModeCommands =
scrollLeft: (count) -> Scroller.scrollBy "x", -1 * Settings.get("scrollStepSize") * count
scrollRight: (count) -> Scroller.scrollBy "x", Settings.get("scrollStepSize") * count
- # Page state.
- reload: (count, options) ->
- hard = options.registryEntry.options.hard ? false
- window.location.reload(hard)
+ # Tab navigation: back, forward.
goBack: (count) -> history.go(-count)
goForward: (count) -> history.go(count)