Compare commits

...

15 Commits

Author SHA1 Message Date
c3a3e45c18 css animation 2020-11-18 02:58:29 +01:00
958ba01f6b display credits on game over 2020-11-09 12:29:43 +01:00
ccd85b6bd8 back to back bonus 2020-11-09 02:44:58 +01:00
a161826a37 v2 2020-11-09 02:20:43 +01:00
5d7795b3da v2 2020-11-09 02:20:26 +01:00
0f1093541e themes 2020-10-16 23:57:42 +02:00
078120e4d1 new version 2020-10-15 03:47:32 +02:00
1d1b2b24d2 start game leval at location hash 2020-10-14 20:24:01 +02:00
3fccefc57c remove css theme before changing 2020-10-12 21:41:17 +02:00
198ac07b84 style 2020-10-12 21:22:14 +02:00
5ef94fcf73 fix leaderboard 2020-10-01 20:35:51 +02:00
70cfd94bc3 reorg 2020-10-01 20:06:59 +02:00
a7a3c630e9 new theme 2020-09-28 21:51:12 +02:00
060662f706 background by Louise 2020-09-28 21:17:03 +02:00
c2050f224f update 2020-09-28 21:15:40 +02:00
26 changed files with 1364 additions and 1081 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 KiB

View File

@ -1,64 +0,0 @@
.empty-cell {
background: transparent;
}
.invisible-grid > .empty-cell {
border: 1px solid transparent;
}
.visible-grid > .empty-cell {
border: 1px inset rgba(128, 128, 128, 0.3);
}
.mino {
border: 1px outset white;
border-radius: 0vmin;
}
.I-mino {
background: rgb(153, 255, 230);
}
.J-mino {
background: rgb(153, 204, 255);
}
.L-mino {
background: rgb(255, 204, 153);
}
.O-mino {
background: rgb(255, 255, 153);
}
.S-mino {
background: rgb(153, 255, 153);
}
.T-mino {
background: rgb(204, 153, 255);
}
.Z-mino {
background: rgb(255, 153, 153);
}
.locked-mino {
background: white;
}
.cleared-line {
background: white;
}
.trail {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 0vmin;
}
.ghost {
background: rgba(255, 255, 255, 0.4);
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 0vmin;
}

View File

@ -1,64 +0,0 @@
.empty-cell {
background: transparent;
}
.invisible-grid > .empty-cell {
border: 1px solid transparent;
}
.visible-grid > .empty-cell {
border: 1px inset rgba(128, 128, 128, 0.3);
}
.mino {
border: 1px solid white;
border-radius: 0vmin;
}
.I-mino {
background: rgb(153, 255, 230);
}
.J-mino {
background: rgb(153, 204, 255);
}
.L-mino {
background: rgb(255, 204, 153);
}
.O-mino {
background: rgb(255, 255, 153);
}
.S-mino {
background: rgb(153, 255, 153);
}
.T-mino {
background: rgb(204, 153, 255);
}
.Z-mino {
background: rgb(255, 153, 153);
}
.locked-mino {
background: white;
}
.cleared-line {
background: white;
}
.trail {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 0;
}
.ghost {
background: rgba(255, 255, 255, 0.4);
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 0;
}

View File

@ -1,36 +0,0 @@
.invisible-grid > .empty-cell {
background: transparent;
border: 1px solid transparent;
}
.visible-grid > .empty-cell {
background: transparent;
border: 1px inset rgba(128, 128, 128, 0.3);
}
.mino, .I-mino, .J-mino, .L-mino, .O-mino, .S-mino, .T-mino, .Z-mino {
background: rgba(127, 229, 255, 0.3);
border: 1px solid rgba(127, 229, 255, 0.7);
border-radius: 0.3vmin;
}
.locked-mino {
background: rgba(242, 255, 255, 0.5);
border-color: rgba(242, 255, 255, 0.7);
}
.cleared-line {
background: white;
}
.trail {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 0.3vmin;
}
.ghost {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 0.3vmin;
}

View File

@ -1,70 +0,0 @@
.invisible-grid > .empty-cell {
background: transparent;
border: 1px solid transparent;
}
.visible-grid > .empty-cell {
background: transparent;
border: 1px inset rgba(128, 128, 128, 0.3);
}
.mino {
border: 1px outset;
border-radius: 0vmin;
}
.I-mino {
background: cyan;
border-color: lightcyan;
}
.J-mino {
background: blue;
border-color: lightblue;
}
.L-mino {
background: orange;
border-color: lightgoldenrodyellow;
}
.O-mino {
background: yellow;
border-color: lightyellow;
}
.S-mino {
background: green;
border-color: lightgreen;
}
.T-mino {
background: magenta;
border-color: pink;
}
.Z-mino {
background: red;
border-color: lightpink;
}
.locked-mino {
background: white;
border-color: white;
}
.cleared-line {
background: white;
}
.trail {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 0vmin;
}
.ghost {
background: rgba(255, 255, 255, 0.4);
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 0vmin;
}

View File

@ -1,70 +0,0 @@
.invisible-grid > .empty-cell {
background: transparent;
border: 1px solid transparent;
}
.visible-grid > .empty-cell {
background: transparent;
border: 1px inset rgba(128, 128, 128, 0.3);
}
.mino {
border: 1px solid;
border-radius: 0;
}
.I-mino {
background: cyan;
border-color: lightcyan;
}
.J-mino {
background: blue;
border-color: lightblue;
}
.L-mino {
background: orange;
border-color: lightgoldenrodyellow;
}
.O-mino {
background: yellow;
border-color: lightyellow;
}
.S-mino {
background: green;
border-color: lightgreen;
}
.T-mino {
background: magenta;
border-color: pink;
}
.Z-mino {
background: red;
border-color: lightpink;
}
.locked-mino {
background: white;
border-color: white;
}
.cleared-line {
background: white;
}
.trail {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 0vmin;
}
.ghost {
background: rgba(255, 255, 255, 0.4);
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 0vmin;
}

209
index.php
View File

@ -1,29 +1,26 @@
<!DOCTYPE html> <?php
<html> $actions = [
<head> "moveLeft" => ["label"=>"Gauche", "defaultKey"=>"ArrowLeft"],
<meta charset="utf-8" /> "moveRight" => ["label"=>"Droite", "defaultKey"=>"ArrowRight"],
<title>Webtris</title> "softDrop" => ["label"=>"Chute lente", "defaultKey"=>"ArrowDown"],
<link rel="icon" type="image/png" href="favicon.png"> "hardDrop" => ["label"=>"Chute rapide", "defaultKey"=>"Space"],
<link rel="stylesheet" type="text/css" href="css/style.css" /> "rotateCW" => ["label"=>"Rotation horaire", "defaultKey"=>"ArrowUp"],
<script type="text/javascript" src="js/webtris.js"></script> "rotateCCW" => ["label"=>"Rotation anti-horaire", "defaultKey"=>"z"],
</head> "hold" => ["label"=>"Garde", "defaultKey"=>"c"],
<body> "pauseResume" => ["label"=>"Pause/Reprise", "defaultKey"=>"Escape"]
<header> ];
<h1>WEBTRIS</h1>
</header>
<div id="game">
<?php
function echoTable($id, $invisibleRows, $visibleRows, $columns) { function echoTable($id, $invisibleRows, $visibleRows, $columns) {
echo " <table id='$id' class=minoes-table>\n"; echo " <table id='$id' class=minoes-table>\n";
for ($y = 0; $y < $invisibleRows; $y++) { for ($y = 0; $y < $invisibleRows; $y++) {
echo " <tr class=invisible-grid>"; echo " <tr>";
for ($x = 0; $x < $columns; $x++) { for ($x = 0; $x < $columns; $x++) {
echo "<td class=empty-cell></td>"; echo "<th></td>";
} }
echo "</tr>\n"; echo "</tr>\n";
} }
for ($y = 0; $y < $visibleRows; $y++) { for ($y = 0; $y < $visibleRows; $y++) {
echo " <tr class=visible-grid>"; echo " <tr>";
for ($x = 0; $x < $columns; $x++) { for ($x = 0; $x < $columns; $x++) {
echo "<td class=empty-cell></td>"; echo "<td class=empty-cell></td>";
} }
@ -31,84 +28,146 @@
} }
echo " </table>\n"; echo " </table>\n";
} }
echoTable("hold", 6, 0, 6); ?>
echoTable("matrix", 4, 20, 10); <!DOCTYPE html>
echoTable("next", 24, 0, 6); <html>
?> <head>
<table id="stats"> <meta charset="utf-8" />
<tr><th class="name" colspan=2>SCORE</th></tr> <title>Webtris</title>
<tr><td class="value" id="score" colspan=2>0</td></tr> <link rel="icon" type="image/png" href="favicon.png">
<tr><th class="name" colspan=2>RECORD</th></tr> <script type="text/javascript" src="app.js"></script>
<tr><td class="value" id="highScore" colspan=2>0</td></tr> <link rel="manifest" href="manifest.json">
<tr><th class="name" colspan=2>TEMPS</th></tr> </head>
<tr><td class="value" id="time" colspan=2>00:00</td></tr> <body id="body" style="display:none">
<tr><td colspan=2><br/></td class="name"></tr> <header id="header">
<tr><th class="name">NIVEAU</th><td class="value" id="level">0</td></tr> <h1>WEBTRIS</h1>
<tr><th class="name">OBJECTIF</th><td class="value" id="goal">0</td></tr> </header>
<tr><th class="name">LIGNES</th><td class="value" id="clearedLines">0</td></tr> <section id="settingsSection">
</table> <fieldset>
<div id="message"></div>
</div>
<div id="settings">
<fieldset id="keyboard">
<legend>Clavier</legend> <legend>Clavier</legend>
<?php <div>
function addButton($action, $label) { <?php
echo " <label for='set-$action-key'>$label</label>\n"; foreach($actions as $action=>$parameters) {
echo " <button id='set-$action-key' type='button' onclick=\"waitKey(this, '$action')\"></button>"; ?>
<label for='<?=$action?>'><?=$parameters["label"]?></label>
<button id='<?=$action?>' type='button' onclick="settings.waitKey(this)"><?=$parameters["defaultKey"]?></button>
<?php
} }
addButton("moveLeft", "Gauche"); ?>
addButton("moveRight", "Droite"); </div>
addButton("softDrop", "Chute lente");
addButton("hardDrop", "Chute rapide");
addButton("rotateCW", "Rotation horaire");
addButton("rotateCCW", "Rotation anti-horaire");
addButton("hold", "Garde");
addButton("pause", "Pause/Reprise");
?>
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>Répétition automatique</legend> <legend>Répétition automatique</legend>
<label id="autorepeatDelayRangeLabel" for="autorepeatDelayRange"></label> <div>
<input id="autorepeatDelayRange" type="range" oninput="autorepeatDelayChanged()" min="100" max="1000" step="10" /> <label id="autorepeatDelayRangeLabel" for="autorepeatDelayRange">Délai initial : 300ms</label>
<label id="autorepeatPeriodRangeLabel" for="autorepeatPeriodRange"></label> <input id="autorepeatDelayRange" type="range" oninput="this.previousElementSibling.innerText = `Délai initial : ${this.value}ms`" value="300" min="100" max="500" step="10"/>
<input id="autorepeatPeriodRange" type="range" id="autorepeatPeriodRange" oninput="autorepeatPeriodChanged()" min="2" max="50" step="2" /> <label id="autorepeatPeriodRangeLabel" for="autorepeatPeriodRange">Période : 10ms</label>
<input id="autorepeatPeriodRange" type="range" id="autorepeatPeriodRange" oninput="this.previousElementSibling.innerText = `Période : ${autorepeatPeriodRange.value}ms`" value="10" min="2" max="50" step="2"/>
</div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>Thème</legend> <legend>Style</legend>
<div></div> <div>
<select id="themeSelect" onchange="themeChanged()"> <label for="themeSelect">Thème</label>
<select id="themeSelect" oninput="settings.applyTheme()" value="default">
<?php <?php
foreach(scandir("css/themes") as $theme) { foreach(array_slice(scandir("themes"), 2) as $theme) {
if (!in_array($theme,array(".",".."))) if (is_dir(pathinfo($theme)['dirname']))
echo " <option>" . pathinfo($theme, PATHINFO_FILENAME) . "</option>\n"; echo " <option>" . $theme . "</option>\n";
} }
?> ?>
</select> </select>
<?php
echoTable("themePreview", 6, 0, 6);
?>
</fieldset>
<div>
<input id="showGhostCheckbox" type="checkbox" checked onchange="showGhostChanged()"/>
<label for="showGhostCheckbox">Afficher le fantôme</label> <label for="showGhostCheckbox">Afficher le fantôme</label>
<input id="showGhostCheckbox" type="checkbox" checked/>
<table id="themePreviewTable" class="minoes-table">
<tbody>
<tr>
<th class="mino I"></th>
<th></th>
<th class="mino J"></th>
<th class="mino J"></th>
<th class="mino J"></th>
<th></th>
<th class="mino S"></th>
<th></th>
</tr>
<tr>
<th class="mino I"></th>
<th class="mino O"></th>
<th class="mino O"></th>
<th></th>
<th class="mino J"></th>
<th class="mino Z"></th>
<th class="mino S"></th>
<th class="mino S"></th>
</tr>
<tr>
<th class="mino I"></th>
<th class="mino O"></th>
<th class="mino O"></th>
<th class="mino L"></th>
<th class="mino Z"></th>
<th class="mino Z"></th>
<th class="mino T"></th>
<th class="mino S"></th>
</tr>
<tr>
<th class="mino I"></th>
<th class="mino L"></th>
<th class="mino L"></th>
<th class="mino L"></th>
<th class="mino Z"></th>
<th class="mino T"></th>
<th class="mino T"></th>
<th class="mino T"></th>
</tr>
</tbody>
</table>
</div> </div>
<button type="button" onclick="hideSettings()">RETOUR</button> </fieldset>
</section>
<section id="gameSection" style="display: none">
<div>
<?php
echoTable("holdTable", 6, 0, 6);
echoTable("matrixTable", 4, 20, 10);
echoTable("nextTable", 24, 0, 6);
?>
<table id="statsTable">
<tr><th colspan=2>SCORE</th></tr>
<tr><td id="score" colspan=2>0</td></tr>
<tr><th colspan=2>RECORD</th></tr>
<tr><td id="highScore" colspan=2>0</td></tr>
<tr><th colspan=2>TEMPS</th></tr>
<tr><td id="time" colspan=2>00:00</td></tr>
<tr><td colspan=2><br/></td></tr>
<tr><th>NIVEAU</th><td id="level">0</td></tr>
<tr><th>OBJECTIF</th><td id="goal">0</td></tr>
<tr><th>LIGNES</th><td id="clearedLines">0</td></tr>
</table>
<span id="messageSpan"></span>
</div> </div>
<fieldset id="start"> </section>
<section id="startSection">
<fieldset>
<legend>Nouvelle partie</legend> <legend>Nouvelle partie</legend>
<div></div>
<div> <div>
<label for="startLevel">Niveau</label> <label for="startLevel">Niveau</label>
<input type="number" id="startLevel" min="1" max="15" step="1"> <input type="number" id="startLevelInput" min="1" max="15" step="1" value="1">
<div></div>
<button id="startButton" type="button" onclick="newGame(Number(startLevelInput.value))">JOUER</button>
</div> </div>
<button id="startButton" type="button" onclick="newGame()" disabled>JOUER</button>
</fieldset> </fieldset>
</section>
<footer id="footer">
<div> <div>
<button id="settingsButton" type="button" onclick="showSettings()" disabled>OPTIONS</button>
</div>
<div id="leaderboardLink">
<a href="leaderboard.php" target="_blank">TABLEAU DE SCORE</a> <a href="leaderboard.php" target="_blank">TABLEAU DE SCORE</a>
</div> </div>
<div id="credits">
Sources d'inspiration des thèmes :
<a href="https://github.com/kubowania/Tetris">Ania Kubow</a>
<a href="https://www.tetriseffect.game/">Tetris Effect</a>
</div>
</footer>
</body> </body>
</html> </html>

View File

@ -12,8 +12,8 @@
echo "true"; echo "true";
else else
echo "false"; echo "false";
$query->closeCursor(); $query = null;
$db->close(); $db = null;
} else { } else {
header($_SERVER["SERVER_PROTOCOL"] . " 405 Method Not Allowed", true, 405); header($_SERVER["SERVER_PROTOCOL"] . " 405 Method Not Allowed", true, 405);
} }

16
leaderboard.js Normal file
View File

@ -0,0 +1,16 @@
const DEFAULT_THEME = "default"
function applyTheme() {
var link = document.createElement('link')
link.id = "theme";
link.rel = 'stylesheet'
link.type = 'text/css'
link.href = `themes/'${themeName}/style.css`
link.media = 'all'
document.head.appendChild(link);
}
window.onload = function() {
themeName = localStorage.getItem("themeName") || DEFAULT_THEME
loadTheme()
}

View File

@ -4,7 +4,7 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Meilleurs scores - Webtris</title> <title>Meilleurs scores - Webtris</title>
<link rel="icon" type="image/png" href="favicon.png"> <link rel="icon" type="image/png" href="favicon.png">
<link rel="stylesheet" type="text/css" href="css/style.css" /> <script type="text/javascript" src="leaderboard.js"></script>
</head> </head>
<body> <body>
<header> <header>
@ -24,17 +24,12 @@
$score = number_format($row['score'], 0, ",", ""); $score = number_format($row['score'], 0, ",", "");
echo ' <tr><th class="name">' . $i . '<td class="player">' . $row['player'] . '</td><td class="value">' . $score . "</td></tr>\n"; echo ' <tr><th class="name">' . $i . '<td class="player">' . $row['player'] . '</td><td class="value">' . $score . "</td></tr>\n";
} }
$top10->closeCursor(); $top10 = null;
$db->close(); $db = null;
?> ?>
</table> </table>
<div class="flex-container"> <footer>
<div id="button-link"> <button onclick="window.close()">Fermer</button>
<a href="settings.php" target="_blank">OPTIONS</a> </footer>
</div>
<div id="button-link">
<a href="index.php">REJOUER</a>
</div>
</div>
</body> </body>
</html> </html>

32
manifest.json Normal file
View File

@ -0,0 +1,32 @@
{
"short_name": "Webtris",
"name": "Webtris",
"description": "Falling blocks",
"icons": [
{
"src": "favicon.png",
"type": "image/png",
"sizes": "16x16"
}
],
"start_url": "index.php",
"background_color": "#222",
"display": "standalone",
"scope": ".",
"theme_color": "#222",
"shortcuts": [
{
"name": "Webtris",
"short_name": "Webtris",
"description": "Falling blocks",
"url": "index.php",
"icons": [
{
"src": "favicon.png",
"type": "image/png",
"sizes": "16x16"
}
]
}
]
}

View File

Before

Width:  |  Height:  |  Size: 368 KiB

After

Width:  |  Height:  |  Size: 368 KiB

View File

@ -14,14 +14,11 @@
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
} }
* { body {
color: white;
font-family: 'Share Tech'; font-family: 'Share Tech';
font-size: 1em; font-size: 1em;
margin: auto 1vmin; text-align: center;
} color: white;
body {
background-color: #0D111D; background-color: #0D111D;
background-image: url("images/bg.jpg"); background-image: url("images/bg.jpg");
background-size: cover; background-size: cover;
@ -29,148 +26,76 @@ body {
} }
h1 { h1 {
font-size: 5vmin;
margin: 1vmin auto;
text-shadow: 3px 2px rgba(153, 145, 175, 0.5);
text-align: center; text-align: center;
} }
section {
margin: 1em;
}
div { div {
display: flex; display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center; justify-content: center;
align-content: center; align-items: center;
margin: 1vmin auto; }
text-align: center;
column-gap: 2vmin; #settingsSection {
width: auto;
} }
fieldset { fieldset {
display: grid; border: 1px white solid;
grid-template-columns: 3fr 2fr 3fr 2fr; border-radius: 4px;
grid-gap: 1vmin; align-items: center;
margin: 1vmin auto; margin: 1vmin auto;
justify-items: center; width: 80%;
align-items: baseline;
} }
label { legend, label {
font-size: 1em; color: white;
} }
input[type="number"] { fieldset > div {
color: black; display: grid;
width: 2.5em; grid-template-columns: repeat(4, 1fr);
grid-column-gap: 2em;
grid-row-gap: 1em;
justify-items: right;
align-items: center;
} }
fieldset > input { fieldset > div > * {
width: 100%; width: 100%;
} }
button { label {
color: black; text-align: right;
margin: 0.5vmin;
} }
select { #themePreviewTable {
color:black; grid-column: 1 / 5;
} width: auto;
a {
text-decoration: none;
font-size: 1em;
}
a:hover {
color: lightcyan;
}
#game {
position: relative;
display: none;
width: 72vmin;
grid-template-columns: 18vmin 30vmin 18vmin;
grid-gap: 3vmin;
margin: auto; margin: auto;
} }
.minoes-table { #gameSection div {
table-layout: fixed; display: grid;
border-spacing: 0; grid-gap: 3vmin;
margin: 0; margin: -6vmin 0 auto 0;
} }
th { #holdTable {
font-weight: normal;
}
th, td {
padding: 0;
border-width: 1px;
border-style: solid;
border-color: transparent;
height: 2vmin;
width: 2vmin;
}
#hold {
grid-column: 1; grid-column: 1;
grid-row: 1; grid-row: 1;
width: 18vmin;
height: 18vmin;
justify-self: end; justify-self: end;
} }
#matrix { #matrixTable {
grid-column: 2; grid-column: 2;
grid-row: 1 / 3; grid-row: 1 / 4;
width: 30vmin;
height: 72vmin;
} }
#next { #messageSpan {
grid-column: 3;
grid-row: 1 / 3;
width: 18vmin;
height: 72vmin;
}
#stats {
grid-column: 1;
grid-row: 2;
height: 0;
width: 18vmin;
justify-self: end;
margin: 0;
}
.name {
font-family: 'Share Tech';
text-align: left;
font-size: 2.5vmin;
color: white;
}
.player {
font-family: 'Share Tech';
text-align: center;
font-size: 2.5vmin;
color: white;
}
.value {
font-family: 'Share Tech Mono';
text-align: right;
font-size: 2.5vmin;
color: white;
}
#score {
font-weight: bold;
}
#message {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
@ -182,36 +107,125 @@ th, td {
font-weight: bold; font-weight: bold;
} }
#settings { #nextTable {
display: none; grid-column: 3;
grid-row: 1 / 4;
} }
#settings > * {
margin: 2vmin auto; .minoes-table {
table-layout: fixed;
border-spacing: 0;
margin: -6vmin 0 auto 0;
} }
#settings > div { th, td {
justify-content: left; font-weight: normal;
width: 85vmin; padding: 0;
border-width: 1px;
border-style: solid;
border-color: transparent;
height: 3vmin;
width: 3vmin;
} }
#settings > div > * { th {
margin: 0; background: transparent;
border: 1px solid transparent;
} }
#keyboard button { td {
background: transparent;
border: 1px inset rgba(128, 128, 128, 0.3);
}
.mino {
background: rgba(127, 229, 255, 0.3);
border: 1px solid rgba(127, 229, 255, 0.7);
border-radius: 0.3vmin;
}
.locked-mino {
background: rgba(242, 255, 255, 0.5);
border-color: rgba(242, 255, 255, 0.7);
}
.cleared-line {
background: white;
}
.trail {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 0.3vmin;
}
.ghost {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 0.3vmin;
}
#statsTable {
grid-column: 1;
grid-row: 3;
height: 0;
justify-self: end;
margin: 0 auto;
}
#statsTable td {
text-align: center;
font-weight: bold;
border: 0;
}
footer > * {
margin: 1em auto;
width: 100%; width: 100%;
} }
#themePreview { a {
width: 18vmin; text-decoration: none;
height: 18vmin; font-size: 1em;
color: white;
} }
a:hover {
color: lightcyan;
}
#credits {
width: 100%;
font-size: 0.8em;
gap: 0.8em;
}
#leaderboard { #leaderboard {
min-width: 25%; min-width: 25%;
margin: auto; margin: auto;
text-align: center; text-align: center;
border-top: 1px solid white; border-top: 1px solid white;
caption-side: top; caption-side: top;
border-spacing: 1em 0.2em;
}
#leaderboard caption {
color: white;
}
#leaderboard tr,
#leaderboard td {
border: 0 !important;
margin: auto 10em;
}
#leaderboard td:first-child {
text-align: left;
}
#leaderboard td:last-child {
text-align: right;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

300
themes/Kubow/style.css Normal file
View File

@ -0,0 +1,300 @@
/* source: https://github.com/kubowania/Tetris */
:root {
/* default font size in browsers is 16px = 1em, we make
things easier for us and make 10px our base size.
We have 10/16 = 0.625 = 1rem as it is set on root element.
So 1rem is now 10px throughout our stylesheet.*/
font-size: 0.625em;
}
* {
box-sizing: border-box;
}
body {
font-family: "Montserrat", sans-serif;
font-size: 1.6rem;
margin: auto;
max-width: 60rem;
color: #d8edea;
background: radial-gradient(
circle,
rgba(175, 196, 174, 1) 0%,
rgba(104, 204, 191, 1) 89%,
rgba(94, 191, 178, 1) 100%
);
}
h1 {
text-align: center;
margin: 1rem;
letter-spacing: 1.5rem;
}
section {
margin: 1em;
}
div {
display: flex;
justify-content: center;
align-items: center;
}
#settingsSection {
width: auto;
}
fieldset, #statsTable, #leaderboard {
margin-top: 1rem;
background: #f0f0f0;
background-image: linear-gradient(#d0d0d0, #f0f0f0);
border: 0;
border-radius: 5px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) inset, 0 1px 0 #fff;
color: #85796b;
}
legend, #leaderboard caption {
font-size: 0.9em;
color: #d8edea;
transform: translate(0, -0.6em);
}
fieldset > div {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-column-gap: 1em;
grid-row-gap: 1em;
justify-items: right;
align-items: center;
}
fieldset > div > * {
width: 100%;
}
label {
text-align: right;
}
button,
input[type="number"],
select {
text-transform: uppercase;
position: relative;
width: 22rem;
height: 2.2rem;
text-align: center;
color: #fff;
letter-spacing: 1px;
text-decoration: none;
line-height: 23px;
font-size: 10px;
display: block;
text-shadow: -1px -1px 0 #a84155;
background: #d25068;
border: 1px solid #d25068;
width: 12rem;
background-image: linear-gradient(to bottom, #f66c7b, #d25068);
border-radius: 5px;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset,
0 -1px 0 rgba(255, 255, 255, 0.1) inset, 0 4px 0 #ad4257,
0 4px 2px rgba(0, 0, 0, 0.5);
}
button:before,
input[type="number"]:before,
select:before {
background: #f0f0f0;
background-image: linear-gradient(#d0d0d0, #f0f0f0);
border-radius: 5px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) inset, 0 1px 0 #fff;
position: absolute;
content: "";
left: -6px;
right: -6px;
top: -6px;
bottom: -10px;
z-index: -1;
}
button:active,
select:active {
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset,
0 -1px 0 rgba(255, 255, 255, 0.1) inset;
top: 5px;
}
button:active:before,
input[type="number"]:active:before,
select:active:before {
top: -11px;
bottom: -5px;
content: "";
}
button:hover,
input[type="number"]:hover,
select:hover {
background: #f66c7b;
background-image: linear-gradient(top, #d25068, #f66c7b);
}
#themePreviewTable {
grid-column: 1 / 5;
width: auto;
}
#gameSection div {
display: grid;
grid-gap: 3vmin;
}
#holdTable {
grid-column: 1;
grid-row: 1;
justify-self: end;
}
#matrixTable {
grid-column: 2;
grid-row: 1 / 4;
}
#messageSpan {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: rgba(255, 255, 255, 0.8);
font-size: 4vmin;
text-align: center;
text-shadow: 1px 1px rgba(153, 145, 175, 0.5);
}
#nextTable {
grid-column: 3;
grid-row: 1 / 4;
}
.minoes-table {
table-layout: fixed;
border-spacing: 0;
margin: auto;
}
th, td {
font-weight: normal;
padding: 0;
height: 2rem;
width: 2rem;
background: transparent;
border: 0;
}
.I {
background-image: url(images/blue_block.png);
}
.J {
background-image: url(images/navy_block.png);
}
.L {
background-image: url(images/peach_block.png);
}
.O {
background-image: url(images/yellow_block.png);
}
.S {
background-image: url(images/green_block.png);
}
.T {
background-image: url(images/purple_block.png);
}
.Z {
background-image: url(images/pink_block.png);
}
.locked {
background: #f0f0f0;
border: 3px outset rgba(255, 255, 255, 0.2);
}
.cleared-line {
background: white;
}
.trail {
border-top: 0 !important;
border-bottom: 0 !important;
border-left: 3px solid rgba(255, 255, 255, 0.2) !important;
border-right: 3px solid rgba(125, 125, 125, 0.2) !important;
background: rgba(255, 255, 255, 0.1) !important;
}
.ghost {
border: 3px outset rgba(255, 255, 255, 0.2);
border-radius: 2px;
color: rgba(255, 255, 255, 0.9);
}
#statsTable {
grid-column: 1;
grid-row: 2;
color: rgb(133, 121, 107, 0.5);
padding-top: 1rem;
font-size: 1.2rem;
}
#statsTable td {
text-align: center;
border: 0;
font-size: 2.3rem;
color: rgb(133, 121, 107, 0.5);
}
footer {
position: absolute;
left: 50%;
bottom: 1em;
transform: translateX(-50%);
display: none;
}
a {
text-decoration: none;
color: lightblue;
}
#credits {
font-size: 0.8em;
gap: 0.8em;
}
#leaderboard {
margin: auto;
}
#leaderboard td {
margin: auto;
padding-left: 1rem;
text-align: center;
}
#leaderboard td:first-child{
text-align: left;
}
#leaderboard td:last-child {
text-align: right;
}

246
themes/default/style.css Normal file
View File

@ -0,0 +1,246 @@
body {
margin: auto;
font-family: sans-serif;
color: white;
background: #222;
width: max-content;
}
h1 {
text-align: center;
}
section {
margin: 1em auto;
}
div {
display: flex;
justify-content: center;
align-items: center;
}
fieldset {
border: 1px solid #444;
margin: 0.5em;
}
legend {
font-size: 0.9em;
color: #AAA;
}
fieldset > div {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-column-gap: 2em;
grid-row-gap: 1em;
justify-items: right;
align-items: center;
}
fieldset > div > * {
width: 100%;
}
label {
text-align: right;
}
#themePreviewTable {
grid-column: 1 / 5;
width: auto;
margin: auto;
}
#gameSection div {
display: grid;
grid-gap: 3vmin;
margin: -3vmin 0 auto 0;
}
#holdTable {
grid-column: 1;
grid-row: 1;
justify-self: end;
}
#matrixTable {
grid-column: 2;
grid-row: 1 / 4;
}
#messageSpan {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: rgba(255, 255, 255, 0.8);
font-size: 4vmin;
text-shadow: 1px 1px rgba(0, 0, 0, 0.8);
text-align: center;
font-weight: bold;
}
@keyframes message-fade-out {
from {opacity: 1;}
to {opacity: 0;}
}
.messageSpan-fade-out {
animation: message-fade-out 500ms 500ms;
}
#nextTable {
grid-column: 3;
grid-row: 1 / 4;
}
.minoes-table {
table-layout: fixed;
border-spacing: 0;
margin: -6vmin 0 auto 0;
}
th, td {
font-weight: normal;
padding: 0;
height: 3vmin;
width: 3vmin;
}
th {
border: 1px solid transparent;
}
td {
border: 1px solid #444;
}
.mino {
border: 1px solid;
border-radius: 1px;
}
.I { /* cyan */
background: #99d9ea;
border-color: #d1edf5;
}
.J { /* blue */
background: #7f92ff;
border-color: #c2cbff;
}
.L { /* orange */
background: #ffb27f;
border-color: #ffe1cd;
}
.O { /* yellow */
background: #ffe97f;
border-color: #fff5ca;
}
.S { /* green */
background: #7fff8e;
border-color: #ccffd2;
}
.T { /* magenta */
background: #d67fff;
border-color: #edc9ff;
}
.Z { /* red */
background: #ff7f7f;
border-color: #ffdada;
}
.locked-mino {
background: #AAA;
border: 1px solid #CCC;
border-radius: 1px;
}
@keyframes mino-fade-out {
from {
background: rgba(170, 170, 170, 1);
border: 1px solid #CCC;
}
to {
background: rgba(170, 170, 170, 0);
border: 1px solid #444;
}
}
.cleared-line,
.trail {
animation: mino-fade-out 200ms;
background: transparent;
border: 1px solid #444;
}
.ghost {
background: #555;
border: 1px solid #666;
border-radius: 1px;
}
#statsTable {
grid-column: 1;
grid-row: 3;
height: 0;
justify-self: end;
margin: 0 auto;
}
#statsTable td {
text-align: center;
font-weight: bold;
border: 0;
}
a {
text-decoration: none;
color: lightblue;
}
footer > * {
margin: 1em auto;
width: 100%;
}
#credits {
width: 100%;
font-size: 0.8em;
gap: 0.8em;
}
#leaderboard {
min-width: 25%;
margin: auto;
text-align: center;
border-top: 1px solid white;
caption-side: top;
border-spacing: 1em 0.2em;
}
#leaderboard caption {
color: white;
}
#leaderboard tr,
#leaderboard td {
border: 0 !important;
margin: auto 10em;
}
#leaderboard td:first-child {
text-align: left;
}
#leaderboard td:last-child {
text-align: right;
}

BIN
thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB