get hash of URL in javascript

var hash = window.location.hash;

and get your hash in hash variable.

if (hash == '#new') {
  toastr.info(hash);
}