From 1e95a1957485f9be4ed1415a32880f3491144edf Mon Sep 17 00:00:00 2001 From: Guarde Date: Sat, 9 Dec 2023 22:13:12 +0100 Subject: [PATCH 1/3] Change "Folder Name" to "Song trackRef", make it required and update popup/tooltip --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 485dee6..434ce18 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea +/.vs From 1f738e81e6b51918a7eaa1707d4237ab0b168a3e Mon Sep 17 00:00:00 2001 From: Guarde Date: Sat, 9 Dec 2023 22:13:29 +0100 Subject: [PATCH 2/3] Change "Folder Name" to "Song trackRef", make it required and update popup/tooltip --- index.html | 9 ++++----- src/generate.js | 2 +- src/inputs.js | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 93b4ea9..67d7581 100644 --- a/index.html +++ b/index.html @@ -138,12 +138,11 @@

- Chart info -

- Other -

- i - - + i + + - i + i diff --git a/src/generate.js b/src/generate.js index ce0bc83..c2c16bd 100644 --- a/src/generate.js +++ b/src/generate.js @@ -8,7 +8,7 @@ const Generate = (function () { if (!Inputs.verifyInputs() || MidiToNotes.notes.length === 0) { alert( "Please ensure a valid midi is uploaded and all fields are filled\n" + - "(Folder Name and Song Endpoint can be empty)" + "(Song Endpoint can be empty)" ); return; } diff --git a/src/inputs.js b/src/inputs.js index 7f45329..09970d8 100644 --- a/src/inputs.js +++ b/src/inputs.js @@ -21,7 +21,7 @@ const Inputs = (function () { }; /** Inputs that are not required to be filled in */ - const optionalInputNames = new Set(["foldername", "songendpoint"]); + const optionalInputNames = new Set(["songendpoint"]); /** Inputs that need to be formatted as ints */ const intInputNames = new Set([ From 19ab4da8c52e8beb4958278aaed1aa353707d7e3 Mon Sep 17 00:00:00 2001 From: RShields Date: Thu, 14 Dec 2023 07:07:20 -0800 Subject: [PATCH 3/3] Add prefix trackRef --- index.html | 19 ++++++++++++++----- src/generate.js | 3 ++- src/inputs.js | 11 ++++++++++- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 67d7581..4ee2a56 100644 --- a/index.html +++ b/index.html @@ -138,9 +138,13 @@

- Chart info -

- Other -

- i - - + i + + + + i + + i @@ -173,8 +177,8 @@

About

  • Fill out the form
      -
    • All fields must be filled in, except those in the Other section
    • -
    • Only input whole numbers. Decimals are not guaranteed to work.
    • +
    • All fields must be filled in, except Song Endpoint
    • +
    • Use whole numbers whenever possible: Decimals are not guaranteed to work
    • Hover over the names of each field to see detailed info
  • @@ -276,6 +280,11 @@

    Examples

    Version history

    +

    + v1.8a:
    + Changed "Song Folder" to "trackRef" + Added option to generate unique trackRef prefix +

    v1.8:
    Added support for converting MIDI pitch bend events into note pitch adjustments diff --git a/src/generate.js b/src/generate.js index c2c16bd..c025a55 100644 --- a/src/generate.js +++ b/src/generate.js @@ -19,7 +19,8 @@ const Generate = (function () { ...inputs, notes: MidiToNotes.notes, lyrics: MidiToNotes.lyrics, - trackRef: inputs.trackRef || `${Math.random()}`, + trackRef: (inputs.prefixTrackRef ? Math.random().toString().substring(2) + '_' : '') + inputs.trackRef, + prefixTrackRef: undefined, endpoint: inputs.endpoint || MidiToNotes.calculatedEndpoint, UNK1: 0, }; diff --git a/src/inputs.js b/src/inputs.js index 09970d8..58396f1 100644 --- a/src/inputs.js +++ b/src/inputs.js @@ -16,7 +16,8 @@ const Inputs = (function () { notespacing: "savednotespacing", notestartcolor: "note_color_start", noteendcolor: "note_color_end", - foldername: "trackRef", + trackRef: "trackRef", + prefixTrackRef: "prefixTrackRef", songendpoint: "endpoint", }; @@ -39,6 +40,9 @@ const Inputs = (function () { /** Inputs that need to be formatted as colors */ const colorInputNames = new Set(["notestartcolor", "noteendcolor"]); + /** Checkbox inputs fetch `checked` instead of `value` */ + const checkboxInputNames = new Set(["prefixTrackRef"]); + /** Returns whether all required fields are filled in */ function verifyInputs() { for (const [inputName, input] of Object.entries(inputs)) { @@ -59,6 +63,8 @@ const Inputs = (function () { result[inputMap[inputName]] = Number(input.value); } else if (colorInputNames.has(inputName)) { result[inputMap[inputName]] = Color.hexToFloats(input.value); + } else if (checkboxInputNames.has(inputName)) { + result[inputMap[inputName]] = input.checked; } else { result[inputMap[inputName]] = input.value; } @@ -94,6 +100,9 @@ const Inputs = (function () { } input.dispatchEvent(new Event("change")); } + + // Do not prefix if the trackRef was passed + if (obj.trackRef) inputs.prefixTrackRef.checked = false; } /** Converts a string to an number, warning if it's actually a float */