Move JS code from asset to view