diff options
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/commands.coffee | 40 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 18 |
2 files changed, 31 insertions, 27 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 2999ebfc..184f3bb0 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -118,27 +118,26 @@ Commands = pageNavigation: ["scrollDown", "scrollUp", - "scrollLeft", - "scrollRight", "scrollToTop", "scrollToBottom", - "scrollToLeft", - "scrollToRight", "scrollPageDown", "scrollPageUp", "scrollFullPageUp", "scrollFullPageDown", + "scrollLeft", + "scrollRight", + "scrollToLeft", + "scrollToRight", "reload", - "toggleViewSource", "copyCurrentUrl", "openCopiedUrlInCurrentTab", "openCopiedUrlInNewTab", "goUp", "goToRoot", "enterInsertMode", - "passNextKey", "enterVisualMode", "enterVisualLineMode", + "passNextKey", "focusInput", "LinkHints.activateMode", "LinkHints.activateModeToOpenInNewTab", @@ -156,32 +155,33 @@ Commands = vomnibarCommands: ["Vomnibar.activate", "Vomnibar.activateInNewTab", - "Vomnibar.activateTabSelection", "Vomnibar.activateBookmarks", "Vomnibar.activateBookmarksInNewTab", + "Vomnibar.activateTabSelection", "Vomnibar.activateEditUrl", "Vomnibar.activateEditUrlInNewTab"] findCommands: ["enterFindMode", "performFind", "performBackwardsFind"] historyNavigation: ["goBack", "goForward"] tabManipulation: - ["nextTab", + ["createTab", "previousTab", + "nextTab", "visitPreviousTab", "firstTab", "lastTab", - "createTab", "duplicateTab", + "togglePinTab", "removeTab", "restoreTab", "moveTabToNewWindow", - "togglePinTab", "closeTabsOnLeft","closeTabsOnRight", "closeOtherTabs", "moveTabLeft", "moveTabRight"] misc: - ["showHelp"] + ["showHelp", + "toggleViewSource"] # Rarely used commands are not shown by default in the help dialog or in the README. The goal is to present # a focused, high-signal set of commands to the new and casual user. Only those truly hungry for more power @@ -192,12 +192,12 @@ Commands = "moveTabToNewWindow", "goUp", "goToRoot", - "focusInput", "LinkHints.activateModeWithQueue", "LinkHints.activateModeToDownloadLink", "Vomnibar.activateEditUrl", "Vomnibar.activateEditUrlInNewTab", "LinkHints.activateModeToOpenIncognito", + "LinkHints.activateModeToCopyLinkUrl", "goNext", "goPrevious", "Marks.activateCreateMode", @@ -207,6 +207,8 @@ Commands = "closeTabsOnLeft", "closeTabsOnRight", "closeOtherTabs", + "enterVisualLineMode", + "toggleViewSource", "passNextKey"] defaultKeyMappings = @@ -306,8 +308,8 @@ commandDescriptions = scrollToLeft: ["Scroll all the way to the left", { noRepeat: true }] scrollToRight: ["Scroll all the way to the right", { noRepeat: true }] - scrollPageDown: ["Scroll a page down"] - scrollPageUp: ["Scroll a page up"] + scrollPageDown: ["Scroll a half page down"] + scrollPageUp: ["Scroll a half page up"] scrollFullPageDown: ["Scroll a full page down"] scrollFullPageUp: ["Scroll a full page up"] @@ -323,7 +325,7 @@ commandDescriptions = enterVisualMode: ["Enter visual mode", { noRepeat: true }] enterVisualLineMode: ["Enter visual line mode", { noRepeat: true }] - focusInput: ["Focus the first text box on the page. Cycle between them using tab"] + focusInput: ["Focus the first text input on the page"] "LinkHints.activateMode": ["Open a link in the current tab"] "LinkHints.activateModeToOpenInNewTab": ["Open a link in a new tab"] @@ -370,16 +372,16 @@ commandDescriptions = moveTabLeft: ["Move tab to the left", { background: true }] moveTabRight: ["Move tab to the right", { background: true }] - "Vomnibar.activate": ["Open URL, bookmark, or history entry", { topFrame: true }] - "Vomnibar.activateInNewTab": ["Open URL, bookmark, history entry, in a new tab", { topFrame: true }] + "Vomnibar.activate": ["Open URL, bookmark or history entry", { topFrame: true }] + "Vomnibar.activateInNewTab": ["Open URL, bookmark or history entry in a new tab", { topFrame: true }] "Vomnibar.activateTabSelection": ["Search through your open tabs", { topFrame: true }] "Vomnibar.activateBookmarks": ["Open a bookmark", { topFrame: true }] "Vomnibar.activateBookmarksInNewTab": ["Open a bookmark in a new tab", { topFrame: true }] "Vomnibar.activateEditUrl": ["Edit the current URL", { topFrame: true }] "Vomnibar.activateEditUrlInNewTab": ["Edit the current URL and open in a new tab", { topFrame: true }] - nextFrame: ["Cycle forward to the next frame on the page", { background: true }] - mainFrame: ["Select the tab's main/top frame", { topFrame: true, noRepeat: true }] + nextFrame: ["Select the next frame on the page", { background: true }] + mainFrame: ["Select the page's main/top frame", { topFrame: true, noRepeat: true }] "Marks.activateCreateMode": ["Create a new mark", { noRepeat: true }] "Marks.activateGotoMode": ["Go to a mark", { noRepeat: true }] diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 3e1cc0a3..dca9df7e 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -91,6 +91,7 @@ getHelpDialogHtml = ({showUnboundCommands, showCommandNames, customTitle}) -> replacementStrings = version: currentVersion title: customTitle || "Help" + tip: if showCommandNames then "Tip: click command names to yank them to the clipboard." else " " for own group of Commands.commandGroups replacementStrings[group] = @@ -106,11 +107,12 @@ helpDialogHtmlForCommandGroup = (group, commandsToKey, availableCommands, showUnboundCommands, showCommandNames) -> html = [] for command in Commands.commandGroups[group] - bindings = (commandsToKey[command] || [""]).join(", ") + keys = commandsToKey[command] || [] + bindings = ("<span class='vimiumHelpDialogKey'>#{Utils.escapeHtml key}</span>" for key in keys).join ", " if (showUnboundCommands || commandsToKey[command]) isAdvanced = Commands.advancedCommands.indexOf(command) >= 0 description = availableCommands[command].description - if bindings.length < 12 + if keys.join(", ").length < 12 helpDialogHtmlForCommand html, isAdvanced, bindings, description, showCommandNames, command else # If the length of the bindings is too long, then we display the bindings on a separate row from the @@ -122,11 +124,11 @@ helpDialogHtmlForCommandGroup = (group, commandsToKey, availableCommands, helpDialogHtmlForCommand = (html, isAdvanced, bindings, description, showCommandNames, command) -> html.push "<tr class='vimiumReset #{"advanced" if isAdvanced}'>" if description - html.push "<td class='vimiumReset'>", Utils.escapeHtml(bindings), "</td>" - html.push "<td class='vimiumReset'>#{if description and bindings then ':' else ''}</td><td class='vimiumReset'>", description - html.push("<span class='vimiumReset commandName'>(#{command})</span>") if showCommandNames + html.push "<td class='vimiumReset'>#{bindings}</td>" + html.push "<td class='vimiumReset'></td><td class='vimiumReset vimiumHelpDescription'>", description + html.push("(<span class='vimiumReset commandName'>#{command}</span>)") if showCommandNames else - html.push "<td class='vimiumReset' colspan='3' style='text-align: left;'>", Utils.escapeHtml(bindings) + html.push "<td class='vimiumReset' colspan='3' style='text-align: left;'>", bindings html.push("</td></tr>") # Cache "content_scripts/vimium.css" in chrome.storage.local for UI components. @@ -364,10 +366,10 @@ HintCoordinator = for own frameId, port of @tabState[tabId].ports @postMessage tabId, parseInt(frameId), messageType, port, request - prepareToActivateMode: (tabId, originatingFrameId, {modeIndex}) -> + prepareToActivateMode: (tabId, originatingFrameId, {modeIndex, isVimiumHelpDialog}) -> @tabState[tabId] = {frameIds: frameIdsForTab[tabId][..], hintDescriptors: {}, originatingFrameId, modeIndex} @tabState[tabId].ports = extend {}, portsForTab[tabId] - @sendMessage "getHintDescriptors", tabId, {modeIndex} + @sendMessage "getHintDescriptors", tabId, {modeIndex, isVimiumHelpDialog} # Receive hint descriptors from all frames and activate link-hints mode when we have them all. postHintDescriptors: (tabId, frameId, {hintDescriptors}) -> |
