Skip to content

Instantly share code, notes, and snippets.

@satyr
Created July 6, 2009 17:01
Show Gist options
  • Save satyr/141536 to your computer and use it in GitHub Desktop.
Save satyr/141536 to your computer and use it in GitHub Desktop.
(en|de)codeURIComponent()
(function cmd_codeURIComponent(_){
var name = _ + 'codeURIComponent', fn = this[name];
CmdUtils.CreateCommand({
name: name,
icon: 'chrome://ubiquity/skin/icons/convert.png',
argument: noun_arb_text,
execute: function({object: {text}}){
if (!text) return;
try { var r = fn(text) }
catch(e){ displayMessage(_ +'code error', this); return }
CmdUtils.setSelection(Utils.escapeHtml(Utils.clipboard.text = r),
{text: r});
},
});
return arguments.callee;
})('en')('de');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment