javascript cleanup


@icewind1991 @PVince81 @libasys  please review - THX

supersedes https://github.com/owncloud/gallery/pull/80