Refactor javascript inline admin