diff options
author | trapezoid | 2008-03-26 14:41:27 +0000 |
---|---|---|
committer | trapezoid | 2008-03-26 14:41:27 +0000 |
commit | 788db8e3829ce980fcc7bd2ac41759f2b659af93 (patch) | |
tree | 5b6690c2e277ca8f6740cb5089406a211eba48c6 | |
parent | 18bc7868c4ff782865eedba648f400fef387ea75 (diff) | |
download | vimperator-plugins-788db8e3829ce980fcc7bd2ac41759f2b659af93.tar.bz2 |
lang/javascript/vimperator-plugins/direct_hb.js: XUL/MigemoによるタグのMigemo検索の対応
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@8416 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | direct_hb.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/direct_hb.js b/direct_hb.js index 98bec69..7eb205f 100644 --- a/direct_hb.js +++ b/direct_hb.js @@ -1,5 +1,5 @@ // Vimperator plugin: 'Direct Hatena Bookmark'
-// Last Change: 21-Mar-2008. Jan 2008
+// Last Change: 26-Mar-2008. Jan 2008
// License: Creative Commons
// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid
// Parts:
@@ -8,9 +8,19 @@ // AutoPagerize(c) id:swdyh
//
// Hatena bookmark direct add script for vimperator0.6.*
+// for Migemo search: require XUL/Migemo Extension
(function(){
var isNormalize = true;
+ try{
+ var XMigemoCore = Components
+ .classes['@piro.sakura.ne.jp/xmigemo/factory;1']
+ .getService(Components.interfaces.pIXMigemoFactory)
+ .getService("ja");
+ }catch(ex){
+ var XMigemoCore = undefined;
+ }
+
function WSSEUtils(aUserName, aPassword){
this._init(aUserName, aPassword);
}
@@ -201,12 +211,14 @@ addHatenaBookmarks(hatenaUser,hatenaPassword,liberator.buffer.URL,arg,isNormalize);
},{
completer: function(filter){
- var match_result = filter.match(/(.*)\[(\w*)$/); //[all, commited , now inputting]
- var m = new RegExp("^" + match_result[2]);
+ //var match_result = filter.match(/(.*)\[(\w*)$/); //[all, commited , now inputting]
+ var match_result = filter.match(/(\[.*\])?(?:\[)?(.*)/); //[all, commited , now inputting]
+ //var m = new RegExp("^" + match_result[2]);
+ var m = new RegExp(XMigemoCore ? XMigemoCore.getRegExp(match_result[2]) : "^" + match_result[2]);
var completionList = [];
for(var i in liberator.plugins.hatena_tags)
if(m.test(liberator.plugins.hatena_tags[i])){
- completionList.push([match_result[1] + "[" + liberator.plugins.hatena_tags[i] + "]","Tag"]);
+ completionList.push([(match_result[1] || "") + "[" + liberator.plugins.hatena_tags[i] + "]","Tag"]);
}
return [0, completionList];
}
|