feat: full html / js
This commit is contained in:
parent
9ee4e8940f
commit
393796fc7e
27 changed files with 26488 additions and 0 deletions
44
index.html
Normal file
44
index.html
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||||
|
<title>RandoMusic</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="./randommusic.css">
|
||||||
|
<style type="text/css">
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body id="">
|
||||||
|
<div class="inner-fluid">
|
||||||
|
<div class="w300p m-auto">
|
||||||
|
<h1 class="text-center">Tirage Aléatoire</h1>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="w200p m-auto">
|
||||||
|
<div class="grid grid-cols-2 mt-6 text-25">
|
||||||
|
<div class="w80p">de A à</div>
|
||||||
|
<div class="w80p"><input type="text" name="lettre" id="lettre" class="text w50p text-center" value="H"></div>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-2 mt-6 text-25">
|
||||||
|
<div class="w80p">de 0 à</div>
|
||||||
|
<div class="w80p"><input type="number" name="chiffre" id="chiffre" class="text w70p text-center" value = "8"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="alert res h1-like text-center"></div>
|
||||||
|
<div class="mt-6 text-25 text-center">
|
||||||
|
<button class="tirer btn text-bold">Relancer</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
|
||||||
|
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
<script src="./randommusic.js"></script>
|
||||||
|
|
||||||
|
|
BIN
polices/Marianne-Bold.woff
Normal file
BIN
polices/Marianne-Bold.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-Bold.woff2
Normal file
BIN
polices/Marianne-Bold.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-Bold_Italic.woff
Normal file
BIN
polices/Marianne-Bold_Italic.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-Bold_Italic.woff2
Normal file
BIN
polices/Marianne-Bold_Italic.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-ExtraBold.woff
Normal file
BIN
polices/Marianne-ExtraBold.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-ExtraBold.woff2
Normal file
BIN
polices/Marianne-ExtraBold.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-ExtraBold_Italic.woff
Normal file
BIN
polices/Marianne-ExtraBold_Italic.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-ExtraBold_Italic.woff2
Normal file
BIN
polices/Marianne-ExtraBold_Italic.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-Light.woff
Normal file
BIN
polices/Marianne-Light.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-Light.woff2
Normal file
BIN
polices/Marianne-Light.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-Light_Italic.woff
Normal file
BIN
polices/Marianne-Light_Italic.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-Light_Italic.woff2
Normal file
BIN
polices/Marianne-Light_Italic.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-Medium.woff
Normal file
BIN
polices/Marianne-Medium.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-Medium.woff2
Normal file
BIN
polices/Marianne-Medium.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-Medium_Italic.woff
Normal file
BIN
polices/Marianne-Medium_Italic.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-Medium_Italic.woff2
Normal file
BIN
polices/Marianne-Medium_Italic.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-Regular.woff
Normal file
BIN
polices/Marianne-Regular.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-Regular.woff2
Normal file
BIN
polices/Marianne-Regular.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-Regular_Italic.woff
Normal file
BIN
polices/Marianne-Regular_Italic.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-Regular_Italic.woff2
Normal file
BIN
polices/Marianne-Regular_Italic.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-Thin.woff
Normal file
BIN
polices/Marianne-Thin.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-Thin.woff2
Normal file
BIN
polices/Marianne-Thin.woff2
Normal file
Binary file not shown.
BIN
polices/Marianne-Thin_Italic.woff
Normal file
BIN
polices/Marianne-Thin_Italic.woff
Normal file
Binary file not shown.
BIN
polices/Marianne-Thin_Italic.woff2
Normal file
BIN
polices/Marianne-Thin_Italic.woff2
Normal file
Binary file not shown.
26403
randommusic.css
Normal file
26403
randommusic.css
Normal file
File diff suppressed because it is too large
Load diff
41
randommusic.js
Normal file
41
randommusic.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
jQuery(function($) {
|
||||||
|
$tAlpha = [
|
||||||
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
||||||
|
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
|
||||||
|
];
|
||||||
|
|
||||||
|
lancerTirage('H', '8');
|
||||||
|
|
||||||
|
$('.tirer').on('click', function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
const lettre = $('#lettre').val();
|
||||||
|
const chiffre = $('#chiffre').val() ?? '8';
|
||||||
|
lancerTirage(lettre, chiffre)
|
||||||
|
})
|
||||||
|
|
||||||
|
function lancerTirage(lettre, chiffre) {
|
||||||
|
if (lettre) {
|
||||||
|
lettre = lettre.toUpperCase();
|
||||||
|
$('#lettre').val(lettre);
|
||||||
|
}
|
||||||
|
|
||||||
|
const newLettre = tirage(lettre, 'lettre');
|
||||||
|
const newChiffre = tirage(chiffre, 'chiffre');
|
||||||
|
|
||||||
|
$('.res').html(newLettre + ' ' + newChiffre);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function tirage(i, type) {
|
||||||
|
if (type === "chiffre") {
|
||||||
|
return aleatoire(1, i)
|
||||||
|
}
|
||||||
|
const max = $tAlpha.indexOf(i) + 1
|
||||||
|
const index = aleatoire(1, max) - 1;
|
||||||
|
return $tAlpha[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
function aleatoire(min, max) {
|
||||||
|
return Math.floor(Math.random() * max) + min
|
||||||
|
};
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue