From e29f815a0debbe80111bac23de0c6427a0d4b21e Mon Sep 17 00:00:00 2001 From: John Donaldson Date: Tue, 9 Oct 2018 18:32:33 -0500 Subject: [PATCH] Fixing how resources are loaded so that scripts are run at load-time --- theme/puzzle.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/theme/puzzle.html b/theme/puzzle.html index 1e82577..8c4f4a9 100644 --- a/theme/puzzle.html +++ b/theme/puzzle.html @@ -48,7 +48,11 @@ function init() { li.appendChild(a); 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) { console.log("Error", err); }); @@ -56,7 +60,7 @@ function init() { document.querySelector("body > h1").innerText = categoryName + " " + points document.querySelector("input[name=cat]").value = categoryName; document.querySelector("input[name=points]").value = points; - + function mutated(mutationsList, observer) { for (let mutation of mutationsList) { if (mutation.type == 'childList') {