move javascript event to view class