recordar si se muestran los acordes y ocultar controles irrelevantes

This commit is contained in:
Carlos Galindo 2021-07-13 14:08:59 +02:00
parent 9c7fcd1ec3
commit c084ca2d89
2 changed files with 6 additions and 5 deletions

View file

@ -18,7 +18,6 @@ function size(steps) {
TRANSPOSE CHORDS TRANSPOSE CHORDS
=========================================== */ =========================================== */
ENG_INDEX = {'C': 0, 'C#': 1, 'Db': 1, 'D': 2, 'D#': 3, 'Eb': 3, 'E': 4, 'Fb': 4, 'F': 5, 'E#': 5, 'F#': 6, 'Gb': 6, 'G': 7, 'G#': 8, 'Ab': 8, 'A': 9, 'A#': 10, 'Bb': 10, 'B': 11, 'Cb': 11, 'B#': 0} ENG_INDEX = {'C': 0, 'C#': 1, 'Db': 1, 'D': 2, 'D#': 3, 'Eb': 3, 'E': 4, 'Fb': 4, 'F': 5, 'E#': 5, 'F#': 6, 'Gb': 6, 'G': 7, 'G#': 8, 'Ab': 8, 'A': 9, 'A#': 10, 'Bb': 10, 'B': 11, 'Cb': 11, 'B#': 0}
LAT_INDEX = {'Do': 0, 'Do#': 1, 'Reb': 1, 'Re': 2, 'Re#': 3, 'Mib': 3, 'Mi': 4, 'Fab': 4, 'Fa': 5, 'Mi#': 5, 'Fa#': 6, 'Solb': 6, 'Sol': 7, 'Sol#': 8, 'Lab': 8, 'La': 9, 'La#': 10, 'Sib': 10, 'Si': 11, 'Dob': 11, 'Si#': 0} LAT_INDEX = {'Do': 0, 'Do#': 1, 'Reb': 1, 'Re': 2, 'Re#': 3, 'Mib': 3, 'Mi': 4, 'Fab': 4, 'Fa': 5, 'Mi#': 5, 'Fa#': 6, 'Solb': 6, 'Sol': 7, 'Sol#': 8, 'Lab': 8, 'La': 9, 'La#': 10, 'Sib': 10, 'Si': 11, 'Dob': 11, 'Si#': 0}
CHORDS_LAT = ['Do', 'Do#', 'Re', 'Re#', 'Mi', 'Fa', 'Fa#', 'Sol', 'Sol#', 'La', 'Sib', 'Si'] CHORDS_LAT = ['Do', 'Do#', 'Re', 'Re#', 'Mi', 'Fa', 'Fa#', 'Sol', 'Sol#', 'La', 'Sib', 'Si']
@ -69,19 +68,21 @@ function getTranspose() {
=========================================== */ =========================================== */
// Init // Init
document.addEventListener("DOMContentLoaded", function () { window.onload = function () {
var show = localStorage.getItem("show_chords") == "true"; var show = localStorage.getItem("show_chords") == "true";
showChords(show); showChords(show);
document.getElementById("showChords").checked = show; document.getElementById("showChords").checked = show;
}, false); };
function showChords(show) { function showChords(show) {
if (show || show == "true") { if (show || show == "true") {
document.getElementById("songLyrics").style.display = "none"; document.getElementById("songLyrics").style.display = "none";
document.getElementById("songChords").style.display = "block"; document.getElementById("songChords").style.display = "block";
document.getElementById("transposeControls").style.display = "block";
} else { } else {
document.getElementById("songLyrics").style.display = "block"; document.getElementById("songLyrics").style.display = "block";
document.getElementById("songChords").style.display = "none"; document.getElementById("songChords").style.display = "none";
document.getElementById("transposeControls").style.display = "none";
} }
localStorage.setItem("show_chords", show); localStorage.setItem("show_chords", show);
} }

View file

@ -28,7 +28,7 @@
<div> <div>
<label><input id="showChords" type="checkbox" checked onchange="showChords(this.checked)"/> Mostrar acordes</label> <label><input id="showChords" type="checkbox" checked onchange="showChords(this.checked)"/> Mostrar acordes</label>
</div> </div>
<div> <div id="transposeControls">
<label>Transponer acordes </label> <label>Transponer acordes </label>
<button class="small" onclick="transposeAdd(-2)">-2</button> <button class="small" onclick="transposeAdd(-2)">-2</button>
<button class="small" onclick="transposeAdd(-1)">-1</button> <button class="small" onclick="transposeAdd(-1)">-1</button>