From b3f37390bb8bbdcd89627608c379a055291e6ea6 Mon Sep 17 00:00:00 2001 From: teramako Date: Fri, 28 Nov 2008 15:17:56 +0000 Subject: follow CVS HEAD git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@25285 d0d07461-0603-4401-acd4-de1884942a52 --- tombloo.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'tombloo.js') diff --git a/tombloo.js b/tombloo.js index b71203f..e0ca491 100644 --- a/tombloo.js +++ b/tombloo.js @@ -43,14 +43,13 @@ function getContext(){ commands.addUserCommand(['tomblooAction'],'Execute Tombloo actions', function(arg){ - TomblooService.Tombloo.Service.actions[arg].execute(); + TomblooService.Tombloo.Service.actions[arg.string].execute(); },{ - completer: function(filter){ - var completionList = new Array(); - for(let name in TomblooService.Tombloo.Service.actions) - if(name.indexOf(filter) > -1) - completionList.push([name,name]); - return [0,completionList]; + completer: function(context){ + context.title = ['Tombloo Actions']; + context.completions = [[name,name] for(name in TomblooService.Tombloo.Service.actions)].filter(function($_){ + return this.test($_[0]); + }, new RegExp(context.filter, 'i')); } } ); @@ -60,13 +59,11 @@ commands.addUserCommand(['tombloo'],'Post by Tombloo', TomblooService.Tombloo.Service.share(getContext(),TomblooService.Tombloo.Service.extractors[arg.string],special); },{ bang: true, - completer: function(filter){ + completer: function(context){ var completionList = new Array(); var exts = TomblooService.Tombloo.Service.check(getContext()); - for(let i=0,l=exts.length; i < l; i++) - if(exts[i].name.indexOf(filter) > -1) - completionList.push([exts[i].name,exts[i].name]); - return [0,completionList]; + context.title = ['Tombloo']; + context.completions = [[exts[i].name, exts[i].name] for(i in exts)].filter(function($_) this.test($_[0]), new RegExp(context.filter, 'i')) } } ); -- cgit v1.2.3