Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Sep 22, 2024
1 parent 3f0b814 commit 7cea552
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions sqlpage/sqlpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ const nonce = document.currentScript.nonce;

function sqlpage_embed() {
for (const c of document.querySelectorAll("[data-embed]")) {
if (c.ariaBusy === "true") return;
if (c.ariaBusy === "true") continue;
c.ariaBusy = true;
const [source, params] = c.dataset.embed.split("?");
if (!source) return;
const search = new URLSearchParams(params);
if (!search.has("_sqlpage_embed")) {
search.set("_sqlpage_embed", "true");
let url;
try {
url = new URL(c.dataset.embed, window.location.href)
} catch {
console.erreur(`'${c.dataset.embed}' is not a valid url`)
continue;
}
fetch(`${source}?${search}`)
url.searchParams.set("_sqlpage_embed", "");

fetch(url)
.then(res => res.text())
.then(html => {
c.innerHTML = html;
Expand Down

0 comments on commit 7cea552

Please sign in to comment.