BC: record label link visible

copy the "← record label" link above the album art so it's visible without resizing the browser window

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name        BC: record label link visible
// @namespace   userscript1
// @match       https://*.bandcamp.com/*
// @match       https://*.bandcamp.com/
// @grant       none
// @version     0.1.1
// @description copy the "← record label" link above the album art so it's visible without resizing the browser window
// @license     GPLv3
// ==/UserScript==

(function() {
  'use strict';

  document.querySelector('div.middleColumn')?.insertAdjacentHTML('afterBegin',
    `<div id="labelcopy" style="margin-bottom: 1em;"></div>`
  );

  var target = document.querySelector('#labelcopy');
  document.querySelectorAll('a.back-to-label-link').forEach(a => {
    var text = a.firstElementChild.innerHTML.split('<br>').join(' '); // innerText strips thelinebreak??
    var href = a.href;
    target.innerHTML = `<a href=${href}>← ${text}</a>`;
  });

})();