ContextMenuEx@Firefoxで使ってたスクリプトがFirefox1.5になってから使えなくなって、エントリ作成がえらく面倒になった。
つーことで何とかすべく適当な拡張機能漁ってたらCopy+がよさそうだなと。
参考:
mozdev.org – copyurlplus: index
plant4 – Firefox拡張copyurlplusのメモ


公式のCustomizeのリンクを開いたら
mozdev.org – copyurlplus: customize

As of version 1.1, Copy URL+ allows you to add your own menu entries. By simply adding a couple of entries to the user.js file, you can create countless custom entries.
For each menu entry you need to have in addition to the standard three, you will need to add two lines to the user.js file situated in your Mozilla/Firefox profile folder.

と、user.jsで独自拡張ができるらしい。
ということでやってみる。


基本的な書式は以下。

user_pref(‘copyurlplus.menus.n.label’, {メニューに表示するラベル});
user_pref(‘copyurlplus.menus.n.copy’, ‘{コピーするデータフォーマット}’);

フォーマットに使える変数は次のもの

  • %URL%
    開いているページのURL
  • %TITLE%
    開いているページのタイトル
  • %SEL%
    選択されている範囲のテキスト

これでContextMenuExで使ったスクリプトを定義。


user_pref(‘copyurlplus.menus.1.label’,’BLOG-Link Title/URL’);
user_pref(‘copyurlplus.menus.1.copy’,'<a href="%URL%"target="_blank">%TITLE%</a>’);
user_pref(‘copyurlplus.menus.2.label’,’BLOG-Link Title/URL with Selection’);
user_pref(‘copyurlplus.menus.2.copy’,'<a href="%URL%" target="_blank">%TITLE%</a>%EOL%<blockquote>%EOL%%EOL%%SEL%%EOL%</blockquote>’);
user_pref(‘copyurlplus.menus.3.label’,’BLOG-Link Title/URL with Selection(Cite)’);
user_pref(‘copyurlplus.menus.3.copy’,'<blockquote cite="%URL%" title="%TITLE%">%EOL%%EOL%%SEL%%EOL%<cite><a href="%URL%" target="_blank">%TITLE%</a></cite>%EOL%</blockquote>’);
user_pref(‘copyurlplus.menus.4.label’,’BLOG-Quote Selection’);
user_pref(‘copyurlplus.menus.4.copy’,'<blockquote>%EOL%%EOL%%SEL%%EOL%</blockquote>’);
user_pref(‘copyurlplus.menus.5.label’,’Hatena-Link Title/URL’);
user_pref(‘copyurlplus.menus.5.copy’,'[%URL%:title=%TITLE%]’);
user_pref(‘copyurlplus.menus.6.label’,’Hatena–Link Title/URL with Selection(Cite)’);
user_pref(‘copyurlplus.menus.6.copy’,’><blockquote cite="%URL%" title="%TITLE%"><%EOL%%EOL%%SEL%%EOL%></blockquote><‘);
user_pref(‘copyurlplus.menus.7.label’,’Wiki-Link Title/URL’);
user_pref(‘copyurlplus.menus.7.copy’,'[[%TITLE%:%URL%]]’);
user_pref(‘copyurlplus.menus.8.label’,’Wiki-Link Title/URL with Selection’);
user_pref(‘copyurlplus.menus.8.copy’,'[[%TITLE%:%URL%]]%EOL%>%EOL%%EOL%%SEL%%EOL%<‘);
user_pref(‘copyurlplus.menus.9.label’,’util-Selection HTMLified’);
user_pref(‘copyurlplus.menus.9.copy’,’%SEL_HTMLIFIED%’);