Please create an account or Login! Have fun!
User:G-lander/NotCC Embed
Jump to navigation
Jump to search
Play[edit]
Paste the code below into the JS console to replace this with an experimental NotCC embed!!
const NOTCC_URL = "https://glander.club/notcc/prewrite/"
function replceEmbed(el) {
const iframe = document.createElement("iframe")
iframe.frameBorder = 0
const url = new URL(`http://hash.path`)
url.searchParams.append("embed", "1")
url.searchParams.append("level", el.getAttribute("data-leveldata"))
const listener = ev => {
if (ev.source !== iframe.contentWindow) return
iframe.width = ev.data.width
iframe.height = ev.data.height
window.removeEventListener("message", listener)
}
window.addEventListener("message", listener)
iframe.src = `${NOTCC_URL}#${url.href.slice(url.origin.length)}`
el.replaceWith(iframe)
}
function replaceAllEmbeds() {
for (const el of document.querySelectorAll(".levelEmbed")) {
replceEmbed(el)
}
}
replaceAllEmbeds()