ぽっぺん日記@karashi.org
2008-04-10(Thu) [長年日記]
_ copy.jsのtemplateをvimperatorrcで設定できるpatchを書いた
autoIgnoreKey.jsがvimperatorrcにURLリストを書けるようになっていたので、それを参考にしてcopy.jsでもvimperatorrcでtemplateを指定できるようにしてみた。
説明書きはautoIgnoreKey.jsからもろパクリ。:-)
--- copy.js.orig 2008-04-03 03:56:46.000000000 +0900
+++ copy.js 2008-04-10 21:24:11.000002000 +0900
@@ -31,8 +31,25 @@
* %URL% -> to the URL of the current page
* %SEL% -> to the string of selection
* %HTMLSEL% -> to the html string of selection
+ *
+ * The copy_templates is a string variable which can set on
+ * vimperatorrc as following.
+ *
+ * let copy_templates = "[ {label:'titleAndURL', value:'%TITLE%\n%URL%'}, {label:'title', value:'%TITLE%'} ]"
+ *
+ * or your can set it using inline JavaScript.
+ *
+ * javascript <<EOM
+ * liberator.globalVariables.copy_templates = uneval([
+ * { label: 'titleAndURL', value: '%TITLE%\n%URL%' },
+ * { label: 'title', value: '%TITLE%' },
+ * { label: 'anchor', value: '<a href="%URL%">%TITLE%</a>' },
+ * { label: 'selanchor', value: '<a href="%URL%" title="%TITLE%">%SEL%</a>' },
+ * { label: 'htmlblockquote', value: '<blockquote cite="%URL%" title="%TITLE%">%HTMLSEL%</blockquote>' },
+ * ]);
+ * EOM
*/
-const templates = [
+const templates = window.eval(liberator.globalVariables.copy_templates) || [
{ label: 'titleAndURL', value: '%TITLE%\n%URL%' },
{ label: 'title', value: '%TITLE%' },
{ label: 'anchor', value: '<a href="%URL%">%TITLE%</a>' },
[]
本日のPingbacks(全0件)


まで頂ければ幸いです。
観音浄土に船出した人びと―熊野と補陀落渡海 (歴史文化ライブラリー 250)(根井 浄)
パッチありがとうございます。勝手ながら適用させていただきました。 <br>http://coderepos.org/share/changeset/9404
パッチの取り込みありがとうございます。 <br>copy_templatesという変数名はどうかなぁということで、codereposへのcommitを躊躇していたのですが、teramakoさんに採用して頂いたので安心しました。:-)