From e12719cc443a7f1de94d822de14839be406974f5 Mon Sep 17 00:00:00 2001 From: "Martin, Alexander Scott" Date: Mon, 3 Feb 2025 16:26:48 -0500 Subject: [PATCH] allow for embedded panels --- tdx-enhanced.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tdx-enhanced.js b/tdx-enhanced.js index b52d9d4..3ea471d 100644 --- a/tdx-enhanced.js +++ b/tdx-enhanced.js @@ -101,6 +101,24 @@ } handleHighlight("report",headingTxt,heading.parentElement) + //try embedding + if (headingTxt.startsWith("{")) { + try { + let embedData = JSON.parse(headingTxt) + + let title = document.createElement("h4") + title.classList = heading.classList + title.innerText = embedData.name + let moduleBody = heading.parentNode.parentNode.querySelector(".ModuleContent") + let embed = document.createElement("iframe") + embed.classList = "customEmbed" + embed.src = embedData.url + heading.replaceWith(title) + moduleBody.replaceWith(embed) + } catch { + } + } + } //append number of items to title @@ -1450,6 +1468,13 @@ flex-direction: column; gap: 8px; } + +.customEmbed { + border: 0; + width: 100%; + height: 400px; +} + .calBox { display: flex; justify-content: space-around;