var ready = function() {
  var rate = $('#js-user-rating').data('rate');
  document.getElementById("value_" + rate).checked = true;
};

if(window.location.pathname.match(/\/admin\/submissions\/\d*$/)) {
  $(document).on('page:change', ready);
}

var setRating = function() {
  if (document.getElementById('js-user-rating')) {
    var rate = $('#js-user-rating').data('rate');
    document.getElementById("value_" + rate).checked = true;
  }
};

$(document).on('page:change', setRating);

Check element existence instead of windows path