From 0afe2aa85b5fbf6daf2294f2fada80a524a1efa6 Mon Sep 17 00:00:00 2001 From: spessasus <95608008+spessasus@users.noreply.github.com> Date: Tue, 19 Sep 2023 19:53:27 +0200 Subject: [PATCH] Title hotfix for demo --- index.html | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 6ef37efb..cc42a433 100644 --- a/index.html +++ b/index.html @@ -155,7 +155,6 @@

SpessaSynth: Online Demo

*/ async function startMidi(midiFiles) { - titleMessage.innerText = `Parsing ${midiFiles[0].name}`; let fName; if(midiFiles[0].name.length > 20) { @@ -174,28 +173,39 @@

SpessaSynth: Online Demo

* @type {MIDI[]} */ const parsed = []; + + /** + * @type {string[]} + */ + const titles = []; for (let i = 0; i < midiFiles.length; i++) { titleMessage.innerText = `Parsing ${midiFiles[i].name}`; parsed.push(await parseMidi(midiFiles[i])); + + let title; + if(parsed[i].midiName.trim().length > 0) + { + title = parsed[i].midiName.trim(); + } + else + { + title = midiFiles[i].name; + } + titles.push(title); } titleMessage.style.fontStyle = "italic"; - if(parsed[0].midiName.trim().length > 0) - { - titleMessage.innerText = parsed[0].midiName.trim(); - } - else - { - titleMessage.innerText = midiFiles[0].name; - } + document.title = titles[0]; + titleMessage.innerText = titles[0] if(manager.seq) { manager.seq.loadNewSongList(parsed); - manager.seq.currentTime = 0; + } else { manager.play(parsed); } + manager.seqUI.setSongTitles(titles); } /**