update js template, fixed #14
add retention option, fixed #13