CmdUtils.CreateCommand({
  name: "morse",
  takes: {"convert to morse": noun_arb_text},
  description: "Transcript text to Morse code.",
  homepage: "http://www.qbit.it/lab/",
  license: 'MPL',
  preview: "Transcript the selected text to Morse code.",
  execute: function( sel ) {
    var baseUrl = "http://www.qbit.it/lab/morse.php";
    var params = {text: sel.text, mode: "text"};
    jQuery.get( baseUrl, params, function( txt ) {
      CmdUtils.setSelection( txt );
    })
  }
})

CmdUtils.CreateCommand({
  name: "demorse",
  takes: {"convert from morse": noun_arb_text},
  description: "Transcript text from Morse code.",
  homepage: "http://www.qbit.it/lab/",
  license: 'MPL',
  preview: "Transcript the selected text from Morse code.",
  execute: function( sel ) {
    var baseUrl = "http://www.qbit.it/lab/demorse.php";
    var params = {text: sel.text, mode: "text"};
    jQuery.get( baseUrl, params, function( txt ) {
      CmdUtils.setSelection( txt );
    })
  }
})
