How can I get public files path in javascript files?
It depends where you are storing all your files, to use the base url of your site you need to do this:

$base_url."/sites/default/files/xxx.jpg"


If your files are inside some theme:

$base_url."/".drupal_get_path('theme', 'name_theme')."/images/xxx.png


If you are using files with public://, use this:

$uri = $your_file_name; // Example "public://xxx"
$path= file_create_url($uri);


I hope it works in your case