diff options
| -rw-r--r-- | commands.js | 14 | ||||
| -rw-r--r-- | fuzzyMode.js | 18 |
2 files changed, 19 insertions, 13 deletions
diff --git a/commands.js b/commands.js index 269deb14..9f8a4d92 100644 --- a/commands.js +++ b/commands.js @@ -141,10 +141,10 @@ function clearKeyMappingsAndSetDefaults() { "x": "removeTab", "X": "restoreTab", - "o": "fuzzyMode.activateAll", - "O": "fuzzyMode.activateAllNewTab", + "o": "fuzzyMode.activate", + "O": "fuzzyMode.activateWithCurrentUrl", - "T": "fuzzyMode.activateTabs", + "T": "fuzzyMode.activateTabSelection", "gf": "nextFrame", }; @@ -184,7 +184,7 @@ var commandDescriptions = { focusInput: ["Focus the first (or n-th) text box on the page", { passCountToFunction: true }], 'linkHints.activateMode': ["Open a link in the current tab"], - 'linkHints.activateModeToOpenInNewTab': ["Open a link in a new tab"], + 'linkHints.activateWithCurrentUrl': ["Open a link in a new tab"], 'linkHints.activateModeWithQueue': ["Open multiple links in a new tab"], enterFindMode: ["Enter find mode"], @@ -210,9 +210,9 @@ var commandDescriptions = { removeTab: ["Close current tab", { background: true }], restoreTab: ["Restore closed tab", { background: true }], - 'fuzzyMode.activateAll': ["Open URL, bookmark, history entry or a custom search (fuzzy)"], - 'fuzzyMode.activateAllNewTab': ["Open URL, bookmark, history entry or a custom search (fuzzy, new tab)"], - 'fuzzyMode.activateTabs': ["Go to a tab in this window (fuzzy)"], + "fuzzyMode.activate": ["Open URL, bookmark, or history entry"], + "fuzzyMode.activateWithCurrentUrl": ["Open URL, bookmark, history entry, starting with the current URL"], + "fuzzyMode.activateTabSelection": ["Search through your open tabs"], nextFrame: ["Cycle forward to the next frame on the page", { background: true, passCountToFunction: true }] }; diff --git a/fuzzyMode.js b/fuzzyMode.js index 0233652a..4b682058 100644 --- a/fuzzyMode.js +++ b/fuzzyMode.js @@ -8,14 +8,18 @@ var fuzzyMode = (function() { return completers[name]; } - /** Trigger the fuzzy mode dialog */ - function start(name, refreshInterval) { - var completer = getCompleter(name); + /* + * Activate the Vomnibox. + */ + function activate(completerName, refreshInterval, initialQueryValue) { + var completer = getCompleter(completerName); if (!fuzzyBox) fuzzyBox = new FuzzyBox(10); completer.refresh(); fuzzyBox.setCompleter(completer); fuzzyBox.setRefreshInterval(refreshInterval); + if (initialQueryValue) + fuzzyBox.setQuery(initialQueryValue); fuzzyBox.show(); } @@ -28,6 +32,8 @@ var fuzzyMode = (function() { this.initDom(); }, + setQuery: function(query) { this.input.value = query; }, + setCompleter: function(completer) { this.completer = completer; this.reset(); @@ -211,8 +217,8 @@ var fuzzyMode = (function() { // public interface return { - activateAll: function() { start("omni", 100); }, - activateAllNewTab: function() { start("omni", 100); }, - activateTabs: function() { start("tabs", 0); }, + activate: function() { activate("omni", 100); }, + activateWithCurrentUrl: function() { activate("omni", 100, window.location.toString()); }, + activateTabSelection: function() { activate("tabs", 0); } } })(); |
