[IMP]move js code to template