$(document).ready(() => {
    $("a[id^='footnote_source_']").each((idx, elm) => {
      var id = elm.id.slice(16);
      var footnote = $("#footnote_" + id).parent().text();
      var popup;
      $(elm).mouseover(() => {
        popup = $("<div></div>").text(footnote).css({
          position: "absolute",
          top: $(elm).offset().top,
          left: $(elm).offset().left + $(elm).width(),
          background: "white",
          border: "1px solid black",
          padding: "5px",
          "z-index": 1000
        }).appendTo("body");
      }).mouseout(() => {
        $(popup).remove();
      });
    });
  });
