map widget js refactor