aboutsummaryrefslogtreecommitdiffstats
path: root/copy.js
diff options
context:
space:
mode:
authorteramako2008-04-13 11:20:52 +0000
committerteramako2008-04-13 11:20:52 +0000
commit09bf47501775dca0fed73d874a4dd81b9539d719 (patch)
tree0e11ea87338fa5990d57c60708cdec6356caef8e /copy.js
parent892c3325d70d9b02a1e1f6276b5176c2685b7ef8 (diff)
downloadvimperator-plugins-09bf47501775dca0fed73d874a4dd81b9539d719.tar.bz2
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
Diffstat (limited to 'copy.js')
-rw-r--r--copy.js34
1 files changed, 27 insertions, 7 deletions
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 <<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>' },