From 09bf47501775dca0fed73d874a4dd81b9539d719 Mon Sep 17 00:00:00 2001 From: teramako Date: Sun, 13 Apr 2008 11:20:52 +0000 Subject: lang/javascript/vimperator-plugins/trunk/copy.js: * vimperatorrcからテンプレートを読むように変更[[BR]](see [http://www.karashi.org/~poppen/d/20080410.html#p01]) * その他 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@9404 d0d07461-0603-4401-acd4-de1884942a52 --- copy.js | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'copy.js') diff --git a/copy.js b/copy.js index 0088d3a..8ce048f 100644 --- a/copy.js +++ b/copy.js @@ -1,9 +1,12 @@ /** - * vimperator plugin - * Add `copy' command - * For vimperator 0.6pre - * @author teramako teramako@gmail.com - * @version 0.2 + * ==VimperatorPlugin== + * @name copy.js + * @description enable to copy strings from a template (like CopyURL+) + * @description-ja テンプレートから文字列のコピーを可能にします(CopyURL+みたなもの) + * @minVersion 0.6pre + * @author teramako teramako@gmail.com + * @version 0.3 + * ==/VimperatorPlugin== * * Usage: * :copy {copyString} -> copy the argument replaced some certain string @@ -12,7 +15,7 @@ * ex) * :copy %TITLE% -> copied the title of the current page * :copy title -> same as `:copy %TITLE%' by default - * :copy! liberator.version -> copy the value of liberator.version + * :copy! liberator.version -> copy the value of liberator.version * * If non-argument, used `default' * @@ -31,8 +34,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 <%TITLE%' }, + * { label: 'selanchor', value: '%SEL%' }, + * { label: 'htmlblockquote', value: '
%HTMLSEL%
' }, + * ]); + * EOM */ -const templates = [ +const templates = window.eval(liberator.globalVariables.copy_templates) || [ { label: 'titleAndURL', value: '%TITLE%\n%URL%' }, { label: 'title', value: '%TITLE%' }, { label: 'anchor', value: '%TITLE%' }, -- cgit v1.2.3