[client][view][events] Extract JS code in events view to the JS file.

The purpose is to improve independency of the JS code (in other words,
modularization).