fetch(
  "https://outlineapi.com/v3/parse_article?source_url=" +
    encodeURIComponent(window.location)
)
  .then(res => res.json())
  .then(body => {
    if (body.error) {
      return alert(`Outline Bookmarklet Error: ${body.error}`);
    }
    window.location.href = `https://outline.com/${body.data.short_code}`
  })
  .catch(err => {
    alert("Outline Bookmarklet Error. See console for details.");
    console.error(err);
  });