<style>
body,
.entry-content,
.site-content,
.content-area,
#pubFrameWrap,
#pubFrame {
  background: #fff !important;
}

#pubFrameWrap {
  width: 100%;
}

#pubFrame {
  width: 100%;
  height: 120px;
  min-height: 0 !important;
  border: 0;
  display: block;
  overflow: hidden;
  background: #fff !important;
}
</style>

<div id="pubFrameWrap"></div>

<script>
(function () {
  var BASE = "https://people.clarkson.edu/~joijodp/Helenbrook/publications/";
  var DEFAULT = "web.html";
  var CHILD_ORIGIN = "https://people.clarkson.edu";
  var wrap = document.getElementById("pubFrameWrap");

  var frame = null;
  var lastTarget = "";
  var lastHeight = 0;

  function parseTarget(raw) {
    raw = decodeURIComponent((raw || "").trim()) || DEFAULT;

    var hashIndex = raw.indexOf("#");
    var file = hashIndex >= 0 ? raw.slice(0, hashIndex) : raw;
    var anchor = hashIndex >= 0 ? raw.slice(hashIndex + 1) : "";

    if (!/^[A-Za-z0-9._-]+\.html?$/i.test(file)) {
      file = DEFAULT;
      anchor = "";
    }

    return { file: file, anchor: anchor };
  }

  function canonicalTarget(t) {
    return t.file + (t.anchor ? "#" + t.anchor : "");
  }

  function currentTarget() {
    return decodeURIComponent((location.hash || "").replace(/^#/, "")) || DEFAULT;
  }

  function buildSrc(t) {
    var src = BASE + t.file + "?v=20260317-1605&_cb=" + Date.now();
    if (t.anchor) src += "#" + t.anchor;
    return src;
  }

  function updateHash(target, mode) {
    var wanted = "#" + encodeURIComponent(target);

    if (mode === "push") {
      if (location.hash !== wanted) history.pushState(null, "", wanted);
    } else {
      if (location.hash !== wanted) history.replaceState(null, "", wanted);
    }
  }

  function createFrame(src) {
    var newFrame = document.createElement("iframe");
    newFrame.id = "pubFrame";
    newFrame.setAttribute("scrolling", "no");
    newFrame.setAttribute("src", src);
    newFrame.style.height = "120px";
    return newFrame;
  }

  function loadPage(rawTarget, mode, force) {
    var t = parseTarget(rawTarget);
    var target = canonicalTarget(t);

    if (!force && target === lastTarget) return;
    lastTarget = target;
    lastHeight = 0;

    var newFrame = createFrame(buildSrc(t));
    wrap.innerHTML = "";
    wrap.appendChild(newFrame);
    frame = newFrame;

    updateHash(target, mode || "replace");
  }

  if ("scrollRestoration" in history) {
    history.scrollRestoration = "manual";
  }

  window.addEventListener("message", function (e) {
    if (e.origin !== CHILD_ORIGIN) return;
    if (!frame) return;
    if (e.source !== frame.contentWindow) return;
    if (!e.data || !e.data.type) return;

    if (e.data.type === "navigate-page") {
      loadPage(e.data.page, "push", true);
      return;
    }

    if (e.data.type === "sync-page") {
      var t = parseTarget(e.data.page);
      var target = canonicalTarget(t);

      if (target !== lastTarget) {
        lastTarget = target;
        updateHash(target, "replace");
      }
      return;
    }

    if (e.data.type === "iframe-height") {
      var h = parseInt(e.data.height, 10);
      if (!isNaN(h) && h > 0 && Math.abs(h - lastHeight) > 1) {
        lastHeight = h;
        frame.style.height = h + "px";
      }
      return;
    }
  });

  window.addEventListener("hashchange", function () {
    loadPage(currentTarget(), "replace", true);
  });

  window.addEventListener("popstate", function () {
    loadPage(currentTarget(), "replace", true);
  });

  window.addEventListener("pageshow", function () {
    loadPage(currentTarget(), "replace", true);
  });

  loadPage(currentTarget(), "replace", true);
})();
</script>