Fixing how resources are loaded so that scripts are run at load-time

This commit is contained in:
John Donaldson 2018-10-09 18:32:33 -05:00
parent 5723e94bd7
commit e29f815a0d
1 changed files with 6 additions and 2 deletions

View File

@ -48,7 +48,11 @@ function init() {
li.appendChild(a); li.appendChild(a);
document.getElementById("files").appendChild(li); document.getElementById("files").appendChild(li);
} }
document.getElementById("puzzle").innerHTML = obj.body; let range = document.createRange();
let puzzleContainer = document.getElementById("puzzle");
puzzleContainer.innerHTML = "";
puzzleContainer.appendChild(range.createContextualFragment(obj.body));
}).catch(function(err) { }).catch(function(err) {
console.log("Error", err); console.log("Error", err);
}); });
@ -56,7 +60,7 @@ function init() {
document.querySelector("body > h1").innerText = categoryName + " " + points document.querySelector("body > h1").innerText = categoryName + " " + points
document.querySelector("input[name=cat]").value = categoryName; document.querySelector("input[name=cat]").value = categoryName;
document.querySelector("input[name=points]").value = points; document.querySelector("input[name=points]").value = points;
function mutated(mutationsList, observer) { function mutated(mutationsList, observer) {
for (let mutation of mutationsList) { for (let mutation of mutationsList) {
if (mutation.type == 'childList') { if (mutation.type == 'childList') {