From 0924c9ebbc03c13607c6bf06365b44f55a9c4138 Mon Sep 17 00:00:00 2001 From: drry Date: Tue, 11 Nov 2008 14:45:13 +0000 Subject: * fixed typos. * et cetera. git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@23254 d0d07461-0603-4401-acd4-de1884942a52 --- unicode.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'unicode.js') diff --git a/unicode.js b/unicode.js index 78a3950..3c1d2f2 100644 --- a/unicode.js +++ b/unicode.js @@ -1,7 +1,7 @@ // ==VimperatorPlugin== // @name unicode escape -// @description Copy unicode escaped text to clipboard. -// @description-ja Unicode エスケープされてテキストをクリップボードにコピーする +// @description Copy the escaped-unicode text to the clipboard. +// @description-ja Unicode エスケープされたテキストをクリップボードにコピーする // @license Creative Commons 2.1 (Attribution + Share Alike) // @version 1.0 // @author anekos (anekos@snca.net) @@ -10,18 +10,16 @@ // ==/VimperatorPlugin== // // Usage: -// :uc +// :uc +// :uc! // // Links: // (function () { - function lz (s,n) - (''+s).replace(new RegExp('^.{0,'+(n-1)+'}$'),function(s)lz('0'+s,n)); - function escape (s) - Array.slice(s).map(function(c)let(d=c.charCodeAt(0))(d<=127?c:'\\u'+lz(d.toString(16),4))).join(''); + s.toSource().replace(/^[^"]+"|"[^"]+$/g,''); function unescape (s) s.replace(/\\u([a-f\d]{4})/gi,function(_,c)String.fromCharCode(parseInt(c,16))); -- cgit v1.2.3