diff options
author | drry | 2008-11-11 14:45:13 +0000 |
---|---|---|
committer | drry | 2008-11-11 14:45:13 +0000 |
commit | 0924c9ebbc03c13607c6bf06365b44f55a9c4138 (patch) | |
tree | b5502ecb419bf995b16b5842948ab0faf76a448a | |
parent | 581a8ce00d3cb51ba349307526ceb7f82aeafefb (diff) | |
download | vimperator-plugins-0924c9ebbc03c13607c6bf06365b44f55a9c4138.tar.bz2 |
* fixed typos.
* et cetera.
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@23254 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | unicode.js | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -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 <MULTI_BYTE_TEXT> +// :uc <MULTIBYTE_TEXT> +// :uc! <ESCAPED_UNICODE_TEXT> // // 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))); |