Skip to content

Commit

Permalink
fix: incremented crescent dezenas
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanKisaki committed Apr 8, 2024
1 parent 81b97cc commit b3e1314
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 54 deletions.
29 changes: 2 additions & 27 deletions image/loteria-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<meta property="og:title" content="Gerador de Dezenas - Luan Kisaki" />
<meta property="og:description" content="Gere dezenas aleatorias." />
<meta property="og:image" content="https://luankisaki.github.io/Gerador-de-dezenas/favicon.png">
<link rel="shortcut icon" type="image/png" href="/favicon.png">
<link rel="apple-touch-icon" href="/favicon.png">
<link rel="icon" href="./favicon.png" type="image/x-icon" sizes="any">
<link rel="stylesheet" href="./styles.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
Expand Down Expand Up @@ -59,7 +57,7 @@ <h1>
</label>
<textarea id="dezenasFacil" rows="3" disabled type="text"></textarea>
</div>

<!-- Mania -->
<div class="card bg bg-mania">
<h1>
Expand Down
53 changes: 30 additions & 23 deletions loto.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,18 @@ function generateDezenasMania() {
let partialDezenas = [];
while (partialDezenas.length < quantDezenas.value) {
let verifyDezena = Math.floor(Math.random() * ltMania.length)
.toString()
.padStart(2, "0");

if (!partialDezenas.includes(verifyDezena)) {
partialDezenas.push(verifyDezena);
}
.toString()
.padStart(2, "0");
if (verifyDezena) {
parseInt(verifyDezena);
}

localStorage.setItem("Lt-Mania", setValue.innerHTML);
return (dezenas.value = partialDezenas.join(" "));
if (!partialDezenas.includes(verifyDezena)) {
partialDezenas.push(verifyDezena);
}
sortedDezenas = partialDezenas.sort((a, b) => (a - b))
}
localStorage.setItem("Lt-Mania", setValue.innerHTML);
return (dezenas.value = sortedDezenas.join(" "));
}

function generateDezenasMega() {
Expand All @@ -101,23 +103,26 @@ function generateDezenasMega() {

let partialDezenas = [];
while (partialDezenas.length < quantDezenas.value) {
let verifyDezena = Math.floor(Math.random() * ltMega.length)
.toString()
.padStart(2, "0");

if (!partialDezenas.includes(verifyDezena)) {
verifyDezena !== "00" ? partialDezenas.push(verifyDezena) : null;
}
let verifyDezena = Math.floor(Math.random() * ltMega.length + 1)
.toString()
.padStart(2, "0");
if (verifyDezena) {
parseInt(verifyDezena);
}

localStorage.setItem("Lt-Mega", setValue.innerHTML);
return (dezenas.value = partialDezenas.join(" "));
if (!partialDezenas.includes(verifyDezena)) {
verifyDezena !== "00" ? partialDezenas.push(verifyDezena) : null;
}
sortedDezenas = partialDezenas.sort((a, b) => (a - b))
}
localStorage.setItem("Lt-Mega", setValue.innerHTML);
return (dezenas.value = sortedDezenas.join(" "));
}

function generateDezenasFacil() {
let quantDezenas = quantDezenasFacil;
let setValue = setValueFacil;
let dezenas = dezenasFacil;
console.log(quantDezenasFacil)

if (quantDezenas.value === "") {
alert("Escolha quantas dezenas você quer gerar.");
Expand All @@ -131,15 +136,17 @@ function generateDezenasFacil() {

let partialDezenas = [];
while (partialDezenas.length < quantDezenas.value) {
let verifyDezena = Math.floor(Math.random() * ltFacil.length)
let verifyDezena = Math.floor(Math.random() * ltFacil.length + 1)
.toString()
.padStart(2, "0");

if (verifyDezena) {
parseInt(verifyDezena);
}
if (!partialDezenas.includes(verifyDezena)) {
verifyDezena !== "00" ? partialDezenas.push(verifyDezena) : null;
}
sortedDezenas = partialDezenas.sort((a, b) => (a - b))
}

localStorage.setItem("Lt-Facil", setValue.innerHTML);
return (dezenas.value = partialDezenas.join(" "));
return (dezenas.value = sortedDezenas.join(" "));
}
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
{}
{
"name": "gerador-de-dezenas",
"start_url": "/",
"display": "standalone",
"icons": [
{
"src": "./image/loteria-logo.svg",
"sizes": "157x157",
"purpose": "maskable"
}
]
}

0 comments on commit b3e1314

Please sign in to comment.