Last active
May 15, 2021 23:20
-
-
Save Matoex/0f752544251bf045ee8d81f0992bfe3e to your computer and use it in GitHub Desktop.
Fragenkatalog: Sanitätsdienst Grundausbildung Auflösungsbutton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Gemacht für: Sanarena (von Andreas THUMSER) Fragenkatalog: Sanitätsdienst Grundausbildung | |
Auflösugnsbutton von Matthias Bretting und Tobias Geßler | |
http://www.san-erlangen.de/VirtuelleSanArena-Erlangen-Html5/html/Topic6122a44e1a304db980e3cf9b3107e410.html | |
Wie nutzen? | |
Drücke F12 | |
Füge den Code in die Console ein (STRG C,STRG V) | |
Drücke ENTER | |
Drücke wieder F12, um die Leiste zu schließen | |
*/ | |
Array.from(document.querySelector("#myContent").querySelectorAll("ul")).filter((ul) => | |
Array.from(ul.querySelectorAll("span")).filter((e) => (e.innerHTML == "richtig" || e.innerHTML == "falsch")).length == 0 | |
).forEach((old) => { | |
let x = getButton(); | |
let ps = old.nextSibling; | |
if (ps != null && !ps.classList.contains("ParagraphStyle")) ps = null; | |
if (ps != null) ps.hidden = true; | |
x.onclick = function() { | |
x.replaceWith(old) | |
if (ps != null) ps.hidden = false; | |
} | |
old.replaceWith(x) | |
} | |
) | |
Array.from(document.querySelectorAll("span")).filter((e) => e.innerHTML == "richtig" || e.innerHTML == "falsch").forEach((old) => { | |
let x = getButton(); | |
x.onclick = function() { | |
x.replaceWith(old) | |
} | |
old.replaceWith(x) | |
} | |
) | |
function getButton() { | |
let x = document.createElement("button"); | |
x.innerHTML = "Auflösung"; | |
x.type = "button"; | |
x.style.border = "2px solid #ffffff"; | |
x.style.backgroundColor = "#C9CD39" | |
x.style.paddingRight = "4.8px"; | |
x.style.paddingLeft = "4.8px"; | |
return x; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment