Operaのメニュー

こんなカスタマイズしてますよ、っていう……。

履歴

2010年6月23日
キーボードの機能のところ追加
2012年11月9日
Opera 12.10 まで正常動作しています。あらためて明記。
2013年2月14日
escape title/escape text を追加。UNICODE 文字列を prompt に出すと Windows ではシステムのエンコードと違うので文字化けしてしまう。UNICODE の数字の文字列参照に変換するためのメニューです。Opera 12.14 で動作確認。
2013年11月22日
ちゃんとUNICODEに対応したエディタなら心配ないが、対応してないエディタを使っているので、〜をそのままコピーするのではなく〜の文字列参照に置換するように変更した。

[Hotclick Popup Menu]

以下の二つを追加。まあ、工夫すれば色々作れるのでボチボチ増やすかも。(2009-04-07T23:29:31+09:00)さらに二つ追加。boopleはISBNを選択して実行します。

(2009年10月1日)Opera 10.0 からはlocation.href を encodeURI しなくてもよくなりました。新旧両方載せておきます。

(2010年3月27日)Opera 10.51 では URL Encode の % をさらにエスケープする必要があります。%22 を %%22 とします。

Opera 10.51 用


Item, "Aタグ"	= Go to page, "javascript:void(function(){prompt('','<a href=%%22'+(location.href)+'%%22 title=%%22'+document.getSelection()+'%%22>'+document.getSelection()+'</a>');})()" & Delay, 100 & Cut & Cancel
Item, "blockquoteタグ"	= Go to page, "javascript:void(function(){prompt('','<blockquote>'+document.getSelection()+'</blockquote>');})()" & Delay, 100 & Cut & Cancel
Item, "blockquote cite"	= Go to page, "javascript:void(function(){prompt('','<blockquote cite=%%22'+(location.href)+'%%22>'+document.getSelection()+'</blockquote>');})()" & Delay, 100 & Cut & Cancel
Item, "boople"	= Go to page, "javascript:void(function(){prompt('','<a href=%%22http://click.linksynergy.com/fs-bin/statform?id=2PX1VM3/1QY&offerid=33310&bnid=2&subid=0&ifc=4&ifr='+document.getSelection()+'%%22 title=%%22'+document.title.split('本: ')[1]+'%%22>'+document.title.split('本: ')[1]+'</a>');})()" & Delay, 100 & Cut & Cancel
Item, "escape text"	= Go to page, "javascript:void(function(){prompt('',escape(document.getSelection())replace(/%%u([0-9A-F]{4})/g, '&#x$1;'));})()" & Delay, 100 & Cut & Cancel

波ダッシュ(〜)を文字列参照に置換する場合


Item, "Aタグ"	= Go to page, "javascript:void(function(){prompt('','<a href=%%22'+(location.href)+'%%22 title=%%22'+document.getSelection().toString().replace(/\u301c/g, '&#x301C;')+'%%22>'+document.getSelection().toString().replace(/\u301c/g, '&#x301C;')+'</a>');})()" & Delay, 100 & Cut & Cancel

getSelection() は selectionRange オブジェクトを返すので、replace の前に toString() で文字列にしてやる必要がある。document.title では不要。

Opera 10 用


Item, "Aタグ"	= Go to page, "javascript:void(function(){prompt('','<a href=%22'+(location.href)+'%22 title=%22'+document.getSelection()+'%22>'+document.getSelection()+'</a>');})()" & Delay, 100 & Cut & Cancel
Item, "blockquoteタグ"	= Go to page, "javascript:void(function(){prompt('','<blockquote>'+document.getSelection()+'</blockquote>');})()" & Delay, 100 & Cut & Cancel
Item, "blockquote cite"	= Go to page, "javascript:void(function(){prompt('','<blockquote cite=%22'+(location.href)+'%22>'+document.getSelection()+'</blockquote>');})()" & Delay, 100 & Cut & Cancel
Item, "boople"	= Go to page, "javascript:void(function(){prompt('','<a href=%22http://click.linksynergy.com/fs-bin/statform?id=2PX1VM3/1QY&offerid=33310&bnid=2&subid=0&ifc=4&ifr='+document.getSelection()+'%22 title=%22'+document.title.split('本: ')[1]+'%22>'+document.title.split('本: ')[1]+'</a>');})()" & Delay, 100 & Cut & Cancel

Opera 9 用


Item, "Aタグ"	= Go to page, "javascript:void(function(){prompt('','<a href=%22'+encodeURI(location.href)+'%22 title=%22'+document.getSelection()+'%22>'+document.getSelection()+'</a>');})()" & Delay, 100 & Cut & Cancel
Item, "blockquoteタグ"	= Go to page, "javascript:void(function(){prompt('','<blockquote>'+document.getSelection()+'</blockquote>');})()" & Delay, 100 & Cut & Cancel
Item, "blockquote cite"	= Go to page, "javascript:void(function(){prompt('','<blockquote cite=%22'+encodeURI(location.href)+'%22>'+document.getSelection()+'</blockquote>');})()" & Delay, 100 & Cut & Cancel
Item, "boople"	= Go to page, "javascript:void(function(){prompt('','<a href=%22http://click.linksynergy.com/fs-bin/statform?id=2PX1VM3/1QY&offerid=33310&bnid=2&subid=0&ifc=4&ifr='+document.getSelection()+'%22 title=%22'+document.title.split('本: ')[1]+'%22>'+document.title.split('本: ')[1]+'</a>');})()" & Delay, 100 & Cut & Cancel

[Link Selection Popup Menu]

Opera 10.51 用


Item, "Aタグ"	= Go to page, "javascript:void(function(){prompt('','<a href=%%22'+(location.href)+'%%22 title=%%22'+document.getSelection()+'%%22>'+document.getSelection()+'</a>');})()" & Delay, 100 & Cut & Cancel
Item, "blockquoteタグ"	= Go to page, "javascript:void(function(){prompt('','<blockquote>'+document.getSelection()+'</blockquote>');})()" & Delay, 100 & Cut & Cancel

Opera 10 用


Item, "Aタグ"	= Go to page, "javascript:void(function(){prompt('','<a href=%22'+(location.href)+'%22 title=%22'+document.getSelection()+'%22>'+document.getSelection()+'</a>');})()" & Delay, 100 & Cut & Cancel
Item, "blockquoteタグ"	= Go to page, "javascript:void(function(){prompt('','<blockquote>'+document.getSelection()+'</blockquote>');})()" & Delay, 100 & Cut & Cancel

Opera 9 用


Item, "Aタグ"	= Go to page, "javascript:void(function(){prompt('','<a href=%22'+encodeURI(location.href)+'%22 title=%22'+document.getSelection()+'%22>'+document.getSelection()+'</a>');})()" & Delay, 100 & Cut & Cancel
Item, "blockquoteタグ"	= Go to page, "javascript:void(function(){prompt('','<blockquote>'+document.getSelection()+'</blockquote>');})()" & Delay, 100 & Cut & Cancel

上と同じです。注意してほしいのは別にリンク先のURIを参照してないこと。

[Document Popup Menu]

こちらは Opera 10 用のみです。何も選択してなくてもhtmlのタイトルでリンク作成。

Opera 10.51


Item, "Aタグ"				= Go to page, "javascript:void(function(){prompt('','<a href=%%22'+(location.href)+'%%22 title=%%22'+document.title+'%%22>'+document.title+'</a>');})()" & Delay, 100 & Cut & Cancel
Item, "escape title"				= Go to page, "javascript:void(function(){prompt('',escape(document.title).replace(/%%u([0-9A-F]{4})/g, '&#x$1;'));})()" & Delay, 100 & Cut & Cancel

Opera 10


Item, "Aタグ"				= Go to page, "javascript:void(function(){prompt('','<a href=%22'+(location.href)+'%22 title=%22'+document.title+'%22>'+document.title+'</a>');})()" & Delay, 100 & Cut & Cancel

キーボードショートカット

以前のバージョンにあった、「戻るの履歴表示」「進むの履歴表示」は以下の機能を割り当てる。(2012年11月9日)こちらはボタン長押しなどで表示できるようになったので意味はないかもしれないが……。

Show popup menu, "Internal Back History"
Show popup menu, "Internal Forward History"

参考