2018-10-08 23:49:04 +02:00
|
|
|
const debugStorage = () => {
|
|
|
|
for(var i = 0; i < localStorage.length; i++) {
|
|
|
|
let key = localStorage.key(i)
|
|
|
|
console.debug(key, " = ", localStorage[key])
|
2018-09-28 22:59:58 +02:00
|
|
|
}
|
2018-10-08 23:49:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
document.querySelectorAll('input').forEach((inputElement) => {
|
|
|
|
inputElement.addEventListener("change", () => {
|
|
|
|
localStorage[inputElement.name] = inputElement.value
|
|
|
|
});
|
|
|
|
});
|
2018-09-28 22:59:58 +02:00
|
|
|
|
2018-10-08 23:49:04 +02:00
|
|
|
if(document.getElementById("type_sondage")) {
|
|
|
|
type_sondage.addEventListener('change', function() {
|
|
|
|
let typeSondage = this.options[this.selectedIndex].text;
|
|
|
|
if(typeSondage == "classique") {
|
|
|
|
localStorage.setItem('type_sondage', this.options[this.selectedIndex].text);
|
|
|
|
document.querySelector('#next').href = "reponses.html";
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('type_sondage', 'dates');
|
|
|
|
document.querySelector('#next').href = "dates.html";
|
|
|
|
}
|
|
|
|
debugStorage()
|
|
|
|
})
|
|
|
|
}
|
2018-10-08 22:47:50 +02:00
|
|
|
|
2018-10-08 23:49:04 +02:00
|
|
|
if(document.getElementById("startButton")) {
|
|
|
|
startButton.addEventListener('click', function () {
|
|
|
|
localStorage.clear()
|
|
|
|
localStorage.setItem('type_sondage', 'classique');
|
2018-10-08 22:47:50 +02:00
|
|
|
});
|
2018-09-28 22:59:58 +02:00
|
|
|
}
|
|
|
|
|