if (document.readyState === 'complete') {
  init();
} else {
  document.addEventListener('DOMContentLoaded', function() {
    init();
  });
}

function init() {
  const form = document.querySelector('.js-main-form');
  const button = document.querySelector('.js-submit-main-form');

  if (form && button) {
    button.onclick = e => {
      e.preventDefault();
      form.submit();
    };
  }
}
