From 40f13ee987f551cb5bccfa8330e4738f1191c2a9 Mon Sep 17 00:00:00 2001 From: pekepeke Date: Sat, 1 Nov 2008 04:24:26 +0000 Subject: handling for 2.0pre git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@22491 d0d07461-0603-4401-acd4-de1884942a52 --- copy.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'copy.js') diff --git a/copy.js b/copy.js index 4bcd3e3..a382e6c 100644 --- a/copy.js +++ b/copy.js @@ -79,8 +79,8 @@ liberator.globalVariables.copy_templates.forEach(function(template){ // used when argument is none //const defaultValue = templates[0].label; commands.addUserCommand(['copy'],'Copy to clipboard', - function(arg, special){ - liberator.plugins.exCopy.copy(arg, special); + function(args, special){ + liberator.plugins.exCopy.copy(args, special); },{ completer: function(filter, special){ if (special){ @@ -120,7 +120,7 @@ function replaceVariable(str){ var win = new XPCNativeWrapper(window.content.window); var sel = '',htmlsel = ''; if (str.indexOf('%SEL%') >= 0 || str.indexOf('%HTMLSEL%') >= 0){ - sel = win.getSelection().getRangeAt(0); + sel = win.getSelection().rangeCount()>0? win.getSelection().getRangeAt(0): ''; } if (str.indexOf('%HTMLSEL%') >= 0){ var serializer = new XMLSerializer(); @@ -143,7 +143,8 @@ var exCopyManager = { get: function(label){ return getCopyTemplate(label); }, - copy: function(arg, special){ + copy: function(args, special){ + var arg = args.string == undefined ? args: args.string; var copyString = ''; var isError = false; if (special && arg){ -- cgit v1.2.3