「任意の検索エンジンで検索」の版間の差分
非推奨のタグを修正 |
誤字の修正(ホップアップメニューの「ホップ」を「ポップ」に修正) |
||
| (同じ利用者による、間の2版が非表示) | |||
| 1行目: | 1行目: | ||
選択した文字をポップアップメニューから指定した検索エンジンで検索します。検索以外にも翻訳サイトを登録することで翻訳などもできます。 | |||
検索サイトの追加・削除も可能なので使いやすいよう自由にカスタマイズしてください。 | 検索サイトの追加・削除も可能なので使いやすいよう自由にカスタマイズしてください。 | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" copy> | ||
/** | /** | ||
* 任意の検索エンジンで検索するためのマクロ。 | * 任意の検索エンジンで検索するためのマクロ。 | ||
* | * | ||
* | * 選択した文字をポップアップメニューから指定した検索エンジンで検索します。 | ||
* 文字を選択していないと動作しません。 | * 文字を選択していないと動作しません。 | ||
*/ | */ | ||
| 13行目: | 13行目: | ||
// ここから下に検索エンジンを定義 ------------------------------------------------------------------ | // ここから下に検索エンジンを定義 ------------------------------------------------------------------ | ||
// 1:検索エンジン名, 2:検索URL(検索文字列を%1で記載) | // 1:検索エンジン名, 2:検索URL(検索文字列を%1で記載) | ||
f[f.length] = ["Google", "https://www.google. | f[f.length] = ["Google", "https://www.google.com/search?q=%1&ie=utf-8&oe=utf-8"]; | ||
f[f.length] = ["Yahoo! JAPAN", "https://search.yahoo.co.jp/search?p=%1&ei=UTF-8"]; | f[f.length] = ["Yahoo! JAPAN", "https://search.yahoo.co.jp/search?p=%1&ei=UTF-8"]; | ||
f[f.length] = ["Bing", "https://www.bing.com/search?q=%1"]; | f[f.length] = ["Bing", "https://www.bing.com/search?q=%1"]; | ||
f[f.length] = ["Wikipedia", "https://ja.wikipedia.org/wiki/%1"]; | f[f.length] = ["Wikipedia", "https://ja.wikipedia.org/wiki/%1"]; | ||
f[f.length] = ["Amazon.co.jp", "https://www.amazon.co.jp/s/ref=nb_sb_noss?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&url=search-alias%3Daps&field-keywords=%1"]; | f[f.length] = ["Amazon.co.jp", "https://www.amazon.co.jp/s/ref=nb_sb_noss?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&url=search-alias%3Daps&field-keywords=%1"]; | ||
f[f.length] = ["Twitter", "https:// | f[f.length] = ["X (Twitter)", "https://x.com/search?q=%1%20lang%3Aja"]; | ||
f[f.length] = ["Google翻訳(日本語→英語)", "https://translate.google.com/translate_t?hl=ja&langpair=ja%7Cen&text=%1"]; | f[f.length] = ["Google翻訳 (日本語→英語)", "https://translate.google.com/translate_t?hl=ja&langpair=ja%7Cen&text=%1"]; | ||
f[f.length] = ["Google翻訳(英語→日本語)", "https://translate.google.com/translate_t?hl=ja&langpair=en%7Cja&text=%1"]; | f[f.length] = ["Google翻訳 (英語→日本語)", "https://translate.google.com/translate_t?hl=ja&langpair=en%7Cja&text=%1"]; | ||
f[f.length] = ["Weblio 英和時点・和英辞典", "https://ejje.weblio.jp/content/%1"]; | f[f.length] = ["Weblio 英和時点・和英辞典", "https://ejje.weblio.jp/content/%1"]; | ||
// ここまで----------------------------------------------------------------------------------------- | // ここまで----------------------------------------------------------------------------------------- | ||
| 31行目: | 31行目: | ||
} | } | ||
// | // ポップアップメニューを作成 | ||
var menu = CreatePopupMenu(); | var menu = CreatePopupMenu(); | ||
for (var index = 0; index < f.length; index++) { | for (var index = 0; index < f.length; index++) { | ||
| 37行目: | 37行目: | ||
menu.Add(def[0], index + 1, 0); | menu.Add(def[0], index + 1, 0); | ||
} | } | ||
// | // ポップアップメニューのオープン | ||
var selectionIndex = menu.Track(mePosMouse); | var selectionIndex = menu.Track(mePosMouse); | ||
// 選択されていなければ終了 | // 選択されていなければ終了 | ||
スポンサーリンク