mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2025-03-04 22:37:16 +00:00
Update mb_relationship_shortcuts.user.js
- Converted the display of other databases to a dictionary as suggested
This commit is contained in:
parent
065fe600e5
commit
9bbd1ceb0b
1 changed files with 15 additions and 17 deletions
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Display shortcut for relationships on MusicBrainz
|
||||
// @description Display icon shortcut for relationships of release-group, release, recording and work: e.g. Amazon, Discogs, Wikipedia, ... links. This allows to access some relationships without opening the entity page.
|
||||
// @version 2017.11.12.0
|
||||
// @version 2017.11.12.1
|
||||
// @author Aurelien Mino <aurelien.mino@gmail.com>
|
||||
// @licence GPL (http://www.gnu.org/copyleft/gpl.html)
|
||||
// @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/mb_relationship_shortcuts.user.js
|
||||
|
@ -34,6 +34,13 @@ var relationsIconsURLs = {
|
|||
}
|
||||
};
|
||||
|
||||
var otherDatabasesIconURLs = {
|
||||
"d-nb.info" : "https://musicbrainz.org/static/images/favicons/dnb-16.png",
|
||||
"www.musik-sammler.de": "https://musicbrainz.org/static/images/favicons/musiksammler-32.png",
|
||||
"www.worldcat.org": "https://musicbrainz.org/static/images/favicons/worldcat-32.png",
|
||||
"rateyourmusic.com": "https://musicbrainz.org/static/images/favicons/rateyourmusic-32.png"
|
||||
};
|
||||
|
||||
var incOptions = {
|
||||
'release-group': [ 'release-group-rels', 'url-rels' ],
|
||||
'release': [ 'release-rels', 'url-rels', 'discids' ],
|
||||
|
@ -121,22 +128,13 @@ $(document).ready(function(){
|
|||
$("#" + mbid + " td.relationships").append(
|
||||
"<a href='" + target.replace(/'/g,"'") + "'>" + "<img style='max-height: 16px;' src='" + relationsIconsURLs.url[reltype] + "' /> " + "</a>"
|
||||
);
|
||||
} else if (target.indexOf("d-nb.info") != -1 ) {
|
||||
$("#" + mbid + " td.relationships").append(
|
||||
"<a href='" + target.replace(/'/g,"'") + "'>" + "<img style='max-height: 16px;' src='https://musicbrainz.org/static/images/favicons/dnb-16.png' /> " + "</a>"
|
||||
);
|
||||
} else if (target.indexOf("www.musik-sammler.de") != -1 ) {
|
||||
$("#" + mbid + " td.relationships").append(
|
||||
"<a href='" + target.replace(/'/g,"'") + "'>" + "<img style='max-height: 16px;' src='https://musicbrainz.org/static/images/favicons/musiksammler-32.png' /> " + "</a>"
|
||||
);
|
||||
} else if (target.indexOf("www.worldcat.org") != -1 ) {
|
||||
$("#" + mbid + " td.relationships").append(
|
||||
"<a href='" + target.replace(/'/g,"'") + "'>" + "<img style='max-height: 16px;' src='https://musicbrainz.org/static/images/favicons/worldcat-32.png' /> " + "</a>"
|
||||
);
|
||||
} else if (target.indexOf("rateyourmusic.com") != -1 ) {
|
||||
$("#" + mbid + " td.relationships").append(
|
||||
"<a href='" + target.replace(/'/g,"'") + "'>" + "<img style='max-height: 16px;' src='https://musicbrainz.org/static/images/favicons/rateyourmusic-32.png' /> " + "</a>"
|
||||
);
|
||||
}
|
||||
else for (var rel in otherDatabasesIconURLs) {
|
||||
if (target.indexOf(rel) != -1 ) {
|
||||
$("#" + mbid + " td.relationships").append(
|
||||
"<a href='" + target.replace(/'/g,"'") + "'>" + "<img style='max-height: 16px;' src='" + otherDatabasesIconURLs[rel] + "' /> " + "</a>"
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue