From 75e802e5b27425db95d000f714e3b3363a5e1a9c Mon Sep 17 00:00:00 2001 From: Dominic DiTaranto Date: Sun, 22 Sep 2024 21:30:28 -0400 Subject: inital commit --- static/main.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 static/main.js (limited to 'static/main.js') diff --git a/static/main.js b/static/main.js new file mode 100644 index 0000000..4fcb1bd --- /dev/null +++ b/static/main.js @@ -0,0 +1,29 @@ +var colors = ['red', 'green', 'blue', 'grey'] +var stats = document.getElementById("stats") + +function generateFretMarkers(chordMap, counts) { + var chordCount = 0; + for (const [chord, notes] of Object.entries(chordMap)) { + for (let i = 0; i < notes.length; i++) { + var fret = document.getElementById(notes[i]); + var fretMarker = document.createElement("div"); + fretMarker.style.backgroundColor = colors[chordCount] + + if (counts[notes[i]] == 2) { + fretMarker.style.width = "50%" + } + + if (counts[notes[i]] == 3) { + fretMarker.style.width = "33%" + } + + if (counts[notes[i]] == 4) { + fretMarker.style.width = "25%" + } + + fret.appendChild(fretMarker) + } + stats.innerHTML += '' + chord + ' '; + chordCount++ + } +} -- cgit v1.2.3-70-g09d2