recording-comments: Delay script and match disc URL

* Delay script. Otherwise, React removes it.

* Enable script on disc URL (ulugabi workaround for big releases)
This commit is contained in:
jesus2099 2022-02-03 18:45:49 +01:00 committed by GitHub
parent b91f40247d
commit 41b34e57df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,15 +1,13 @@
// ==UserScript== // ==UserScript==
// @name MusicBrainz: Set recording comments for a release // @name MusicBrainz: Set recording comments for a release
// @description Batch set recording comments from a Release page. // @description Batch set recording comments from a Release page.
// @version 2021.8.22.1 // @version 2022.2.3
// @author Michael Wiencek // @author Michael Wiencek
// @license X11 // @license X11
// @namespace 790382e7-8714-47a7-bfbd-528d0caa2333 // @namespace 790382e7-8714-47a7-bfbd-528d0caa2333
// @downloadURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/set-recording-comments.user.js // @downloadURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/set-recording-comments.user.js
// @updateURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/set-recording-comments.user.js // @updateURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/set-recording-comments.user.js
// @match *://*.musicbrainz.org/release/* // @include /^https?:\/\/(\w+\.)?musicbrainz\.org\/release\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}(\/disc\/\d+|$)/
// @exclude *musicbrainz.org/release/*/*
// @exclude *musicbrainz.org/release/add*
// @grant none // @grant none
// @run-at document-idle // @run-at document-idle
// ==/UserScript== // ==/UserScript==
@ -41,9 +39,11 @@
// authorization. // authorization.
// ==/License== // ==/License==
setTimeout(function () {
const scr = document.createElement('script'); const scr = document.createElement('script');
scr.textContent = `$(${setRecordingComments});`; scr.textContent = `$(${setRecordingComments});`;
document.body.appendChild(scr); document.body.appendChild(scr);
}, 1000);
function setRecordingComments() { function setRecordingComments() {
let $tracks; let $tracks;
@ -93,7 +93,7 @@ function setRecordingComments() {
}); });
}, 1000); }, 1000);
if (!location.pathname.match(/^\/release\/[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$/)) { if (!location.pathname.match(/^\/release\/[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}/)) {
return; return;
} }