refactored scenarios.js
This commit is contained in:
parent
4ea4c696a6
commit
aef054896e
1 changed files with 14 additions and 13 deletions
|
@ -4,19 +4,17 @@ window.onload = function(){
|
||||||
|
|
||||||
//Create output Element
|
//Create output Element
|
||||||
let $trueOutputElement = $("<li></li")
|
let $trueOutputElement = $("<li></li")
|
||||||
$trueOutputElement.attr("id", `scenarios-${scenario.name}`);
|
.attr("id", `scenarios-${scenario.name}`);
|
||||||
|
|
||||||
let $outputElement = $("<div class=\"accordion-panel\"></div>");
|
let $outputElement = $("<div></div>")
|
||||||
|
.addClass("accordion-panel");
|
||||||
|
|
||||||
//Create Control Element
|
$controlElement = $("<button></button>")
|
||||||
const isAccordion = true;
|
.addClass("accordion-control")
|
||||||
if(isAccordion){
|
.append(scenario.name);
|
||||||
$controlElement = $("<button></button>")
|
|
||||||
.addClass("accordion-control")
|
$trueOutputElement.append($controlElement);
|
||||||
.append(scenario.name);
|
|
||||||
|
|
||||||
$trueOutputElement.append($controlElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Mature Content rating
|
//Mature Content rating
|
||||||
if(scenario.adult == true){
|
if(scenario.adult == true){
|
||||||
|
@ -29,7 +27,8 @@ window.onload = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
//description
|
//description
|
||||||
$descriptionElement = $(`<p>${scenario.description}</p>`);
|
$descriptionElement = $(`<p></p>`)
|
||||||
|
.append(scenario.description);
|
||||||
|
|
||||||
//option list
|
//option list
|
||||||
$optionElement = $("<ul></ul>");
|
$optionElement = $("<ul></ul>");
|
||||||
|
@ -51,13 +50,15 @@ window.onload = function(){
|
||||||
$inputTag = $("<input>")
|
$inputTag = $("<input>")
|
||||||
.attr("type", "radio")
|
.attr("type", "radio")
|
||||||
.attr("name", `radio-${scenario.name}`);
|
.attr("name", `radio-${scenario.name}`);
|
||||||
$otherElement = $("<li>Other... <input type=text></li>")
|
$otherElement = $("<li></li>")
|
||||||
.prepend($inputTag);
|
.prepend($inputTag);
|
||||||
|
.append("Other... <input type=text>")
|
||||||
$optionElement.append($otherElement);
|
$optionElement.append($otherElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Default question, always shows up
|
//Default question, always shows up
|
||||||
$whyElement = $("<p>Why would you choose this awnser?</p>");
|
$whyElement = $("<p></p>")
|
||||||
|
.append("Why would you choose this awnser?");
|
||||||
|
|
||||||
//Awnser space for the default element
|
//Awnser space for the default element
|
||||||
$whyResponseElement = $("<textArea></textArea>")
|
$whyResponseElement = $("<textArea></textArea>")
|
||||||
|
|
Loading…
Reference in a new issue