Fix an old issue causing the mb link to be added more than once.

Mark links as processed using an attribute.
Note: there is another old issue related to discogs page navigation, links don't always show up
This commit is contained in:
Laurent Monin 2015-06-06 10:42:28 +02:00
parent 636c9e0ca9
commit e66f4c45df

View file

@ -77,6 +77,10 @@ function insertMBLinks($root) {
function searchAndDisplayMbLinkInSection($tr, mb_type, discogs_type) {
$tr.find('a[href*="http://www.discogs.com/'+discogs_type+'/"]').each(function() {
var $link = $(this);
// ensure we do it only once per link
var done = $link.attr('mblink');
if (done) return;
$link.attr('mblink', true);
var discogs_url = $link.attr('href');
mblinks.searchAndDisplayMbLink(discogs_url, mb_type, function (link) { $link.before(link); });
});