CmdUtils.CreateCommand({
  name: "barcode",
  homepage: "http://www.gofloripa.net/magazin/ubiquity-scripts/",
  author: { name: "Christian Wolf", email: "christian.wolf@gmail.com" },
  license: "GPL",
  description: "Generates a 2D barcode for current URL.",
  help: "Just scan the barcode in the preview area to get the current URL to your smartphone.",
  
  _getBarCode: function(){
    var chartsUrl = "http://chart.apis.google.com/chart?";

	var params = {
		cht: "qr",
		chl: context.focusedWindow.location,
		choe: "UTF-8",
		chs: "400x400"
	};

    return chartsUrl + jQuery.param( params );
  },
  
  preview: function( pblock ) {
    var msg = "<img src='%s'/>".replace( /%s/, this._getBarCode() );
    pblock.innerHTML = msg;
  },
  
  execute: function() {
    //void
  }
})
  

  

