Improve php made JavaScript template.