move more inline js to handle via dispatcher