diff options
| -rw-r--r-- | .travis.yml | 2 | ||||
| -rw-r--r-- | README.markdown | 2 | ||||
| -rw-r--r-- | background_scripts/commands.coffee | 16 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 9 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 3 |
5 files changed, 24 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml index a66657cc..60c79466 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js node_js: 0.8 before_install: - - "sudo npm install -g coffee-script" + - "npm install -g coffee-script" - "cake build" script: "cake test" notifications: diff --git a/README.markdown b/README.markdown index d0cabeed..fb68bfd4 100644 --- a/README.markdown +++ b/README.markdown @@ -70,6 +70,7 @@ Manipulating tabs: g0 go to the first tab g$ go to the last tab t create tab + yt duplicate current tab x close current tab X restore closed tab (i.e. unwind the 'x' command) T search through your open tabs @@ -81,6 +82,7 @@ Additional advanced browsing commands: <a-f> open multiple links in a new tab gi focus the first (or n-th) text input box on the page gu go up one level in the URL hierarchy + gU go up to root of the URL hierarchy zH scroll all the way left zL scroll all the way right diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index dd9a938c..08496e6b 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -21,6 +21,7 @@ Commands = description: description isBackgroundCommand: options.background passCountToFunction: options.passCountToFunction + noRepeat: options.noRepeat mapKeyToCommand: (key, command) -> unless @availableCommands[command] @@ -31,6 +32,7 @@ Commands = command: command isBackgroundCommand: @availableCommands[command].isBackgroundCommand passCountToFunction: @availableCommands[command].passCountToFunction + noRepeat: @availableCommands[command].noRepeat unmapKey: (key) -> delete @keyToCommandRegistry[key] @@ -63,7 +65,7 @@ Commands = continue unless @availableCommands[vimiumCommand] - console.log("Mapping", key, "to", vimiumCommand) + konsole.log("Mapping", key, "to", vimiumCommand) @mapKeyToCommand(key, vimiumCommand) else if (lineCommand == "unmap") continue if (splitLine.length != 2) @@ -88,7 +90,7 @@ Commands = "scrollToTop", "scrollToBottom", "scrollToLeft", "scrollToRight", "scrollPageDown", "scrollPageUp", "scrollFullPageUp", "scrollFullPageDown", "reload", "toggleViewSource", "copyCurrentUrl", "LinkHints.activateModeToCopyLinkUrl", - "openCopiedUrlInCurrentTab", "openCopiedUrlInNewTab", "goUp", + "openCopiedUrlInCurrentTab", "openCopiedUrlInNewTab", "goUp", "goToRoot", "enterInsertMode", "focusInput", "LinkHints.activateMode", "LinkHints.activateModeToOpenInNewTab", "LinkHints.activateModeWithQueue", "Vomnibar.activate", "Vomnibar.activateInNewTab", "Vomnibar.activateTabSelection", @@ -98,7 +100,7 @@ Commands = historyNavigation: ["goBack", "goForward"] tabManipulation: - ["nextTab", "previousTab", "firstTab", "lastTab", "createTab", "removeTab", "restoreTab"] + ["nextTab", "previousTab", "firstTab", "lastTab", "createTab", "duplicateTab", "removeTab", "restoreTab"] misc: ["showHelp"] @@ -107,7 +109,7 @@ Commands = # from Vimium will uncover these gems. advancedCommands: [ "scrollToLeft", "scrollToRight", "moveTabToNewWindow", - "goUp", "focusInput", "LinkHints.activateModeWithQueue", + "goUp", "goToRoot", "focusInput", "LinkHints.activateModeWithQueue", "goPrevious", "goNext", "Marks.activateCreateMode", "Marks.activateGotoMode"] defaultKeyMappings = @@ -133,6 +135,7 @@ defaultKeyMappings = "H": "goBack" "L": "goForward" "gu": "goUp" + "gU": "goToRoot" "gi": "focusInput" @@ -162,6 +165,7 @@ defaultKeyMappings = "w": "moveTabToNewWindow" "t": "createTab" + "yt": "duplicateTab" "x": "removeTab" "X": "restoreTab" @@ -226,6 +230,7 @@ commandDescriptions = # Navigating the URL hierarchy goUp: ["Go up the URL hierarchy", { passCountToFunction: true }] + goToRoot: ["Go to root of current URL hierarchy", { passCountToFunction: true }] # Manipulating tabs nextTab: ["Go one tab right", { background: true }] @@ -233,7 +238,8 @@ commandDescriptions = firstTab: ["Go to the first tab", { background: true }] lastTab: ["Go to the last tab", { background: true }] createTab: ["Create new tab", { background: true }] - removeTab: ["Close current tab", { background: true }] + duplicateTab: ["Duplicate current tab", { background: true }] + removeTab: ["Close current tab", { background: true, noRepeat: true }] restoreTab: ["Restore closed tab", { background: true }] moveTabToNewWindow: ["Move tab to new window", { background: true }] diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 912117ff..431d84be 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -218,10 +218,13 @@ repeatFunction = (func, totalCount, currentCount, frameId) -> # mapped in commands.coffee. BackgroundCommands = createTab: (callback) -> chrome.tabs.create({ url: "chrome://newtab" }, (tab) -> callback()) - openTabInNewWindow: (callback) -> + duplicateTab: (callback) -> chrome.tabs.getSelected(null, (tab) -> - chrome.windows.create({tabId: tab.id}) + chrome.tabs.duplicate(tab.id) selectionChangedHandlers.push(callback)) + moveTabToNewWindow: (callback) -> + chrome.tabs.getSelected(null, (tab) -> + chrome.windows.create({tabId: tab.id})) nextTab: (callback) -> selectTab(callback, "next") previousTab: (callback) -> selectTab(callback, "previous") firstTab: (callback) -> selectTab(callback, "first") @@ -478,6 +481,8 @@ checkKeyQueue = (keysToCheck, tabId, frameId) -> else if registryEntry.passCountToFunction BackgroundCommands[registryEntry.command](count) + else if registryEntry.noRepeat + BackgroundCommands[registryEntry.command]() else repeatFunction(BackgroundCommands[registryEntry.command], count, 0, frameId) diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index ca7af5ae..1b97c30a 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -246,6 +246,9 @@ extend window, urlsplit = urlsplit.slice(0, Math.max(3, urlsplit.length - count)) window.location.href = urlsplit.join('/') + goToRoot: () -> + window.location.href = window.location.origin + toggleViewSource: -> chrome.extension.sendRequest { handler: "getCurrentTabUrl" }, (url) -> if (url.substr(0, 12) == "view-source:") |
