bandcamp_importer_helper.user.js & mbimportstyle.js: remove jquery

This commit is contained in:
Kai 2022-04-10 02:06:39 +00:00 committed by Aurélien Mino
parent adcb23576e
commit 6645a440f6
2 changed files with 18 additions and 15 deletions

View file

@ -1,31 +1,36 @@
// ==UserScript==
// @name Import Bandcamp releases to MusicBrainz Album Link Helper
// @description Add a link to Bandcamp's album canonical URL on pages without /album/, for one to import the release into MusicBrainz
// @version 2018.2.18.1
// @version 2022.4.10.1
// @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
// @include http*://*.bandcamp.com/
// @include http*://*.bandcamp.com/releases
// @exclude http*://*.bandcamp.com/*/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @require lib/logger.js
// @icon https://raw.githubusercontent.com/murdos/musicbrainz-userscripts/master/assets/images/Musicbrainz_import_logo.png
// @grant unsafeWindow
// ==/UserScript==
// prevent JQuery conflicts, see http://wiki.greasespot.net/@grant
this.$ = this.jQuery = jQuery.noConflict(true);
if (!unsafeWindow) unsafeWindow = window;
$(document).ready(function () {
// Display a link to the correct album bandcamp url (ie. main page or releases page)
let bandcampAlbumData = unsafeWindow.TralbumData;
const ready = function (fn) {
if (document.readyState !== 'loading') {
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
};
ready(function () {
// Display a link to the correct album bandcamp url (i.e. main page or releases page)
const bandcampAlbumData = unsafeWindow.TralbumData;
if (bandcampAlbumData && bandcampAlbumData.url) {
let innerHTML = `${'<div id="bci_helper" style="padding-top: 5px;">' + '<a href="'}${
bandcampAlbumData.url
}" title="Load album page and display Import to MB button">Album page (MB import)</a></div>`;
$('#name-section').append(innerHTML);
const innerHTML = `
<div id="bci_helper" style="padding-top: 5px;">
<a href="${bandcampAlbumData.url}" title="Load album page and display Import to MB button">Album page (MB import)</a>
</div>`;
document.querySelector('#name-section').insertAdjacentHTML('beforeend', innerHTML);
}
});

View file

@ -1,12 +1,10 @@
function _add_css(css) {
$(`<style type='text/css'>${css.replace(/\s+/g, ' ')}</style>`).appendTo('head');
document.head.insertAdjacentHTML('beforeend', `<style>${css.replace(/\s+/g, ' ')}</style>`);
}
function MBImportStyle() {
let css_import_button = `
.musicbrainz_import button {
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
display:inline-block;
cursor:pointer;