From dc55c92e08b6914a121321d313239ca4d9e05f82 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Tue, 25 Jun 2019 23:49:08 +0200 Subject: [PATCH] Make MusicBrainz: 1200px CAA prettier --- mb_1200px_caa.user.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/mb_1200px_caa.user.js b/mb_1200px_caa.user.js index 076a088..0cb26f2 100644 --- a/mb_1200px_caa.user.js +++ b/mb_1200px_caa.user.js @@ -2,7 +2,7 @@ // @name MusicBrainz: 1200px CAA // @name:da MusicBrainz: 1200px CAA // @namespace https://github.com/murdos/musicbrainz-userscripts/ -// @version 2019.6.25.1 +// @version 2019.6.25.2 // @author Frederik “Freso” S. Olesen // @license GPL-3.0-or-later // @description Use the 1200px images for the pop‐up/previews on Release cover art pages. (Also adds 1200px “thumbnail” links.) @@ -21,22 +21,22 @@ var ca_page = document.querySelector('div#content'); var ca_items = ca_page.querySelectorAll('div.artwork-cont'); ca_items.forEach(function(ca_item) { - /* Use 1200px “thumbnails” for the pop‐ups/previews */ - var popup_link = ca_item.querySelector('a.artwork-image'); - popup_link.href = popup_link.href.replace(/\.[a-z]+$/, '-1200.jpg'); + /* Use 1200px “thumbnails” for the pop‐ups/previews */ + var popup_link = ca_item.querySelector('a.artwork-image'); + popup_link.href = popup_link.href.replace(/\.[a-z]+$/, '-1200.jpg'); - /* Add a “1200px” link to the “All sizes” list */ - // Until https://tickets.metabrainz.org/browse/CAA-88 is resolved. - var link_list = ca_item.querySelector('p.small'); - var link_list_a = link_list.getElementsByTagName('a'); - for (var i = 0; i < link_list_a.length; i++) { - if (link_list_a[i].textContent == '500px') { - var _500px_link = link_list_a[i]; - break; + /* Add a “1200px” link to the “All sizes” list */ + // Until https://tickets.metabrainz.org/browse/CAA-88 is resolved. + var link_list = ca_item.querySelector('p.small'); + var link_list_a = link_list.getElementsByTagName('a'); + for (var i = 0; i < link_list_a.length; i++) { + if (link_list_a[i].textContent == '500px') { + var _500px_link = link_list_a[i]; + break; + } } - } - var _1200px_link = _500px_link.cloneNode(true); - _1200px_link.href = _1200px_link.href.replace('-500', '-1200'); - _1200px_link.textContent = _1200px_link.textContent.replace('500', '1200'); - _500px_link.insertAdjacentHTML('afterend', " |\n" + _1200px_link.outerHTML); + var _1200px_link = _500px_link.cloneNode(true); + _1200px_link.href = _1200px_link.href.replace('-500', '-1200'); + _1200px_link.textContent = _1200px_link.textContent.replace('500', '1200'); + _500px_link.insertAdjacentHTML('afterend', ' |\n' + _1200px_link.outerHTML); });