2015-05-19 22:26:50 +00:00
|
|
|
// ==UserScript==
|
2015-06-10 12:59:12 +00:00
|
|
|
// @name Import Bandcamp releases to MusicBrainz Album Link Helper
|
2015-05-28 08:26:38 +00:00
|
|
|
// @description Add a link to Bandcamp's album canonical URL on pages without /album/, for one to import the release into MusicBrainz
|
2015-07-07 07:26:23 +00:00
|
|
|
// @version 2015.07.07.0
|
2015-05-27 12:31:14 +00:00
|
|
|
// @namespace http://userscripts.org/users/22504
|
|
|
|
// @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/bandcamp_importer_helper.user.js
|
|
|
|
// @updateURL https://raw.github.com/murdos/musicbrainz-userscripts/master/bandcamp_importer_helper.user.js
|
2015-05-19 22:26:50 +00:00
|
|
|
// @include http*://*.bandcamp.com/
|
|
|
|
// @include http*://*.bandcamp.com/releases
|
|
|
|
// @exclude http*://*.bandcamp.com/*/*
|
2015-07-07 07:22:45 +00:00
|
|
|
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
|
2015-06-14 12:55:19 +00:00
|
|
|
// @require lib/logger.js
|
2015-07-10 12:28:43 +00:00
|
|
|
// @icon https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/assets/images/Musicbrainz_import_logo.png
|
2015-05-19 22:26:50 +00:00
|
|
|
// ==/UserScript==
|
|
|
|
|
2015-07-07 07:23:34 +00:00
|
|
|
// prevent JQuery conflicts, see http://wiki.greasespot.net/@grant
|
|
|
|
this.$ = this.jQuery = jQuery.noConflict(true);
|
2015-05-19 22:26:50 +00:00
|
|
|
|
2015-07-07 07:24:17 +00:00
|
|
|
if (!unsafeWindow) unsafeWindow = window;
|
2015-05-19 22:26:50 +00:00
|
|
|
|
2015-07-07 07:24:17 +00:00
|
|
|
$(document).ready(function () {
|
2015-05-19 22:26:50 +00:00
|
|
|
// Display a link to the correct album bandcamp url (ie. main page or releases page)
|
2015-07-07 07:25:59 +00:00
|
|
|
var bandcampAlbumData = unsafeWindow.TralbumData;
|
|
|
|
if (bandcampAlbumData && bandcampAlbumData.url) {
|
|
|
|
var innerHTML = '<div id="bci_helper" style="padding-top: 5px;">' + '<a href="' + bandcampAlbumData.url +
|
2015-05-27 12:31:14 +00:00
|
|
|
'" title="Load album page and display Import to MB button">Album page (MB import)</a></div>';
|
2015-07-07 07:25:59 +00:00
|
|
|
$('#name-section').append(innerHTML);
|
2015-05-19 22:26:50 +00:00
|
|
|
}
|
|
|
|
});
|