added option to add javascript in the previews
added more documentation