MB Enhancements for classical music

This should be achievable through a user script … I’m not good at scripting, but this should be easy.

Here is a user script which does the trick. Not pretty, but it works.

// ==UserScript==
// @name         MusicBrainz UI: Make tracks collapsible in Release "Edit Relationships"
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Make  tracks collapsible in Release "Edit Relationships"
// @author       You
// @grant        none
// @include      http*://*musicbrainz.org/release/*/edit-relationships
//// ==/UserScript==

/* global $ */

$(document).ready(function(){
    $('#content>p:first-of-type').after('<p id="collapsibleEnabler"><a>Click here to enable collapsible media</a></p>');
    $('#collapsibleEnabler').click(function(){
        $('.subh td').each(function(){
            $(this).css("width", $(this).width());
        });
        $('#tracklist tr:not(.subh)').slideToggle();
        $('.subh  td:first-child').append('<span class="collapse-mark collapsed"><a>▶</a></span>');
        $('.subh').click(function(){
            $(this).nextUntil('tr.subh').slideToggle();
            $(this).children().find("span.collapse-mark").toggleClass('collapsed expanded');
            $(this).children().find("span.collapsed a").replaceWith('<a>▶</a>');
            $(this).children().find("span.expanded a").replaceWith('<a>▼</a>');
        });
        $('#collapsibleEnabler').hide();
    });
});

[edited: managed to get the user script to work]
[edited: fixed the issue of column width of media row changing when collapsing the tracks]
[edited: fixed the issue of batch-add button disappearing, and added :arrow_forward:/▼ marks to indicate collapsible status]

1 Like