clean javascript view code and remove dead stuff