Skip to content

Commit

Permalink
feat(inline recs): Order tracks by ascending release dates
Browse files Browse the repository at this point in the history
  • Loading branch information
jesus2099 committed May 5, 2024
1 parent 811bb8b commit 613209f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mb_qol_inline_recording_tracks.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name MB: QoL: Inline all recording's tracks on releases
// @version 2024.5.2
// @version 2024.5.3
// @description Display all tracks and releases on which a recording appears from the release page.
// @author ROpdebee
// @license MIT; https://opensource.org/licenses/MIT
Expand Down Expand Up @@ -72,7 +72,8 @@ function getTrackIndices(media) {
}

function getReleaseName(release) {
return `<a href="/release/${release.id}">${release.title}</a>`;
let releaseComment = release.disambiguation || "";
return `<!-- order by: ${release.date || "????"} ${release.title} ${releaseComment} --><a href="/release/${release.id}" ` + (release.date ? `title="${release.date}"` : '') + `>${release.title}</a>` + (releaseComment ? ` <span class="comment">(${releaseComment})</span>` : '');
}

function formatRow(release) {
Expand All @@ -82,6 +83,7 @@ function formatRow(release) {
function insertRows(recordingTd, recordingInfo) {
let rowElements = recordingInfo.releases
.map(formatRow)
.sort()
.map(row => '<dl class="ars"><dt>appears on:</dt><dd>' + row + '</dd></dl>')
.join('\n');
rowElements = '<div class="ars ROpdebee_inline_tracks">' + rowElements + '</div>';
Expand Down

0 comments on commit 613209f

Please sign in to comment.