mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2024-11-10 05:04:13 +00:00
deezer: wait for toolbar to appear
This commit is contained in:
parent
6be127759f
commit
2cb8763139
1 changed files with 14 additions and 3 deletions
|
@ -128,6 +128,16 @@ function parseDeezerRelease(releaseUrl, data) {
|
|||
return release;
|
||||
}
|
||||
|
||||
function waitForEl(selector, callback) {
|
||||
if (jQuery(selector).length) {
|
||||
callback();
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
waitForEl(selector, callback);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
function insertLink(release, release_url) {
|
||||
let editNote = MBImport.makeEditNote(release_url, 'Deezer');
|
||||
let parameters = MBImport.buildFormParameters(release, editNote);
|
||||
|
@ -139,7 +149,8 @@ function insertLink(release, release_url) {
|
|||
${MBImport.buildSearchButton(release)}
|
||||
</div>`
|
||||
).hide();
|
||||
|
||||
$('[data-testid="toolbar"]').append(mbUI);
|
||||
mbUI.show();
|
||||
waitForEl('[data-testid="toolbar"]', function () {
|
||||
$('[data-testid="toolbar"]').append(mbUI);
|
||||
mbUI.show();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue