Created
January 25, 2010 07:25
-
-
Save mooz/285701 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// サジェスト付き検索 | |
// Google, Wikipedia などが使用可能 | |
// s を入力するとエンジン選択画面が開く。 j/k で上下へ。 Enter や s で決定。 | |
// エンジンを決定したら検索語句を入力する画面へ。ここで文字を入力して TAB を押すとサジェストの結果で補完される。 | |
key.setViewKey('s', function (ev, arg) { | |
let engines = util.suggest.getEngines(); | |
// If you want to use all available suggest engines, | |
// change suggestEngines value to util.suggest.filterEngines(engines); | |
let suggestEngines = [util.suggest.ss.getEngineByName("Google")]; | |
let collection = engines.map( | |
function (engine) [(engine.iconURI || {spec:""}).spec, engine.name, engine.description] | |
); | |
prompt.selector( | |
{ | |
message : "engine:", | |
collection : collection, | |
flags : [ICON | IGNORE, 0, 0], | |
header : ["Name", "Description"], | |
keymap : { | |
"s" : "prompt-decide", | |
"j" : "prompt-next-completion", | |
"k" : "prompt-previous-completion" | |
}, | |
callback : function (i) { | |
if (i >= 0) | |
util.suggest.searchWithSuggest(engines[i], suggestEngines, "tab"); | |
} | |
}); | |
}, "Search With Suggest", true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment