fix styleSheet change on chrome

This commit is contained in:
Adrien MALINGREY 2023-12-07 21:29:48 +01:00
parent 50502be1d1
commit e7246c0a5d
2 changed files with 10 additions and 9 deletions

View File

@ -9,7 +9,8 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.4/font/bootstrap-icons.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.4/font/bootstrap-icons.css">
<link rel="stylesheet" href="css/common.css"> <link rel="stylesheet" href="css/common.css">
<link rel="stylesheet" href="css/classic.css" title="Classique"> <link rel="stylesheet" href="css/classic.css" id="selectedStyleSheet">
<link rel="alternate stylesheet" href="css/classic.css" title="Classique" id="">
<link rel="alternate stylesheet" href="css/minimal.css" title="Minimal"> <link rel="alternate stylesheet" href="css/minimal.css" title="Minimal">
<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">
@ -59,12 +60,12 @@
<fieldset class="row g-2 mb-3 align-items-center text-center"> <fieldset class="row g-2 mb-3 align-items-center text-center">
<legend class="text-start">Interface</legend> <legend class="text-start">Interface</legend>
<label for="stylesheetSelect" class="col-2 col-form-label">Thème</label> <label for="stylesheetSelect" class="col-2 col-form-label">Thème</label>
<div class="col-4"><select name="stylesheet" id="stylesheetSelect" class="form-select" oninput="document.selectedStyleSheetSet=this.value"> <div class="col-4"><select name="stylesheet" id="stylesheetSelect" class="form-select" oninput="selectedStyleSheet.href=this.value">
<option selected>Classique</option> <option value="css/classic.css" selected>Classique</option>
<option>Minimal</option> <option value="css/minimal.css">Minimal</option>
<option>Pop</option> <option value="css/electro.css">Pop</option>
<option>Électro</option> <option value="css/pop.css">Électro</option>
<option>Rétro</option> <option value="css/retro.css">Rétro</option>
</select></div> </select></div>
<div class="col-4 d-flex align-items-baseline"><input id="sfxVolumeRange" class="form-range" type="range" min="0" max="1" step="any" value="0.7"></div> <div class="col-4 d-flex align-items-baseline"><input id="sfxVolumeRange" class="form-range" type="range" min="0" max="1" step="any" value="0.7"></div>
<label for="sfxVolumeRange" class="col-2 col-form-label">Volume</label> <label for="sfxVolumeRange" class="col-2 col-form-label">Volume</label>

View File

@ -9,7 +9,7 @@ let lastActionSucceded = true
let favicon let favicon
window.onload = function(event) { window.onload = function(event) {
document.selectedStyleSheetSet = stylesheetSelect.value selectedStyleSheet.href = stylesheetSelect.value
favicon = document.querySelector("link[rel~='icon']") favicon = document.querySelector("link[rel~='icon']")
restart() restart()
@ -120,7 +120,7 @@ let playerActions = {
scheduler.clearTimeout(lockDown) scheduler.clearTimeout(lockDown)
playSound(hardDropSound) playSound(hardDropSound)
while (matrix.piece.move(TRANSLATION.DOWN, ROTATION.NONE, true)) stats.score += 2 while (matrix.piece.move(TRANSLATION.DOWN, ROTATION.NONE, true)) stats.score += 2
matrix.table.classList.add("hard-dropped-table-animation") matrixCard.classList.add("hard-dropped-table-animation")
lockDown(true) lockDown(true)
return true return true
}, },