mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2024-12-13 20:02:27 +00:00
Various fixes or improvements
Pass GM_info inside wrapper function (@kellnerd) encodeURIComponent where needed (@kellnerd)
This commit is contained in:
parent
ac17654e85
commit
e54d39a1e5
1 changed files with 8 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name MusicBrainz: Batch-add "performance of" relationships
|
// @name MusicBrainz: Batch-add "performance of" relationships
|
||||||
// @description Batch link recordings to works from artist Recordings page.
|
// @description Batch link recordings to works from artist Recordings page.
|
||||||
// @version 2023.6.30.59
|
// @version 2023.6.30.1538
|
||||||
// @author Michael Wiencek
|
// @author Michael Wiencek
|
||||||
// @license X11
|
// @license X11
|
||||||
// @downloadURL https://github.com/murdos/musicbrainz-userscripts/raw/master/batch-add-recording-relationships.user.js
|
// @downloadURL https://github.com/murdos/musicbrainz-userscripts/raw/master/batch-add-recording-relationships.user.js
|
||||||
|
@ -34,12 +34,13 @@
|
||||||
// use or other dealings in this Software without prior written
|
// use or other dealings in this Software without prior written
|
||||||
// authorization.
|
// authorization.
|
||||||
// ==/License==
|
// ==/License==
|
||||||
|
|
||||||
const scr = document.createElement('script');
|
const scr = document.createElement('script');
|
||||||
// eslint-disable-next-line prettier/prettier -- cannot prettier-ignore options sepcifically (printWidth: 140); "eslint --fix" splits this big string in a strange way
|
scr.textContent = `(${batch_recording_rels})(${JSON.stringify(GM_info)});`;
|
||||||
scr.textContent = `(${batch_recording_rels})("\\n\\n\\n'''${GM_info.script.name.replace(/"/g, '\\"')}''' ${GM_info.script.version}\\n''Relate to %edit-mode%''");`;
|
|
||||||
document.body.appendChild(scr);
|
document.body.appendChild(scr);
|
||||||
|
|
||||||
function batch_recording_rels(edit_note_signature) {
|
function batch_recording_rels(gm_info) {
|
||||||
|
let edit_note_signature = `\n\n\n'''${gm_info.script.name}''' ${gm_info.script.version}\n''Relate to %edit-mode%''`;
|
||||||
function setting(name) {
|
function setting(name) {
|
||||||
name = `bpr_${name}`;
|
name = `bpr_${name}`;
|
||||||
|
|
||||||
|
@ -1109,15 +1110,14 @@ function batch_recording_rels(edit_note_signature) {
|
||||||
|
|
||||||
function create_new_work(title, callback, edit_mode) {
|
function create_new_work(title, callback, edit_mode) {
|
||||||
function post_edit() {
|
function post_edit() {
|
||||||
let data = `edit-work.name=${title}`;
|
let data = `edit-work.name=${encodeURIComponent(title)}`;
|
||||||
Object.entries($work_options).forEach(function ([kind, $obj]) {
|
Object.entries($work_options).forEach(function ([kind, $obj]) {
|
||||||
if ($obj.val()) {
|
if ($obj.val()) {
|
||||||
data += `&edit-work.${kind}_id=${$obj.val()}`;
|
data += `&edit-work.${kind}_id=${$obj.val()}`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
data += `&edit-work.edit_note=${document.getElementById('bpr-edit-note').value.trim()}${edit_note_signature.replace(
|
data += `&edit-work.edit_note=${encodeURIComponent(
|
||||||
/%edit-mode%/g,
|
document.getElementById('bpr-edit-note').value.trim() + edit_note_signature.replace(/%edit-mode%/g, edit_mode)
|
||||||
edit_mode
|
|
||||||
)}`;
|
)}`;
|
||||||
data += `&edit-work.make_votable=${make_votable ? '1' : '0'}`;
|
data += `&edit-work.make_votable=${make_votable ? '1' : '0'}`;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue