diff options
author | anekos | 2015-04-20 22:39:39 +0900 |
---|---|---|
committer | anekos | 2015-04-20 22:45:32 +0900 |
commit | 9ef5e617d2bce18ebc90ba394c2b0f223a044842 (patch) | |
tree | f1ed4610a459c1a3d9c33eb06b6b330d033c9631 /google-exopen.js | |
parent | 2e1dd53e9e8e0d6d422dad781ce3f1f22eda6dde (diff) | |
download | vimperator-plugins-9ef5e617d2bce18ebc90ba394c2b0f223a044842.tar.bz2 |
オリジナルのアクションを使う
Diffstat (limited to 'google-exopen.js')
-rw-r--r-- | google-exopen.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/google-exopen.js b/google-exopen.js index 543bdf3..bb345b5 100644 --- a/google-exopen.js +++ b/google-exopen.js @@ -11,20 +11,24 @@ let PLUGIN_INFO = xml` // }}} (function () { + let original = mappings.getDefault(modes.NORMAL, 'o'); + mappings.addUserMap( [modes.NORMAL],['o'],':open', function() { // urlを取得 var url = window.content.window.location; - // コマンドの引数 - var commandPram = ''; // google検索か判定 - if(url.host === 'www.google.co.jp') { - // クエリ部の抜き出し - var q = decodeURI(url.href).match(/q=(.*?)&/); - // foo+bar+hogeの形で取得されるので'+'を' 'で置き換え - var commandPram = q[1].replace(/\+/g,' '); + if(url.host !== 'www.google.co.jp') { + return original.action.apply(this, arguments); } + + // クエリ部の抜き出し + var q = decodeURI(url.href).match(/q=(.*?)&/); + // コマンドの引数 + // foo+bar+hogeの形で取得されるので'+'を' 'で置き換え + var commandPram = q[1].replace(/\+/g,' '); + // コマンドの生成 var command = 'open ' + commandPram; commandline.open('', |