mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2024-12-12 11:22:28 +00:00
Merge pull request #546 from atj/fix-discogs
Discogs: fix missing links on various pages
This commit is contained in:
commit
3090938af7
1 changed files with 34 additions and 19 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// @name Import Discogs releases to MusicBrainz
|
// @name Import Discogs releases to MusicBrainz
|
||||||
// @description Add a button to import Discogs releases to MusicBrainz and add links to matching MusicBrainz entities for various Discogs entities (artist,release,master,label)
|
// @description Add a button to import Discogs releases to MusicBrainz and add links to matching MusicBrainz entities for various Discogs entities (artist,release,master,label)
|
||||||
// @version 2021.8.10.1
|
// @version 2023.11.4.2
|
||||||
// @namespace http://userscripts.org/users/22504
|
// @namespace http://userscripts.org/users/22504
|
||||||
// @downloadURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/discogs_importer.user.js
|
// @downloadURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/discogs_importer.user.js
|
||||||
// @updateURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/discogs_importer.user.js
|
// @updateURL https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/discogs_importer.user.js
|
||||||
|
@ -243,24 +243,39 @@ function insertMBLinks(current_page_key) {
|
||||||
mbLinks.searchAndDisplayMbLink(current_page_info.clean_url, mb_type, mbLinkInsert, cachekey);
|
mbLinks.searchAndDisplayMbLink(current_page_info.clean_url, mb_type, mbLinkInsert, cachekey);
|
||||||
|
|
||||||
const $root = $('body');
|
const $root = $('body');
|
||||||
// artist/label/master pages, release pages (before the 2021-08-09 update)
|
|
||||||
add_mblinks($root, 'div.profile', ['artist', 'label']);
|
if (current_page_info.type === 'artist') {
|
||||||
add_mblinks($root, 'tr[data-object-type="release"] td.artist,td.title', 'artist');
|
// profile text and relationships
|
||||||
add_mblinks($root, 'tr[data-object-type="release"] td.title', 'release');
|
add_mblinks($root, 'div[class^=info_]', ['artist', 'label']);
|
||||||
add_mblinks($root, 'tr[data-object-type="release"]', 'label');
|
setInterval(() => {
|
||||||
add_mblinks($root, 'tr[data-object-type~="master"]', ['master', 'artist', 'label']);
|
// dynamically paged and filterable (master) release listing
|
||||||
// release pages (since the 2021-08-09 update)
|
add_mblinks($root, 'div[class^=textWithCovers_]', ['artist', 'label', 'master', 'release']);
|
||||||
add_mblinks($root, '#release-header', ['artist', 'label']);
|
// dynamically expanded master release
|
||||||
setInterval(() => add_mblinks($root, '#release-other-versions', ['artist', 'release', 'label']), 500); // Discogs loads this dynamically, wait a moment
|
add_mblinks($root, 'tr[class^=versions_]', ['label', 'release']);
|
||||||
add_mblinks($root, '#release-tracklist', 'artist');
|
}, 1500);
|
||||||
add_mblinks($root, '#release-companies', [['label', 'place'], 'label']);
|
} else if (current_page_info.type === 'label') {
|
||||||
add_mblinks($root, '#release-credits', ['label', 'artist']);
|
// profile text and relationships
|
||||||
add_mblinks($root, '#release-actions', 'master', true);
|
add_mblinks($root, 'div.profile', ['artist', 'label']);
|
||||||
// release pages (before the 2021-08-09 update, TODO: remove after the new layout becomes permanent)
|
// static, paged (master) release listing
|
||||||
add_mblinks($root, 'div#tracklist', 'artist');
|
add_mblinks($root, '#label_wrap', ['artist', 'master', 'release']);
|
||||||
add_mblinks($root, 'div#companies', [['label', 'place'], 'label']);
|
// dynamically expanded master release
|
||||||
add_mblinks($root, 'div#credits', ['label', 'artist']);
|
setInterval(() => add_mblinks($root, 'tr.sub.release', ['artist', 'release']), 1000);
|
||||||
add_mblinks($root, 'div#page_aside div.section_content:first', 'master', true);
|
} else if (current_page_info.type === 'master') {
|
||||||
|
// credits section (master release summary)
|
||||||
|
add_mblinks($root, '#Credits', ['artist']);
|
||||||
|
// dynamically paged and filterable release listing
|
||||||
|
setInterval(() => add_mblinks($root, '#versions tr[class^=row_]', ['label', 'release']), 1000);
|
||||||
|
} else if (current_page_info.type === 'release') {
|
||||||
|
// master release in the actions sidebar
|
||||||
|
add_mblinks($root, '#release-actions', ['master']);
|
||||||
|
// release labels and series
|
||||||
|
add_mblinks($root, 'div[class^=info_]', [['label', 'series'], 'label']);
|
||||||
|
add_mblinks($root, '#release-companies', [['label', 'place'], 'label']);
|
||||||
|
add_mblinks($root, '#release-credits', ['artist', 'label']);
|
||||||
|
add_mblinks($root, '#release-tracklist', ['artist']);
|
||||||
|
// dynamically paged and filterable listing of other release versions
|
||||||
|
setTimeout(() => add_mblinks($root, '#release-other-versions', ['artist', 'label', 'release']), 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in a new issue