Merge pull request 'Fix Alerte intervalle trop petit' (#18) from bugfix/RD-11/fix-alerte-intervalle into master
All checks were successful
roulette / deploy (push) Successful in 16s
All checks were successful
roulette / deploy (push) Successful in 16s
Reviewed-on: #18
This commit is contained in:
commit
f779e10bad
10
js/liste.js
10
js/liste.js
@ -2017,21 +2017,17 @@ document.addEventListener('readystatechange', function() {
|
||||
//empêcher l'action par défaut du navigateur
|
||||
event.preventDefault();
|
||||
//définir les conteneurs de l'information que nous ciblons
|
||||
const donjon = document.querySelector("#quoteContainer p").innerText;
|
||||
const quoteGenius = document.querySelector("#quoteGenius").innerText;
|
||||
//obtenir un nouveau nombre aléatoire à attacher à un donjon et fixer une limite
|
||||
const sourceLength = quoteSource.length;
|
||||
let randomNumber = Math.floor(Math.random() * sourceLength);
|
||||
//sélectionner un nouveau donjon
|
||||
const min = document.getElementById("min").value;
|
||||
const max = document.getElementById("max").value;
|
||||
if (min > max - 10) {
|
||||
return alert('Intervalle trop petit.');
|
||||
}
|
||||
while (quoteSource[randomNumber].niveau > max || quoteSource[randomNumber].niveau < min) {
|
||||
randomNumber = Math.floor(Math.random() * sourceLength);
|
||||
//on interdit les intervalles trop petit
|
||||
if (min > max - 10) {
|
||||
alert('Intervalle trop petit.');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const newQuoteText = quoteSource[randomNumber].donjon;
|
||||
|
Loading…
Reference in New Issue
Block a user