mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2024-12-14 04:12:28 +00:00
Normalize discogs artist urls
This commit is contained in:
parent
beef49f3e1
commit
3b3ea553f6
1 changed files with 3 additions and 3 deletions
|
@ -131,10 +131,10 @@ function magnifyLinks(rootNode) {
|
||||||
|
|
||||||
// Normalize Discogs URL by removing title from URL
|
// Normalize Discogs URL by removing title from URL
|
||||||
function magnifyLink(url) {
|
function magnifyLink(url) {
|
||||||
var re = /^http:\/\/www\.discogs\.com\/(.*)\/(master|release)\/(\d+)$/i;
|
var re = /^http:\/\/www\.discogs\.com\/(?:.+\/)?(master|release|artist)\/(\d+)(?:-[^\/#?]+)?$/i;
|
||||||
if (m = re.exec(url)) {
|
if (m = re.exec(url)) {
|
||||||
var type = m[2];
|
var type = m[1];
|
||||||
var id = m[3];
|
var id = m[2];
|
||||||
return "http://www.discogs.com/" + type + "/" + id;
|
return "http://www.discogs.com/" + type + "/" + id;
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
|
|
Loading…
Reference in a new issue