Fix some JS issues
Fix some JS issues

Brought up by Krinkle in Icebfe86b (PS4):
    * 'ok' and 'err' properties of Api are deprecated, use promise interface
    * Use 'api' instead of 'Api'
    * $( '<a>' ) instead of $( '<a/>' )
    * Expected space after 'function' keyword

Change-Id: I0199db902174551bcf9269edafb1fef1df118b13

wikimedia/mediawiki-extensions-Echo,wikimedia/mediawiki-extensions-Echo,wikimedia/mediawiki-extensions-Echo,wikimedia/mediawiki-extensions-Echo