Skip to content

Commit

Permalink
debug flyout cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
drammock committed Aug 5, 2023
1 parent 2911e72 commit 74d549f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,15 @@ function initRTDObserver() {
return;
}
if (mutation.addedNodes[0].data.search("Inserted RTD Footer") != -1) {
console.log("XXX FOUND MUTATED NODE XXX");
let flyout = mutation.addedNodes[0].cloneNode(true);
console.log(flyout);
// copy the flyout menu to whichever of the 2 target nodes didn't already get
// written to by the RTD injection script.
document.querySelectorAll('[data-rtd-target="rtd"]').forEach((node) => {
console.log("XXX FOUND A TARGET NODE XXX");
if (!node.hasChildNodes()) {
console.log("XXX FOUND CHILDLESS NODE XXX");
node.appendChild(flyout);
flyout.onclick = toggleFlyout;
// replicate the onclick function RTD uses: it can't be cloned by cloneNode()
Expand Down

0 comments on commit 74d549f

Please sign in to comment.