Plugin JavaScript code fixes

jshint linter showed several potential problems with the JavaScript code,
all of which have been addressed

additionally the call to "alert" made inside errorHandler has been removed