diff options
author | drry | 2008-11-12 02:01:38 +0000 |
---|---|---|
committer | drry | 2008-11-12 02:01:38 +0000 |
commit | fbe655104805ef1254b165401f780443e42f49b9 (patch) | |
tree | b45536d58a28af9ed064674d3f98131fb76b32fa /ubiquity.js | |
parent | f6c4d5bf4e997887f9c7c48c6f1025cb22b1bba1 (diff) | |
download | vimperator-plugins-fbe655104805ef1254b165401f780443e42f49b9.tar.bz2 |
* fixed regexes.
* backout [23154].
* et cetera.
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@23278 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'ubiquity.js')
-rw-r--r-- | ubiquity.js | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/ubiquity.js b/ubiquity.js index 1947ec5..0ed8f84 100644 --- a/ubiquity.js +++ b/ubiquity.js @@ -1,7 +1,7 @@ /** * ==VimperatorPlugin== * @name Ubiquity Glue - * @description viperator-plugin for Ubiquity + * @description Vimperator-plugin for Ubiquity * @depend Ubiquity (ubiquity@labs.mozilla.com) * @version 0.1.1a * ==/VimperatorPlugin== @@ -32,14 +32,14 @@ if (!Application.extensions.has(ubiquityID) || !Application.extensions.get(ubiqu Components.utils.reportError('Vimperator: UbiquityGlue: Ubiquity is not installed'); return null; } -function preExec(target,name,func){ +function preExec(target, name, func){ var original = target[name]; target[name] = function(){ - var result = func.apply(this,arguments); + var result = func.apply(this, arguments); var tmp = null; - if (result != false) tmp = original.apply(target,arguments); + if (result != false) tmp = original.apply(target, arguments); return tmp; - } + }; } preExec(events, 'onEscape', function(){ @@ -63,15 +63,14 @@ preExec(gUbiquity, 'openWindow', function(anchor, flag){ // ------------------------------------------------- // Command // ------------------------------------------------- -commands.addUserCommand(['ubi[quity]'],'Vimperator Ubiquity Glue', +commands.addUserCommand(['ubi[quity]'], 'Vimperator Ubiquity Glue', function(args){ - args = (typeof args.string == 'undefined') ? args: args.string; if (!args){ gUbiquity.openWindow(getBrowser(), true); return; } ubiquityManager.execute(args); - },{ + }, { completer: function(filter){ return ubiquityManager.completer(filter); } @@ -110,10 +109,10 @@ var ubiquityManager = { } }, completer: function(args){ - var matches = args.match(/([^\s]+)(?:\s+(.+)$)?/); + var matches = args.match(/(\S+)(?:\s+(.+)$)?/); var suggestions = []; - for (var cmd in this.commands){ - suggestions.push([cmd , this.commands[cmd].description]); + for (let cmd in this.commands){ + suggestions.push([cmd, this.commands[cmd].description]); } if (!matches){ return [0, suggestions]; |