diff options
| author | Niklas Baumstark | 2012-01-25 00:54:53 +0100 |
|---|---|---|
| committer | Niklas Baumstark | 2012-04-10 23:57:20 +0200 |
| commit | ff8e8aa0e22a474b950b551259d330a7705514c3 (patch) | |
| tree | b74601b97feeb1f80329f0154fd3396f36edf374 /fuzzyMode.js | |
| parent | c397fffc94f563f1475f37c90eefa154ac78a6e0 (diff) | |
| download | vimium-ff8e8aa0e22a474b950b551259d330a7705514c3.tar.bz2 | |
make refresh interval configurable
For example, tab completion can happen instantly while history completion shouldn't.
Diffstat (limited to 'fuzzyMode.js')
| -rw-r--r-- | fuzzyMode.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fuzzyMode.js b/fuzzyMode.js index cfa8656f..87b4470a 100644 --- a/fuzzyMode.js +++ b/fuzzyMode.js @@ -34,20 +34,21 @@ var fuzzyMode = (function() { } /** Trigger the fuzzy mode dialog */ - function start(name, reverseAction) { + function start(name, reverseAction, refreshInterval) { var completer = getCompleter(name); if (!fuzzyBox) - fuzzyBox = new FuzzyBox(10, 300); + fuzzyBox = new FuzzyBox(10); completer.refresh(); fuzzyBox.setCompleter(completer); + fuzzyBox.setRefreshInterval(refreshInterval); fuzzyBox.show(reverseAction); } /** User interface for fuzzy completion */ - var FuzzyBox = function(maxResults, refreshInterval) { + var FuzzyBox = function(maxResults) { this.prompt = '>'; this.maxResults = maxResults; - this.refreshInterval = refreshInterval; + this.refreshInterval = 0; this.initDom(); } FuzzyBox.prototype = { @@ -56,6 +57,10 @@ var fuzzyMode = (function() { this.reset(); }, + setRefreshInterval: function(refreshInterval) { + this.refreshInterval = refreshInterval; + }, + show: function(reverseAction) { this.reverseAction = reverseAction; this.box.style.display = 'block'; @@ -193,9 +198,9 @@ var fuzzyMode = (function() { // public interface return { - activateAll: function() { start('all', false); }, - activateAllNewTab: function() { start('all', true); }, - activateTabs: function() { start('tabsSorted', false); }, + activateAll: function() { start('all', false, 300); }, + activateAllNewTab: function() { start('all', true, 300); }, + activateTabs: function() { start('tabsSorted', false, 0); }, } })(); |
