From bc84a78254817ea24ce53cf6af90576d4ab86c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Mino?= Date: Mon, 15 Jun 2015 23:19:45 +0200 Subject: [PATCH] encyclopedisque: code cleanup. --- encyclopedisque_importer.user.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/encyclopedisque_importer.user.js b/encyclopedisque_importer.user.js index 36c1c17..4a24b3a 100644 --- a/encyclopedisque_importer.user.js +++ b/encyclopedisque_importer.user.js @@ -51,17 +51,15 @@ function setupImportUI(release) { function insertMBLinks() { - $('body').find('div.v7P, div.v12P').each(function() { - $(this).find('a[href*="/disque/"]').each(function() { - var $link = $(this); - var external_url = 'http://www.encyclopedisque.fr' + $link.attr('href'); - mblinks.searchAndDisplayMbLink(external_url, 'release', function (link) { $link.after(link).after('
') } ); - }); + $('div.v7P, div.v12P').find('a[href*="/disque/"]').each(function() { + var $link = $(this); + var external_url = window.location.origin + $link.attr('href'); + mblinks.searchAndDisplayMbLink(external_url, 'release', function (link) { $link.after(link).after('
') } ); }); $('h2, div.main').find('a[href*="/artiste/"]').each(function() { var $link = $(this); - var external_url = 'http://www.encyclopedisque.fr' + $link.attr('href'); + var external_url = window.location.origin + $link.attr('href'); mblinks.searchAndDisplayMbLink(external_url, 'artist', function (link) { $link.before(link); } ); });