mirror of
https://gitlab.com/parroquia-san-leandro/cancionero-web.git
synced 2026-01-28 13:07:58 +01:00
change checkbox to radio buttons and simplify handling
This commit is contained in:
parent
a485826e7c
commit
8c1c0d47c3
1 changed files with 12 additions and 24 deletions
|
|
@ -46,8 +46,8 @@ span.songSelector {
|
||||||
<input type="button" onclick="shareList(event)" value="compartirla">.</p>
|
<input type="button" onclick="shareList(event)" value="compartirla">.</p>
|
||||||
<p>Si prefieres crear un PDF, <a href="https://cgj.es/cancionero-generador/">pulsa aquí</a>.</p>
|
<p>Si prefieres crear un PDF, <a href="https://cgj.es/cancionero-generador/">pulsa aquí</a>.</p>
|
||||||
<p>
|
<p>
|
||||||
<label class="forCheckbox"><input class="init" id="controlsCheckbox" type="checkbox" onchange="toggleControls(event)" checked> Modificar la lista</label>
|
<label class="forCheckbox"><input class="init" id="controlsCheckbox" type="radio" name="mode" onchange="toggleControls(event)" checked> Modificar la lista</label>
|
||||||
<label class="forCheckbox"><input class="init" id="previewCheckbox" type="checkbox" onchange="togglePreview(event)"> Ver las canciones</label>
|
<label class="forCheckbox"><input class="init" id="previewCheckbox" type="radio" name="mode" onchange="togglePreview(event)"> Ver las canciones</label>
|
||||||
<label class="forCheckbox"><input id="showChords" type="checkbox" checked onchange="showChords(this.checked)"/> Mostrar acordes</label>
|
<label class="forCheckbox"><input id="showChords" type="checkbox" checked onchange="showChords(this.checked)"/> Mostrar acordes</label>
|
||||||
</p>
|
</p>
|
||||||
<p class="controls mainButtons">
|
<p class="controls mainButtons">
|
||||||
|
|
@ -197,32 +197,20 @@ function getSongList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleControls(event) {
|
function toggleControls(event) {
|
||||||
if (event.target.checked) {
|
toggleMode(event.target.checked);
|
||||||
document.body.classList.remove("hideControls");
|
|
||||||
} else {
|
|
||||||
if (getSongList().length == 0) {
|
|
||||||
event.target.checked = true;
|
|
||||||
} else {
|
|
||||||
document.body.classList.add("hideControls");
|
|
||||||
let preview = document.getElementById('previewCheckbox');
|
|
||||||
if (!preview.checked) {
|
|
||||||
preview.checked = true;
|
|
||||||
preview.dispatchEvent(new Event("change"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function togglePreview(event) {
|
function togglePreview(event) {
|
||||||
if (event.target.checked) {
|
toggleMode(!event.target.checked);
|
||||||
document.body.classList.remove("hidePreview");
|
}
|
||||||
} else {
|
|
||||||
|
function toggleMode(controls) {
|
||||||
|
if (controls) {
|
||||||
|
document.body.classList.remove("hideControls");
|
||||||
document.body.classList.add("hidePreview");
|
document.body.classList.add("hidePreview");
|
||||||
let controls = document.getElementById('controlsCheckbox');
|
} else {
|
||||||
if (!controls.checked) {
|
document.body.classList.add("hideControls");
|
||||||
controls.checked = true;
|
document.body.classList.remove("hidePreview");
|
||||||
controls.dispatchEvent(new Event("change"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue