[feature/avatars] Change avatar javascript to conform to new coding guidelines

PHPBB3-10018