murdos / musicbrainz-userscripts

Collection of userscripts for MusicBrainz, by various authors
553 stars 92 forks source link

Musicbrainz UI enhancements ISRC bug #506

Closed karpuzikov closed 1 year ago

karpuzikov commented 2 years ago

image ISRCs are broken

tigerman325 commented 2 years ago

Came here for the same reason.

texke commented 1 year ago

Yow, made a temp workaround for this, feel free to (ab)use it :) Replaces lines 158 - 184 with:

    re = new RegExp('musicbrainz.org/artist/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/recordings', 'i');
    if (window.location.href.match(re)) {
        let isrcColNo; // = ($("#content table.tbl thead th:eq(2)").text() == "Artist") ? 3 : 2;
        $('#content table.tbl thead th').each(function (index, th) {
            if ($(th).text() == 'ISRCs') {
                isrcColNo = index;
                return false;
            }
        });
        $('#content table.tbl tbody tr').each(function () {
            $(this).find(`td:eq(${isrcColNo})`).find('li').each(function() {
                let newHTML = '';
                var isrc = $(this).text();
                newHTML += `<a href='/isrc/${isrc}'><bdi><code>`;
                newHTML += `${isrc.substring(0, 5)}<b>${isrc.substring(5, 7)}</b>${isrc.substring(7)}`;
                newHTML += '</code></bdi></a>';
                $(this).html(newHTML);
            });
        });
    }

Should give the desired result back (I think, I started using this script after breaking): image

karpuzikov commented 1 year ago

that works for me. thank you

murdos commented 1 year ago

Fixed with #527