From ae73ad02e936f66bb894fca5da13a631bcd14d31 Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Sun, 30 Jan 2011 02:11:58 -0800 Subject: Split the help dialog into common commands and advanced commands. This closes #284 --- background_page.html | 11 ++++++----- commands.js | 16 ++++++++++++---- helpDialog.html | 40 +++++++++++++++++++++++++++++++++++++--- vimiumFrontend.js | 8 +++++++- 4 files changed, 62 insertions(+), 13 deletions(-) diff --git a/background_page.html b/background_page.html index ac83a0c3..87b3c9ad 100644 --- a/background_page.html +++ b/background_page.html @@ -195,11 +195,12 @@ var html = []; for (var i = 0; i < commandGroups[group].length; i++) { var command = commandGroups[group][i]; - bindings = (commandsToKey[command] || [""]).join(", ") - if (showUnboundCommands || commandsToKey[command]) - { - html.push("", escapeHtml(bindings), - ":", availableCommands[command].description); + bindings = (commandsToKey[command] || [""]).join(", "); + if (showUnboundCommands || commandsToKey[command]) { + html.push( + "", + "", escapeHtml(bindings), "", + ":", availableCommands[command].description); if (showCommandNames) html.push("(" + command + ")"); diff --git a/commands.js b/commands.js index ac1e1a44..d7066bd1 100644 --- a/commands.js +++ b/commands.js @@ -149,7 +149,7 @@ function clearKeyMappingsAndSetDefaults() { // This is a mapping of: commandIdentifier => [description, options]. var commandDescriptions = { - // Navigating the current page: + // Navigating the current page showHelp: ["Show help", { background: true }], scrollDown: ["Scroll down"], scrollUp: ["Scroll up"], @@ -187,14 +187,14 @@ var commandDescriptions = { goPrevious: ["Follow the link labeled previous or <"], goNext: ["Follow the link labeled next or >"], - // Navigating your history: + // Navigating your history goBack: ["Go back in history"], goForward: ["Go forward in history"], // Navigating the URL hierarchy goUp: ["Go up the URL hierarchy", { passCountToFunction: true }], - // Manipulating tabs: + // Manipulating tabs nextTab: ["Go one tab right", { background: true }], previousTab: ["Go one tab left", { background: true }], createTab: ["Create new tab", { background: true }], @@ -226,4 +226,12 @@ var commandGroups = { ["nextTab", "previousTab", "createTab", "removeTab", "restoreTab"], misc: ["showHelp"] -}; \ No newline at end of file +}; + +// 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 +// from Vimium will uncover these gems. +var advancedCommands = [ + "scrollToLeft", "scrollToRight", + "zoomReset", "goUp", "focusInput", "activateLinkHintsModeWithQueue", + "goPrevious", "goNext"]; \ No newline at end of file diff --git a/helpDialog.html b/helpDialog.html index ee35fc9b..dac1fb56 100644 --- a/helpDialog.html +++ b/helpDialog.html @@ -55,9 +55,10 @@ font-weight:bold; padding-top:3px; } - #vimiumHelpDialog .commandName { - font-family:"courier new"; - } + #vimiumHelpDialog .commandName { font-family:"courier new"; } + /* Advanced commands are hidden by default until you show them. */ + #vimiumHelpDialog .advanced { display: none; } + #vimiumHelpDialog .advanced td:nth-of-type(3) { color: #555; } #vimiumHelpDialog .closeButton { position:absolute; right:10px; @@ -79,7 +80,13 @@ cursor:default; -webkit-user-select:none; } + #vimiumHelpDialogFooter { position: relative; } #vimiumHelpDialogFooter * { font-size:10px; } + #vimiumHelpDialogFooter .toggleAdvancedCommands { + position: absolute; + right: 2px; + top: -34px; + }