add minimal style

This commit is contained in:
Adrien MALINGREY 2023-11-07 21:42:37 +01:00
parent 4f4447e889
commit 875fc21cac
3 changed files with 140 additions and 77 deletions

24
app.js
View File

@ -45,24 +45,28 @@ const FACING = {
WEST: 3, WEST: 3,
} }
const KEY_NAMES = { const KEY_NAMES = new Proxy({
["ArrowLeft"] : "←", ["ArrowLeft"] : "←",
["ArrowRight"] : "→",
["ArrowUp"] : "↑",
["ArrowDown"] : "↓",
[" "] : "Espace",
["Escape"] : "Échap.",
["Backspace"] : "Ret. arrière",
["Enter"] : "Entrée",
["←"] : "ArrowLeft", ["←"] : "ArrowLeft",
["ArrowRight"] : "→",
["→"] : "ArrowRight", ["→"] : "ArrowRight",
["ArrowUp"] : "↑",
["↑"] : "ArrowUp", ["↑"] : "ArrowUp",
["ArrowDown"] : "↓",
["↓"] : "ArrowDown", ["↓"] : "ArrowDown",
[" "] : "Espace",
["Espace"] : " ", ["Espace"] : " ",
["Escape"] : "Échap.",
["Échap."] : "Escape", ["Échap."] : "Escape",
["Backspace"] : "Ret. arrière",
["Ret. arrière"]: "Backspace", ["Ret. arrière"]: "Backspace",
["Enter"] : "Entrée",
["Entrée"] : "Enter", ["Entrée"] : "Enter",
}, {
get(obj, keyName) {
return keyName in obj? obj[keyName] : keyName
} }
})
/* Customize Array to be use as position */ /* Customize Array to be use as position */
Object.defineProperties(Array.prototype, { Object.defineProperties(Array.prototype, {
@ -494,7 +498,7 @@ class Settings {
getInputs() { getInputs() {
for (let input of this.form.querySelectorAll("input[type='text']")) { for (let input of this.form.querySelectorAll("input[type='text']")) {
this[input.name] = KEY_NAMES[input.value] || input.value this[input.name] = KEY_NAMES[input.value]
} }
for (let input of this.form.querySelectorAll("input[type='number'], input[type='range']")) { for (let input of this.form.querySelectorAll("input[type='number'], input[type='range']")) {
this[input.name] = input.valueAsNumber this[input.name] = input.valueAsNumber
@ -519,7 +523,7 @@ function changeKey(input) {
input.value = "" input.value = ""
input.onkeydown = function (event) { input.onkeydown = function (event) {
event.preventDefault() event.preventDefault()
input.value = KEY_NAMES[event.key] || event.key input.value = KEY_NAMES[event.key]
input.blur() input.blur()
} }
input.onblur = function (event) { input.onblur = function (event) {

104
css/minimal.css Normal file
View File

@ -0,0 +1,104 @@
.card {
background: #363941;
}
.minoes-table {
display: flex;
flex-direction: column;
filter: drop-shadow(5px 8px 0 rgba(9, 9, 9, 22%));
}
.minoes-table tr {
display: flex;
position: relative;
flex-direction: row;
}
tr.matrix td:not(.mino) {
border: 0;
}
.minoes-table td {
display: inline-block;
width: var(--cell-side);
height: var(--cell-side);
padding: 0 !important;
}
.mino {
content: "";
background: var(--background-color);
width: inherit;
height: inherit;
display: block;
z-index: calc(1000 - var(--row));
box-shadow: 0 -6px 0 var(--light-color);
}
.I.mino {
--background-color: #42AFE1;
--light-color: #6CEAFF;
}
.J.mino {
--background-color: #1165B5;
--light-color: #339BFF;
}
.L.mino {
--background-color: #F38927;
--light-color: #FFBA59;
}
.O.mino {
--background-color: #F6D03C;
--light-color: #FFFF7F;
}
.S.mino {
--background-color: #51B84D;
--light-color: #84F880;
}
.T.mino {
--background-color: #9739A2;
--light-color: #D958E9;
}
.Z.mino {
--background-color: #EB4F65;
--light-color: #FF7F79;
}
.ghost.mino {
--background-color: rgba(175, 175, 175, 80%);
box-shadow: none;
}
.moving.mino {
filter: saturate(80%) brightness(150%);
}
.locking.mino {
filter: saturate(50%) brightness(250%);
}
@keyframes locked-animation {
from {
filter: saturate(50%) brightness(500%);
}
}
.locked.mino {
animation: locked-animation;
animation-duration: 0.2s;
}
@keyframes cleared-line-animation {
from {
background-color: #eeeeee;
}
to {
background-color: transparent;
}
}

View File

@ -12,6 +12,7 @@
<link rel="stylesheet" href="css/classic.css" title="Classique"> <link rel="stylesheet" href="css/classic.css" title="Classique">
<link rel="alternate stylesheet" href="css/electro.css" title="Électro"> <link rel="alternate stylesheet" href="css/electro.css" title="Électro">
<link rel="alternate stylesheet" href="css/pop.css" title="Pop"> <link rel="alternate stylesheet" href="css/pop.css" title="Pop">
<link rel="alternate stylesheet" href="css/minimal.css" title="Minimal">
<link rel="alternate stylesheet" href="css/retro.css" title="Rétro"> <link rel="alternate stylesheet" href="css/retro.css" title="Rétro">
<link rel="apple-touch-icon" sizes="180x180" href="favicons/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicons/T-2.png"> <link rel="icon" type="image/png" sizes="32x32" href="favicons/T-2.png">
@ -31,70 +32,28 @@
<form name="settingsForm" class="needs-validation" novalidate> <form name="settingsForm" class="needs-validation" novalidate>
<fieldset id="keyBindFielset" class="row g-2 mb-3 align-items-center text-center"> <fieldset id="keyBindFielset" class="row g-2 mb-3 align-items-center text-center">
<legend class="text-start">Commandes</legend> <legend class="text-start">Commandes</legend>
<label for="moveLeftInput" title="Gauche" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"> <label for="moveLeftInput" title="Gauche" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-left"></i></label>
<i class="bi bi-arrow-left"></i> <div class="col-sm-4"><input name="moveLeft" id="moveLeftInput" type="text" class="form-control text-center" value="←" onclick="changeKey(this)" placeholder="Touche ?" required></div>
</label> <div class="col-sm-4"><input name="moveRight" id="moveRightInput" type="text" class="form-control text-center" value="→" onclick="changeKey(this)" placeholder="Touche ?" required></div>
<div class="col-sm-4"> <label for="moveRightInput" title="Droite" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-right"></i></label>
<input name="moveLeft" id="moveLeftInput" type="text" class="form-control text-center" value="←" onclick="changeKey(this)" placeholder="Touche ?" required> <label for="rotateCounterclockwiseInput" title="Rotation anti-horaire" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-counterclockwise"></i></label>
</div> <div class="col-sm-4"><input name="rotateCounterclockwise" id="rotateCounterclockwiseInput" type="text" class="form-control text-center" value="w" onclick="changeKey(this)" placeholder="Touche ?" required></div>
<div class="col-sm-4"> <div class="col-sm-4"><input name="rotateClockwise" id="rotateClockwiseInput" type="text" class="form-control text-center" value="↑" onclick="changeKey(this)" placeholder="Touche ?" required></div>
<input name="moveRight" id="moveRightInput" type="text" class="form-control text-center" value="→" onclick="changeKey(this)" placeholder="Touche ?" required> <label for="rotateClockwiseInput" title="Rotation horaire" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-clockwise"></i></label>
</div> <label for="softDropInput" title="Chute lente" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-down-short"></i></label>
<label for="moveRightInput" title="Droite" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"> <div class="col-sm-4"><input name="softDrop" id="softDropInput" type="text" class="form-control text-center" value="↓" onclick="changeKey(this)" placeholder="Touche ?" required></div>
<i class="bi bi-arrow-right"></i> <div class="col-sm-4"><input name="hardDrop" id="hardDropInput" type="text" class="form-control text-center" value="Espace" onclick="changeKey(this)" placeholder="Touche ?" required></div>
</label> <label for="hardDropInput" title="Chute rapide" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-download"></i></label>
<label for="rotateCounterclockwiseInput" title="Rotation anti-horaire" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"> <label for="holdInput" title="Échanger la pièce" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-left-right"></i></label>
<i class="bi bi-arrow-counterclockwise"></i> <div class="col-sm-4"><input name="hold" id="holdInput" type="text" class="form-control text-center" value="c" onclick="changeKey(this)" placeholder="Touche ?" required></div>
</label> <div class="col-sm-4"><input name="pause" id="pauseInput" type="text" class="form-control text-center" value="Échap." onclick="changeKey(this)" placeholder="Touche ?" required></div>
<div class="col-sm-4"> <label for="pauseInput" title="Pause" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-pause"></i></label>
<input name="rotateCounterclockwise" id="rotateCounterclockwiseInput" type="text" class="form-control text-center" value="w" onclick="changeKey(this)" placeholder="Touche ?" required>
</div>
<div class="col-sm-4">
<input name="rotateClockwise" id="rotateClockwiseInput" type="text" class="form-control text-center" value="↑" onclick="changeKey(this)" placeholder="Touche ?" required>
</div>
<label for="rotateClockwiseInput" title="Rotation horaire" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center">
<i class="bi bi-arrow-clockwise"></i>
</label>
<label for="softDropInput" title="Chute lente" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center">
<i class="bi bi-arrow-down-short"></i>
</label>
<div class="col-sm-4">
<input name="softDrop" id="softDropInput" type="text" class="form-control text-center" value="↓" onclick="changeKey(this)" placeholder="Touche ?" required>
</div>
<div class="col-sm-4">
<input name="hardDrop" id="hardDropInput" type="text" class="form-control text-center" value="Espace" onclick="changeKey(this)" placeholder="Touche ?" required>
</div>
<label for="hardDropInput" title="Chute rapide" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center">
<i class="bi bi-download"></i>
</label>
<label for="holdInput" title="Échanger la pièce" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center">
<i class="bi bi-arrow-left-right"></i>
</label>
<div class="col-sm-4">
<input name="hold" id="holdInput" type="text" class="form-control text-center" value="c" onclick="changeKey(this)" placeholder="Touche ?" required>
</div>
<div class="col-sm-4">
<input name="pause" id="pauseInput" type="text" class="form-control text-center" value="Échap." onclick="changeKey(this)" placeholder="Touche ?" required>
</div>
<label for="pauseInput" title="Pause" class="col-sm-2 col-form-label d-flex align-items-center justify-content-center">
<i class="bi bi-pause"></i>
</label>
</fieldset> </fieldset>
<fieldset id="autorepeatFieldset" class="row g-2 mb-3 align-items-center text-center"> <fieldset id="autorepeatFieldset" class="row g-2 mb-3 align-items-center text-center">
<legend class="text-start">Répétition automatique</legend> <legend class="text-start">Répétition automatique</legend>
<label for="arrInput" class="col-sm-2 col-form-label" title="Automatic Repeat Rate : période de répétition de l'action">ARR</label> <label for="arrInput" class="col-sm-2 col-form-label" title="Automatic Repeat Rate : période de répétition de l'action">ARR</label>
<div class="col-sm-4"> <div class="col-sm-4"><div class="input-group"><input name="arr" id="arrInput" type="number" class="form-control text-center" value="50" min="2" max="200" step="1"><div class="input-group-text">ms</div></div></div>
<div class="input-group"> <div class="col-sm-4"><div class="input-group"><input name="das" id="dasInput" type="number" class="form-control text-center" value="300" min="100" max="500" step="5"><div class="input-group-text">ms</div></div></div>
<input name="arr" id="arrInput" type="number" class="form-control text-center" value="50" min="2" max="200" step="1">
<div class="input-group-text">ms</div>
</div>
</div>
<div class="col-sm-4">
<div class="input-group">
<input name="das" id="dasInput" type="number" class="form-control text-center" value="300" min="100" max="500" step="5">
<div class="input-group-text">ms</div>
</div>
</div>
<label for="dasInput" class="col-sm-2 col-form-label" title="Delayed AutoShift : délai initial avant répétition">DAS</label> <label for="dasInput" class="col-sm-2 col-form-label" title="Delayed AutoShift : délai initial avant répétition">DAS</label>
</fieldset> </fieldset>
<fieldset class="row g-2 mb-3 align-items-center text-center"> <fieldset class="row g-2 mb-3 align-items-center text-center">
@ -105,6 +64,7 @@
<option selected>Classique</option> <option selected>Classique</option>
<option>Pop</option> <option>Pop</option>
<option>Électro</option> <option>Électro</option>
<option>Minimal</option>
<option>Rétro</option> <option>Rétro</option>
</select> </select>
</div> </div>
@ -144,12 +104,7 @@
<div class="card shadow"> <div class="card shadow">
<table id="statsTable" class="table mb-0"> <table id="statsTable" class="table mb-0">
<tr><th>Score</th> <td id="scoreCell">0</td> </tr> <tr><th>Score</th> <td id="scoreCell">0</td> </tr>
<tr> <tr><th>Meilleur<br/>score</th><td id="highScoreCell"><script>document.write(Number(localStorage["highScore"]) || 0)</script></td></tr>
<th>Meilleur<br/>score</th>
<td id="highScoreCell">
<script>document.write(Number(localStorage["highScore"]) || 0)</script>
</td>
</tr>
<tr><th>Niveau</th><td id="levelCell">0</td> </tr> <tr><th>Niveau</th><td id="levelCell">0</td> </tr>
<tr><th>But</th> <td id="goalCell">0</td> </tr> <tr><th>But</th> <td id="goalCell">0</td> </tr>
<tr><th>Temps</th> <td id="timeCell">00:00</td> </tr> <tr><th>Temps</th> <td id="timeCell">00:00</td> </tr>