');
});
});
}
// Fix for http://tickets.musicbrainz.org/browse/MBS-750
re = new RegExp("musicbrainz\.org\/release\/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})","i");
if (window.location.href.match(re)) {
if ($("table.medium thead").length == 1) {
var text = $.trim($("table.medium thead").text());
if (text.match(/ 1$/)) {
$("table.medium thead a").text(text.replace(/ 1$/, ''));
}
}
}
// Better fix for http://tickets.musicbrainz.org/browse/MBS-1943
re = new RegExp("musicbrainz\.org\/(artist|release-group|release|recording|work|label)\/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})","i");
if (window.location.href.match(re)) {
$("#sidebar h2:contains('Rating')").before($("#sidebar h2:contains('External links')"));
var pageHasRGLinks = $("#sidebar h2:contains('Release group external links')").length > 0;
$("#sidebar h2:contains('Rating')").before(
$("#sidebar h2:contains('External links')").nextAll("ul.external_links").filter( function() {
return !pageHasRGLinks || $(this).nextAll("h2:contains('Release group external links')").length > 0;
}));
$("#sidebar h2:contains('Rating')").before($("#sidebar h2:contains('Release group external links')"));
$("#sidebar h2:contains('Rating')").before($("#sidebar h2:contains('Release group external links')").nextAll("ul.external_links"));
}
// Remove the affiliate section
re = new RegExp("musicbrainz\.org\/(artist|release-group|release|recording|work|label)\/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})","i");
if (window.location.href.match(re)) {
$('#sidebar-affiliates').remove();
}
// Batch merge -> open in a new tab/windows
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|releases|works)","i");
if (window.location.href.match(re)) {
$("form").filter(function() {
return $(this).prop("action").match("merge_queue");
}).attr("target", "_blank");
}
// Modify link to edits: remove " - " from the link "Edit XXXX - "
re = new RegExp("musicbrainz\.org/.*/(open_)?edits","i");
if (window.location.href.match(re)) {
$("div.edit-description ~ h2").each(function() {
var parts = $(this).find("a").text().split(" - ");
$(this).find("a").text(parts[0]);
$(this).append(" - " + parts[1]);
});
}
// Add direct link to cover art tab for Add cover art edits
re = new RegExp("musicbrainz\.org/(.*/(open_)?edits|edit\/\d+)","i");
if (window.location.href.match(re)) {
$("div.edit-description ~ h2:contains('cover art')").each(function() {
$editdetails = $(this).parents('.edit-header').siblings('.edit-details');
mbid = $editdetails.find("a[href*='musicbrainz.org/release/']").attr('href').match(/\/release\/(.{36})/)[1];
$editdetails.find('tbody td.edit-cover-art').after("