// Import the libraries
let scripts = [
"https://survey-library.azurewebsites.net/single_choice.js"
];
let promises = scripts.map((script) => {
return new Promise((resolve, reject) => {
document.querySelector("body").style.opacity = "0";
let s = document.createElement("script");
s.src = script;
s.onload = resolve;
s.onerror = reject;
document.head.appendChild(s);
});
});
Promise.all(promises)
.then(() => {
/* All scripts are loaded, you can execute your functions here */
/* All script ends here */
document.querySelector("body").style.opacity = "1";
})
/* If a library could not be imported throw an error */
.catch((error) => {
console.error(`Failed to load script: ${error}`);
});
// Insert the Library URLs here
let scripts = [
"https://survey-library.azurewebsites.net/single_choice.js"
];
let promises = scripts.map((script) => {
return new Promise((resolve, reject) => {
document.querySelector("body").style.opacity = "0";
let s = document.createElement("script");
s.src = script;
s.onload = resolve;
s.onerror = reject;
document.head.appendChild(s);
});
});
Promise.all(promises)
.then(() => {
/* All scripts are loaded, you can execute your functions here */
single_choice({
question_code : "Q1", // Question code to configure
randomize : { // Settings object for randomize
answer_groups : [ // List of answer groups to randomize
[1,2,3,4,5]
],
randomize_groups : false // Do not randomize groups
}
});
/* All script ends here */
document.querySelector("body").style.opacity = "1";
})
/* If a library could not be imported throw an error */
.catch((error) => {
console.error(`Failed to load script: ${error}`);
});
// Insert the Library URLs here
let scripts = [
"https://survey-library.azurewebsites.net/single_choice.js"
];
let promises = scripts.map((script) => {
return new Promise((resolve, reject) => {
document.querySelector("body").style.opacity = "0";
let s = document.createElement("script");
s.src = script;
s.onload = resolve;
s.onerror = reject;
document.head.appendChild(s);
});
});
Promise.all(promises)
.then(() => {
/* All scripts are loaded, you can execute your functions here */
single_choice({
question_code : "Q1", // Question code to configure
randomize : { // Settings object for randomize
answer_groups : [ // List of answer groups to randomize
[1,2,3,4], // Group 1
[5,99] // Group 2
],
randomize_groups : false // Do not randomize groups
}
});
/* All script ends here */
document.querySelector("body").style.opacity = "1";
})
/* If a library could not be imported throw an error */
.catch((error) => {
console.error(`Failed to load script: ${error}`);
});
// Insert the Library URLs here
let scripts = [
"https://survey-library.azurewebsites.net/single_choice.js"
];
let promises = scripts.map((script) => {
return new Promise((resolve, reject) => {
document.querySelector("body").style.opacity = "0";
let s = document.createElement("script");
s.src = script;
s.onload = resolve;
s.onerror = reject;
document.head.appendChild(s);
});
});
Promise.all(promises)
.then(() => {
/* All scripts are loaded, you can execute your functions here */
single_choice({
question_code : "Q1", // Question code to configure
randomize : { // Settings object for randomize
answer_groups : [ // List of answer groups to randomize
[1,2], // Group 1
[3,4], // Group 2
[5] // Group 3
],
randomize_groups : true // Randomize groups
}
});
/* All script ends here */
document.querySelector("body").style.opacity = "1";
})
/* If a library could not be imported throw an error */
.catch((error) => {
console.error(`Failed to load script: ${error}`);
});