diff options
author | anekos | 2009-02-10 12:27:58 +0000 |
---|---|---|
committer | anekos | 2009-02-10 12:27:58 +0000 |
commit | d3e8a43def8b45204a5019382c937de9a5da55dc (patch) | |
tree | d2fcfce4df58f425032021e26d63ce7ca68421a9 /copy.js | |
parent | 42a60fe0ad4c2b1556cf83f130307d739fab6e5d (diff) | |
download | vimperator-plugins-d3e8a43def8b45204a5019382c937de9a5da55dc.tar.bz2 |
HTMLSEL / SEL が動いていなかったのを修正
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@29860 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'copy.js')
-rw-r--r-- | copy.js | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -8,7 +8,7 @@ var PLUGIN_INFO = <updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/copy.js</updateURL> <author mail="teramako@gmail.com" homepage="http://vimperator.g.hatena.ne.jp/teramako/">teramako</author> <license>MPL 1.1/GPL 2.0/LGPL 2.1</license> -<version>0.7</version> +<version>0.7.1</version> <detail><![CDATA[ == Command == :copy {copyString}: @@ -131,9 +131,10 @@ const REPLACE_TABLE = { get TITLE () buffer.title, get URL () buffer.URL, get SEL () { - if (sel) - return sel; - else if (selection.rangeCount < 1) + var sel = ''; + var win = new XPCNativeWrapper(window.content.window); + var selection = win.getSelection(); + if (selection.rangeCount < 1) return ''; for (var i=0, c=selection.rangeCount; i<c; i++){ @@ -142,9 +143,10 @@ const REPLACE_TABLE = { return sel; }, get HTMLSEL () { - if (htmlsel) - return sel; - else if (selection.rangeCount < 1) + var htmlsel = ''; + var win = new XPCNativeWrapper(window.content.window); + var selection = win.getSelection(); + if (selection.rangeCount < 1) return ''; var serializer = new XMLSerializer(); @@ -198,9 +200,6 @@ function getCopyTemplate(label){ } function replaceVariable(str){ if (!str) return ''; - var win = new XPCNativeWrapper(window.content.window); - var sel = '', htmlsel = ''; - var selection = win.getSelection(); function replacer(orig, name){ //{{{ if (name == '') return '%'; |