diff --git a/Mac/MainWindow/Detail/styleSheet.css b/Mac/MainWindow/Detail/styleSheet.css index c39d376ce..e47f1255b 100644 --- a/Mac/MainWindow/Detail/styleSheet.css +++ b/Mac/MainWindow/Detail/styleSheet.css @@ -199,6 +199,9 @@ img[src*="share-buttons"] { border-radius: 0.3em; box-sizing: border-box; } +.newsfoot-footnote-popover .reversefootnote { + display: none; +} a.footnote { display: inline-block; text-decoration: none; diff --git a/Shared/Article Rendering/newsfoot.js b/Shared/Article Rendering/newsfoot.js index 7374610e7..a599bb1c7 100644 --- a/Shared/Article Rendering/newsfoot.js +++ b/Shared/Article Rendering/newsfoot.js @@ -107,16 +107,27 @@ } } + // Handle clicks on the footnote reference document.addEventListener("click", (ev) => { if (!(ev.target && ev.target instanceof HTMLAnchorElement)) return; if (!ev.target.matches(".footnote")) return; ev.preventDefault(); const content = document.querySelector(`[id='${ev.target.hash.substring(1)}']`).cloneNode(true); - if (content instanceof HTMLElement) { - remove(content.querySelector(".reversefootnote")); - } installContainer(ev.target); void new Footnote(fragFromContents(content), ev.target); }); + + // Handle clicks on the footnote reverse link + document.addEventListener("click", (ev) => + { + if (!(ev.target && ev.target instanceof HTMLAnchorElement)) return; + if (!ev.target.matches(".footnotes .reversefootnote")) return; + const hash = ev.target.hash; + if (!hash) return; + const fnref = document.getElementById(hash.substring(1)); + + window.scrollTo({ top: fnref.getBoundingClientRect().top + window.scrollY }); + ev.preventDefault(); + }); }());