Skip to content

Commit

Permalink
ContentLoaded was firing too soon
Browse files Browse the repository at this point in the history
  • Loading branch information
danielruss committed Jul 16, 2024
1 parent ef586fb commit 4e2860c
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions quest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { transform } from "./replace2.js";
import { questionQueue, moduleParams } from "./questionnaire.js";


let prevRes = {};

// Make it easier to create a TH.
Expand Down Expand Up @@ -119,6 +120,19 @@ async function startUp() {
};

let myTree = questionQueue;

document.querySelectorAll('#logic,#styling').forEach( (el) => {
el.addEventListener("change",(event)=>{
console.log(event.target.id,event.target.checked)
questLF.setItem(event.target.id,event.target.checked)
setStylingAndLogic()
})
})
document.querySelector("#hide-markup").addEventListener("change",(event)=>{
console.log(event.target.checked)
document.getElementById("markup").style.display=(event.target.checked)?"none":"initial"
document.getElementById("renderText").style.display=(event.target.checked)?"none":"initial"
})
}

function increaseSize() {
Expand Down Expand Up @@ -206,18 +220,8 @@ document.getElementById("viewCache").addEventListener("click",()=>{
getCachedResponses()
})

window.onload = function () {
startUp();
document.querySelectorAll('#logic,#styling').forEach( (el) => {
el.addEventListener("change",(event)=>{
console.log(event.target.id,event.target.checked)
questLF.setItem(event.target.id,event.target.checked)
setStylingAndLogic()
})
})
document.querySelector("#hide-markup").addEventListener("change",(event)=>{
console.log(event.target.checked)
document.getElementById("markup").style.display=(event.target.checked)?"none":"initial"
document.getElementById("renderText").style.display=(event.target.checked)?"none":"initial"
})
if (document.readyState === "loading"){
document.addEventListener("DOMContentLoaded",startUp)
} else {
startUp()
};

0 comments on commit 4e2860c

Please sign in to comment.