71 lines
2.5 KiB
HTML
71 lines
2.5 KiB
HTML
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<title>mots.lol simple</title>
|
|
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
|
|
<script type="text/javascript" src="./simple-adj.js"></script>
|
|
<script type="text/javascript" src="./simple-adv.js"></script>
|
|
<script type="text/javascript" src="./simple-verbe.js"></script>
|
|
<script type="text/javascript" src="./simple-noms.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<nav>
|
|
<button class="glass" onclick="ajouterNom()"><img src="./plus.svg"/> <span class="label">Ajouter un nom</span></button>
|
|
<button class="glass" onclick="ajouterVerbe()"><img src="./plus.svg"/> <span class="label">Ajouter un verbe</span></button>
|
|
<button class="glass" onclick="ajouterAdj()"><img src="./plus.svg"/> <span class="label">Ajouter un adjectif</span></button>
|
|
<button class="glass" onclick="ajouterAdv()"><img src="./plus.svg"/> <span class="label">Ajouter un adverbe</span></button>
|
|
<button class="glass" onclick="enleverLeDernier()"><img src="./trash.svg"/> <span class="label">Enlever le dernier</span></button>
|
|
<a class="glass red link" href="./full/index.html">Dictionnaire complet →</a>
|
|
</nav>
|
|
<main>
|
|
<!--<div class="glass mot">Hésiter</div>
|
|
<div class="glass mot">des</div>
|
|
<div class="glass mot">Eguisheimoises</div>
|
|
<div class="glass mot">enfantins</div>-->
|
|
</main>
|
|
<script>
|
|
let listeMots = []
|
|
let precedent_type = null
|
|
|
|
function elementAléatoireDunTableau(array) {
|
|
return array[Math.floor(Math.random() * array.length)];
|
|
}
|
|
|
|
function ajouterUnMot(mot) {
|
|
listeMots.push(mot)
|
|
let elementMot = document.createElement('div')
|
|
elementMot.innerText = mot
|
|
elementMot.classList.add("glass")
|
|
elementMot.classList.add("mot")
|
|
document.getElementsByTagName('main')[0].appendChild(elementMot)
|
|
}
|
|
|
|
function ajouterNom() {
|
|
console.log(LISTE_NOM)
|
|
ajouterUnMot(elementAléatoireDunTableau(LISTE_NOM) + "s")
|
|
}
|
|
|
|
function ajouterVerbe() {
|
|
ajouterUnMot(elementAléatoireDunTableau(LISTE_VERBE))
|
|
ajouterUnMot('des')
|
|
}
|
|
|
|
function ajouterAdj() {
|
|
ajouterUnMot(elementAléatoireDunTableau(LISTE_ADJ) + "s")
|
|
}
|
|
|
|
function ajouterAdv() {
|
|
ajouterUnMot(elementAléatoireDunTableau(LISTE_ADV))
|
|
}
|
|
|
|
function enleverLeDernier() {
|
|
listeMots.pop()
|
|
const mainEl = document.getElementsByTagName('main')[0]
|
|
mainEl.removeChild(mainEl.lastChild);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|