Harmony: Enhancements

Adds some convenience features, various UI and behavior settings, as well as an improved language detection to Harmony.

這裡只顯示彼此間有代碼差異的版本。 顯示所有版本。

  • v1.16.0 2025-10-30

    trim whitespace

  • v1.16.0 2025-10-29

    refactor(Harmony Enhancements.user.js): optimize DOM caching and prevent redundant parsing (#8)

    This commit addresses several inefficiencies and a bug in the script's initialization and data-loading process.

    1. DOM Caching Optimization:

      • initDOMCache has been broken into smaller, page-specific functions (e.g., cacheReleaseLookupPageDOM, cacheSettingsPageDOM).
      • The main() function now acts as a router, calling only the necessary caching function for the current page.
      • A new Map (releaseInfoRowsByHeader) is created once on release pages to cache table rows by their header text.
      • UI_UTILS.findReleaseInfoRow is refactored to use this Map, changing its lookup from O(n) to O(1) and speeding up all dependent modules (like toggleReleaseInfo).
    2. Redundant Parsing Fix:

      • Previously, modules would run on empty/error /release pages and each re-call getReleaseDataFromJSON, leading to multiple warnings and wasted cycles.
      • getReleaseDataFromJSON now uses a "tri-state" cache (initial: undefined, failed: null, success: {object}).
      • This ensures the __FRSH_STATE__ JSON is parsed exactly once. All subsequent calls instantly receive the cached result (either the release object or null).

    This fixes the bug of repeated "Could not find release data" warnings in the console and prevents modules from running on pages with no release.

    fix(Harmony Enhancements.user.js): Normalize ETI even without provider conflict (#9)

    The previous logic for normalizeETI on multi-provider releases (> 1 provider) would only trigger a normalization if Harmony's UI indicated a discrepancy between provider titles (i.e., a ul.alt-values list was present).

    This caused a bug where titles containing known "tech terms" (like "sped up" or "slowed") were not normalized if all providers agreed on the "bad" hyphenated ETI.

    This commit refactors the logic to check two conditions: A title will now be normalized if:

    1. The hyphenated ETI contains a term from the techTerms list. (This fixes the bug)
    2. OR it is a multi-provider release and a UI discrepancy is present. (This retains the original safeguard against false positives for non-tech-term ETI).

    refactor(Harmony Enhancements.user.js): Extract label link generation to a UI utility

    Created a new helper function, UI_UTILS.updateLabelLink, to provide a single, reusable method for updating the main release label <span>. This function handles clearing existing content and rebuilding it with either plain text (if no MBID) or a full MusicBrainz icon and link.

    This change achieves two objectives:

    1. DRY: Refactored mapLabelMbids to use this new helper, which significantly simplifies its code and removes duplicated DOM manipulation logic.

    2. Consistency/Fix: Refactored setNoLabel to also use updateLabelLink. This fixes an issue where setNoLabel would only update the label text but failed to add the correct link to the [no label] entity.

    Both label-modifying modules now behave consistently and share the same UI logic.

    feat(Harmony Enhancements.user.js): Disable spellcheck on textareas

    Disables the browser's native spellchecker for all <textarea> elements on the settings page. This improves usability as the text fields are used for technical terms, regular expressions, and label mappings, where spellchecking is unhelpful and distracting.

  • v1.15.2 2025-10-29

    refactor(Harmony Enhancements.user.js): optimize DOM caching and prevent redundant parsing (#8)

    This commit addresses several inefficiencies and a bug in the script's initialization and data-loading process.

    1. DOM Caching Optimization:

      • initDOMCache has been broken into smaller, page-specific functions (e.g., cacheReleaseLookupPageDOM, cacheSettingsPageDOM).
      • The main() function now acts as a router, calling only the necessary caching function for the current page.
      • A new Map (releaseInfoRowsByHeader) is created once on release pages to cache table rows by their header text.
      • UI_UTILS.findReleaseInfoRow is refactored to use this Map, changing its lookup from O(n) to O(1) and speeding up all dependent modules (like toggleReleaseInfo).
    2. Redundant Parsing Fix:

      • Previously, modules would run on empty/error /release pages and each re-call getReleaseDataFromJSON, leading to multiple warnings and wasted cycles.
      • getReleaseDataFromJSON now uses a "tri-state" cache (initial: undefined, failed: null, success: {object}).
      • This ensures the __FRSH_STATE__ JSON is parsed exactly once. All subsequent calls instantly receive the cached result (either the release object or null).

    This fixes the bug of repeated "Could not find release data" warnings in the console and prevents modules from running on pages with no release.

    Normalize ETI even without provider conflict (#9)

    The previous logic for normalizeETI on multi-provider releases (> 1 provider) would only trigger a normalization if Harmony's UI indicated a discrepancy between provider titles (i.e., a ul.alt-values list was present).

    This caused a bug where titles containing known "tech terms" (like "sped up" or "slowed") were not normalized if all providers agreed on the "bad" hyphenated ETI.

    This commit refactors the logic to check two conditions: A title will now be normalized if:

    1. The hyphenated ETI contains a term from the techTerms list. (This fixes the bug)
    2. OR it is a multi-provider release and a UI discrepancy is present. (This retains the original safeguard against false positives for non-tech-term ETI).

    refactor(label): Extract label link generation to a UI utility

    Created a new helper function, UI_UTILS.updateLabelLink, to provide a single, reusable method for updating the main release label <span>. This function handles clearing existing content and rebuilding it with either plain text (if no MBID) or a full MusicBrainz icon and link.

    This change achieves two objectives:

    1. DRY: Refactored mapLabelMbids to use this new helper, which significantly simplifies its code and removes duplicated DOM manipulation logic.

    2. Consistency/Fix: Refactored setNoLabel to also use updateLabelLink. This fixes an issue where setNoLabel would only update the label text but failed to add the correct link to the [no label] entity.

    Both label-modifying modules now behave consistently and share the same UI logic.

    feat(settings): Disable spellcheck on textareas

    Disables the browser's native spellchecker for all <textarea> elements on the settings page. This improves usability as the text fields are used for technical terms, regular expressions, and label mappings, where spellchecking is unhelpful and distracting.

  • v1.15.2 2025-10-28

    refactor(Harmony Enhancements.user.js): optimize DOM caching and prevent redundant parsing (#8)

    This commit addresses several inefficiencies and a bug in the script's initialization and data-loading process.

    1. DOM Caching Optimization:

      • initDOMCache has been broken into smaller, page-specific functions (e.g., cacheReleaseLookupPageDOM, cacheSettingsPageDOM).
      • The main() function now acts as a router, calling only the necessary caching function for the current page.
      • A new Map (releaseInfoRowsByHeader) is created once on release pages to cache table rows by their header text.
      • UI_UTILS.findReleaseInfoRow is refactored to use this Map, changing its lookup from O(n) to O(1) and speeding up all dependent modules (like toggleReleaseInfo).
    2. Redundant Parsing Fix:

      • Previously, modules would run on empty/error /release pages and each re-call getReleaseDataFromJSON, leading to multiple warnings and wasted cycles.
      • getReleaseDataFromJSON now uses a "tri-state" cache (initial: undefined, failed: null, success: {object}).
      • This ensures the __FRSH_STATE__ JSON is parsed exactly once. All subsequent calls instantly receive the cached result (either the release object or null).

    This fixes the bug of repeated "Could not find release data" warnings in the console and prevents modules from running on pages with no release.

  • v1.15.2 2025-10-27

    fix(Harmony Enhancements.user.js): Annotation not preserved

    Comment out 'annotation' in PARAMETER_GENERATORS as a preliminary measure.

  • v1.15.1 2025-10-25

    fix(Harmony Enhancements.user.js): switch order of setNoLabel and mapLabelMbids

  • v1.15.0 2025-10-25

    feat(Harmony Enhancements.user.js): Manually map label to MBID

  • v1.14.3 2025-10-24

    fix: use @connect self where applicable

  • v1.14.2 2025-10-15

    fix: add icon

  • v1.14.1 2025-10-15

    fix: add icon

  • v1.14.1 2025-10-04

    fix removeHardcodedBy on release actions page

  • v1.14.0 2025-09-28

    refactor debug mode, improve ETI normalization based on alternative values and technical terms

  • v1.13.2 2025-09-28

    fix release type detection

  • v1.13.1 2025-09-27

    disable debug by default

  • v1.13.0 2025-09-27

    improve clipboard re-lookup button to support all Harmony providers, fix script crashing on blank lookup page, remove '/' from regexp of normalizeETI

  • v1.12.2 2025-09-24

    revert

  • v1.12.1 2025-09-24

    paste actual new version

  • v1.12.0 2025-09-24

    slightly improve createIndicatorSpan, make language detection a three-state enum, reset also language detection mode, stop using pointer, fix buildSeederParameters to always set script and language, fix addClipboardButton running on '/', slightly deduplicate CSS,refactor main function for language detection modes, reformat SETTINGS_CONFIG

  • v1.11.0 2025-09-23

    refactor overwritten indicator UI util, add indicator for added release properties, add module to disable language detection entirely

  • v1.10.3 2025-09-21

    switch run order of setNoLabel and syncTrackArtist

  • v1.10.2 2025-09-20

    fix splitting BCP 47 tag into language and script

  • v1.10.1 2025-09-20

    fix catalog number seeding, add missing generators for medium name, recording mbid, comment and annotation

  • v1.10.0 2025-09-20

    fix finding common base title and deduplicating text block to be analyzed when casing differs, fix adding links for synced track artists, improve [no label] module to also match whole artist credit, improve sync track artist module to also run for for multi-track singles when all artists are identical, refactor form builder, add improved debug mode

  • v1.9.1 2025-09-18

    fix track artist credits dropped

  • v1.9.0 2025-09-17

    add ETI normalization module for Spotify, refactor overwritten data indicator

  • v1.8.0 2025-09-13

    add feature to sync 1-track release artist from track artist, fix setNoLabel when Harmony resolves a label, refactor form handler

  • v1.7.2 2025-09-06
  • v1.7.1 2025-09-06
  • v1.7.0 2025-08-30

    add improved EP detection, refactor message insertion and building

  • v1.6.6 2025-08-30

    improve language detection module when Harmony detected "[No linguistic content]"

  • v1.6.5 2025-08-23

    fix initDOMCache for lookupBtn

  • v1.6.4 2025-08-23

    get gtin for updateProperties from release data object

  • v1.6.3 2025-08-23

    improve CSS

  • v1.6.2 2025-08-22

    fix 'light' cleanLevel in getCleanedTitles

  • v1.6.1 2025-08-19

    handle multi-medium releases

  • v1.6.0 2025-08-18

    add improved label handling for self-releases

  • v1.5.0 2025-08-18

    add improved release type detection for singles

  • v1.4.1 2025-08-18

    actually fix TypeError in language detection module

  • v1.4.0 2025-08-18

    fixed TypeError in language detection module, remove tracklist copy feature as it's now integrated, introduce cache for DOM

  • v1.3.1 2025-08-16

    add icon

  • v1.3.0 2025-08-16

    refactor init, data extraction and CSS related code, add some features of afros-Harmony-Add-Ons.user.js

  • v1.2.2 2025-08-13

    indicate overwritten language, some refactoring

  • v1.2.1 2025-08-12

    fix hiding Harmony's debug messages by default

  • v1.2.0 2025-08-12

    use event listeners instead of mutation observers, fix removing "by" in release artist

  • v1.1.3 2025-08-06

    fix typo

  • v1.1.2 2025-08-05

    fix colors in textarea for dark theme

  • v1.1.1 2025-08-05

    fix modal background color for dark theme

  • v1.1.0 2025-08-05

    allow HTML in descriptions, restore original language detection filters, restore settings reset button

  • v1.0.0 2025-08-05