$().ready(function() {
  const location = getCookie('location');
  if (location != "") {
    $('#location-checkbox').prop('checked', true);
  }

  $('#location-checkbox').change(function() {
    if(this.checked) {
      setCookie('location', 'true', 1);
    } else {
      eraseCookie('location');
    }
  });
});

const MODAL_PROMISE = loadTemplate('/templates/modalWindow.html');

$().ready(function() {
  loadModalWindow();

  const location = getCookie('location');
  if (location != "") {
    $('#location-checkbox').prop('checked', true);
  }

  $('#location-checkbox').change(function() {
    if(this.checked) {
      setCookie('location', 'true', 1);
    } else {
      eraseCookie('location');
    }
  });

  $('body').on('click', '#pop-up > .close', function() {
    $('#modal-window').addClass('hide');
  });
});

async function loadModalWindow() {
  const modalHTML = await MODAL_PROMISE;
  $('#real-body').append(modalHTML);
}
Add js to load and close modal window
Add js to load and close modal window
