From dc0bcd9d381a13f8d3f0f60b60dd9a4cff011d10 Mon Sep 17 00:00:00 2001 From: arne Date: Fri, 27 Mar 2026 08:21:36 +0100 Subject: [PATCH 1/5] chore: replace `$.inArray` with `[].includes` --- lib/mblinks.js | 2 +- qobuz_importer.user.js | 24 +++++++++++----------- src/userscripts/beatport_importer/index.ts | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/mblinks.js b/lib/mblinks.js index 50e8d7a..7d845df 100644 --- a/lib/mblinks.js +++ b/lib/mblinks.js @@ -322,7 +322,7 @@ const MBLinks = function (user_cache_key, version, expiration) { $.each(data['relations'], function (idx, relation) { if (ctx._type in relation) { let mb_url = `${mbl.mb_server}/${ctx.mb_type}/${relation[ctx._type]['id']}`; - if ($.inArray(mb_url, mbl.cache[ctx.key].urls) == -1) { + if (!mbl.cache[ctx.key].urls.includes(mb_url)) { // prevent dupes mbl.cache[ctx.key].urls.push(mb_url); $.each(ctx.handlers, function (i, handler) { diff --git a/qobuz_importer.user.js b/qobuz_importer.user.js index 755198b..d7398a5 100644 --- a/qobuz_importer.user.js +++ b/qobuz_importer.user.js @@ -33,9 +33,9 @@ let is_classical = false, // release detected as classical function isVariousArtists(artist) { // Check hard-coded various artist ids - if ($.inArray(artist.id, various_artists_ids) != -1 || $.inArray(artist.id, various_composers_ids) != -1) { + if (various_artists_ids.includes(artist.id) || various_composers_ids.includes(artist.id)) { return true; - } else if ($.inArray(artist.slug, ['various-artist', 'various-composers']) != -1) { + } else if (['various-artist', 'various-composers'].includes(artist.slug)) { // Let's assume various based on the slug return true; } @@ -64,7 +64,7 @@ function parseRelease(data) { release.url = `https://www.qobuz.com${data.relative_url}`; // no lang release.title = data.title; - if ($.inArray('Classique', data.genres_list) != -1) { + if (data.genres_list.includes('Classique')) { is_classical = true; release.classical = {}; release.classical.discs = []; @@ -150,7 +150,7 @@ function parseRelease(data) { classical_artists.push(trackobj.composer.name); } else { $.each(performers, function (index, performer) { - if ($.inArray('Composer', performer[1]) != -1) { + if (performer[1].includes('Composer')) { classical_artists.push(performer[0]); } }); @@ -163,16 +163,16 @@ function parseRelease(data) { let artists = []; let featured_artists = []; $.each(performers, function (index, performer) { - if ($.inArray('Featured Artist', performer[1]) != -1) { + if (performer[1].includes('Featured Artist')) { featured_artists.push(performer[0]); } else if ( - // (is_classical && $.inArray('Composer', performer[1]) != -1) || - $.inArray('MainArtist', performer[1]) != -1 || - $.inArray('Main Performer', performer[1]) != -1 || - $.inArray('Primary', performer[1]) != -1 || - $.inArray('interprète', performer[1]) != -1 || - $.inArray('Performer', performer[1]) != -1 || - $.inArray('Main Artist', performer[1]) != -1 + // (is_classical && performer[1].includes('Composer')) || + performer[1].includes('MainArtist') || + performer[1].includes('Main Performer') || + performer[1].includes('Primary') || + performer[1].includes('interprète') || + performer[1].includes('Performer') || + performer[1].includes('Main Artist') ) { artists.push(performer[0]); } diff --git a/src/userscripts/beatport_importer/index.ts b/src/userscripts/beatport_importer/index.ts index ac9ccea..c91b241 100644 --- a/src/userscripts/beatport_importer/index.ts +++ b/src/userscripts/beatport_importer/index.ts @@ -150,7 +150,7 @@ function retrieveReleaseInfo(release_url: string, release_data: BeatportReleaseD const unique_artists: string[] = []; $.each(release_artists, (index: number, el: string) => { - if ($.inArray(el, unique_artists) === -1) { + if (!unique_artists.includes(el)) { unique_artists.push(el); } }); From a4d8e03283767443ef6f6593528777db7becaed1 Mon Sep 17 00:00:00 2001 From: arne Date: Fri, 27 Mar 2026 08:22:57 +0100 Subject: [PATCH 2/5] chore: replace `$.each` with `[].forEach` --- bandcamp_importer.user.js | 2 +- batch-add-recording-relationships.user.js | 4 ++-- cd1d_importer.user.js | 4 ++-- deezer_importer.user.js | 4 ++-- discogs_importer.user.js | 18 +++++++++--------- lib/mblinks.js | 14 ++++++-------- mb_discids_detector.user.js | 6 +++--- mb_relationship_shortcuts.user.js | 4 ++-- mb_ui_enhancements.user.js | 6 +++--- qobuz_importer.user.js | 10 +++++----- set-recording-comments.user.js | 2 +- src/userscripts/beatport_importer/index.ts | 6 +++--- 12 files changed, 39 insertions(+), 41 deletions(-) diff --git a/bandcamp_importer.user.js b/bandcamp_importer.user.js index e7a62d6..14662ed 100644 --- a/bandcamp_importer.user.js +++ b/bandcamp_importer.user.js @@ -120,7 +120,7 @@ const BandcampImport = { } let tracks_streamable = 0; - $.each(bandcampAlbumData.trackinfo, function (index, bctrack) { + bandcampAlbumData.trackinfo.forEach(bctrack => { let title = bctrack.title; let artist = []; if (various_artists) { diff --git a/batch-add-recording-relationships.user.js b/batch-add-recording-relationships.user.js index 8d90d6c..eb88717 100644 --- a/batch-add-recording-relationships.user.js +++ b/batch-add-recording-relationships.user.js @@ -1096,7 +1096,7 @@ function batch_recording_rels(gm_info) { let $button = $(this).attr('disabled', true).css('color', '#EAEAEA'); - $.each($rows, function (i, row) { + $rows.forEach(row => { let $row = $(row); let $title_cell = rowTitleCell($row); let title = $title_cell.find(TITLE_SELECTOR).text(); @@ -1163,7 +1163,7 @@ function batch_recording_rels(gm_info) { $button.attr('disabled', false).css('color', '#565656'); } - $.each($rows, function (i, row) { + $rows.forEach(row => { let $row = $(row); let mbid = $row.data('suggested_work_mbid'); let title = $row.data('suggested_work_title'); diff --git a/cd1d_importer.user.js b/cd1d_importer.user.js index 3686f6f..3c89986 100644 --- a/cd1d_importer.user.js +++ b/cd1d_importer.user.js @@ -225,13 +225,13 @@ const CD1DImporter = { .get(); // Tracks - $.each(this.getTracks(format.id), function () { + this.getTracks(format.id).forEach(tracks => { let thisdisc = { tracks: [], format: release.format, }; release.discs.push(thisdisc); - $.each(this, function (ntrack, track) { + tracks.forEach(track => { thisdisc.tracks.push({ title: track.title, duration: track.duration, diff --git a/deezer_importer.user.js b/deezer_importer.user.js index 6e52286..cc03837 100644 --- a/deezer_importer.user.js +++ b/deezer_importer.user.js @@ -76,7 +76,7 @@ function parseDeezerRelease(releaseUrl, data) { discs: [], }; - $.each(data.contributors, function (index, artist) { + data.contributors.forEach(artist => { if (artist.role != 'Main') return true; let ac = { @@ -97,7 +97,7 @@ function parseDeezerRelease(releaseUrl, data) { tracks: [], }; - $.each(data.tracks.data, function (index, track) { + data.tracks.data.forEach(track => { let t = { number: index + 1, title: track.title_short, diff --git a/discogs_importer.user.js b/discogs_importer.user.js index b1bb7b2..2d412d1 100644 --- a/discogs_importer.user.js +++ b/discogs_importer.user.js @@ -207,7 +207,7 @@ function insertMBLinks(current_page_key) { // just one string types = [types]; } - $.each(types, function (idx, val) { + types.forEach((val, idx) => { if (!$.isArray(val)) { types[idx] = [val, undefined]; } @@ -220,7 +220,7 @@ function insertMBLinks(current_page_key) { magnifyLinks(node); debug_color(this, ++add_mblinks_counter, selector); const that = this; - $.each(types, function (idx, val) { + types.forEach(val => { const discogs_type = val[0]; const mb_type = val[1]; searchAndDisplayMbLinkInSection($(that), discogs_type, mb_type, nosearch); @@ -528,7 +528,7 @@ function parseDiscogsRelease(discogsRelease) { // Release artist credit release.artist_credit = []; - $.each(discogsRelease.artists, function (index, artist) { + discogsRelease.artists.forEach(artist => { let ac = { artist_name: artistNoNum(artist.name), credited_name: artist.anv != '' ? artist.anv : artistNoNum(artist.name), @@ -564,7 +564,7 @@ function parseDiscogsRelease(discogsRelease) { // Release labels release.labels = []; if (discogsRelease.labels) { - $.each(discogsRelease.labels, function (index, label) { + discogsRelease.labels.forEach(label => { const labelInfo = { name: label.name, catno: label.catno === 'none' ? '[none]' : label.catno, @@ -591,7 +591,7 @@ function parseDiscogsRelease(discogsRelease) { } if (discogsRelease.formats[i].descriptions) { - $.each(discogsRelease.formats[i].descriptions, function (index, desc) { + discogsRelease.formats[i].descriptions.forEach(desc => { if (!(discogs_format in ['Box Set'])) { // Release format: special handling of Vinyl and Shellac 7", 10" and 12" if (desc.match(/7"|10"|12"/) && discogs_format.concat(desc) in MediaTypes) @@ -656,7 +656,7 @@ function parseDiscogsRelease(discogsRelease) { // Barcode if (discogsRelease.identifiers) { - $.each(discogsRelease.identifiers, function (index, identifier) { + discogsRelease.identifiers.forEach(identifier => { if (identifier.type === 'Barcode' && identifier.value !== null) { release.barcode = identifier.value.replace(/ /g, ''); return false; @@ -668,7 +668,7 @@ function parseDiscogsRelease(discogsRelease) { let heading = ''; let releaseNumber = 1; let lastPosition = 0; - $.each(discogsRelease.tracklist, function (index, discogsTrack) { + discogsRelease.tracklist.forEach(discogsTrack => { if (discogsTrack.type_ === 'heading') { heading = discogsTrack.title; return; @@ -685,7 +685,7 @@ function parseDiscogsRelease(discogsRelease) { // Track artist credit track.artist_credit = []; if (discogsTrack.artists) { - $.each(discogsTrack.artists, function (index, artist) { + discogsTrack.artists.forEach(artist => { const ac = { artist_name: artistNoNum(artist.name), credited_name: artist.anv !== '' ? artist.anv : artistNoNum(artist.name), @@ -706,7 +706,7 @@ function parseDiscogsRelease(discogsRelease) { // Append titles of sub-tracks to main track title const subtrack_titles = []; let subtrack_total_duration = 0; - $.each(discogsTrack.sub_tracks, function (subtrack_index, subtrack) { + discogsTrack.sub_tracks.forEach(subtrack => { if (subtrack.type_ !== 'track') { return; } diff --git a/lib/mblinks.js b/lib/mblinks.js index 7d845df..224aafb 100644 --- a/lib/mblinks.js +++ b/lib/mblinks.js @@ -213,7 +213,7 @@ const MBLinks = function (user_cache_key, version, expiration) { this.clearCacheExpired = function () { let new_cache = {}; let that = this; - $.each(this.cache, function (key) { + this.cache.forEach(key => { if (that.is_cached(key)) { new_cache[key] = that.cache[key]; } @@ -280,7 +280,7 @@ const MBLinks = function (user_cache_key, version, expiration) { if (!key) key = url; if (this.is_cached(key)) { - $.each(mblinks.cache[key].urls, function (idx, cacheEntry) { + mblinks.cache[key].urls.forEach(cacheEntry => { const mb_url = typeof cacheEntry === 'string' ? cacheEntry : cacheEntry.url; insert_func(mblinks.createMusicBrainzLink(mb_url, _type)); }); @@ -319,13 +319,13 @@ const MBLinks = function (user_cache_key, version, expiration) { timestamp: new Date().getTime(), urls: [], }; - $.each(data['relations'], function (idx, relation) { + data['relations'].forEach(relation => { if (ctx._type in relation) { let mb_url = `${mbl.mb_server}/${ctx.mb_type}/${relation[ctx._type]['id']}`; if (!mbl.cache[ctx.key].urls.includes(mb_url)) { // prevent dupes mbl.cache[ctx.key].urls.push(mb_url); - $.each(ctx.handlers, function (i, handler) { + ctx.handlers.forEach(handler => { handler(mbl.createMusicBrainzLink(mb_url, ctx._type)); }); } @@ -335,9 +335,7 @@ const MBLinks = function (user_cache_key, version, expiration) { } }, function () { - $.each(ctx.completionHandlers, function (i, fn) { - fn(); - }); + ctx.completionHandlers.forEach(fn => fn()); }, ); }, @@ -370,7 +368,7 @@ const MBLinks = function (user_cache_key, version, expiration) { if (this.is_cached(key)) { // Handle cached results immediately const data_type = data.mb_type.replace('-', '_'); - $.each(mblinks.cache[key].urls, function (idx, cacheEntry) { + mblinks.cache[key].urls.forEach(cacheEntry => { const mb_url = typeof cacheEntry === 'string' ? cacheEntry : cacheEntry.url; const ended = typeof cacheEntry === 'string' ? false : cacheEntry.ended; const options = data_type === 'release' ? { ended } : {}; diff --git a/mb_discids_detector.user.js b/mb_discids_detector.user.js index 5e511ed..ef443bd 100644 --- a/mb_discids_detector.user.js +++ b/mb_discids_detector.user.js @@ -201,7 +201,7 @@ function computeAttachURL(mb_toc_numbers, artistName, releaseName) { function analyze_log_files(log_files) { let discs = []; - $.each(log_files, function (i, log_file) { + log_files.forEach(log_file => { const discsInLog = MBDiscid.log_input_to_entries($(log_file).text()); for (const disc of discsInLog) { discs.push(disc); @@ -278,7 +278,7 @@ const MBDiscid = (function () { this.log_input_to_entries = function (text) { let discs = []; var entries = []; - $.each(text.split('\n'), function (index, value) { + text.split('\n').forEach(value => { let m = toc_entry_matcher.exec(value); if (m) { // New disc @@ -360,7 +360,7 @@ const MBDiscid = (function () { (parseInt(entries[entries.length - 1][5], 10) - parseInt(entries[0][4], 10) + 1) / this.SECTORS_PER_SECOND, ); let checksum = 0; - $.each(entries, function (index, entry) { + entries.forEach(entry => { checksum += sum_of_digits(Math.floor((parseInt(entry[4], 10) + PREGAP) / SECTORS_PER_SECOND)); }); diff --git a/mb_relationship_shortcuts.user.js b/mb_relationship_shortcuts.user.js index 6353047..6657030 100644 --- a/mb_relationship_shortcuts.user.js +++ b/mb_relationship_shortcuts.user.js @@ -278,12 +278,12 @@ $(document).ready(function () { } }); - $.each(relations, function (reltype, urls) { + Object.entries(relations).forEach(([reltype, urls]) => { let html = ''; if (urls.length < -1) { html += `(${urls.length}) `; } else { - $.each(urls, function (index, url) { + urls.forEach(url => { html += ` `; }); } diff --git a/mb_ui_enhancements.user.js b/mb_ui_enhancements.user.js index 2f1b4a6..787a7bc 100644 --- a/mb_ui_enhancements.user.js +++ b/mb_ui_enhancements.user.js @@ -78,7 +78,7 @@ $(document).ready(function () { $.getJSON( `https://ws.audioscrobbler.com/2.0/?method=artist.gettoptracks&mbid=${mbid}&api_key=${LASTFM_APIKEY}&format=json`, function (data) { - $.each(data.toptracks.track, function (index, track) { + data.toptracks.track.forEach(track => { if (index >= 5) return true; let url = track.mbid ? `/recording/${track.mbid}` : track.url; $('ul.toptracks').append(`
  • ${track.name}
  • `); @@ -326,8 +326,8 @@ $(document).ready(function () { $.getJSON(wsurl, function (data) { // Store tracks data from webservice in a hash table let tracks = {}; - $.each(data.media, function (index, medium) { - $.each(medium.tracks, function (i, track) { + data.media.forEach(medium => { + medium.tracks.forEach(track => { tracks[track.id] = track; }); }); diff --git a/qobuz_importer.user.js b/qobuz_importer.user.js index d7398a5..24d2723 100644 --- a/qobuz_importer.user.js +++ b/qobuz_importer.user.js @@ -110,7 +110,7 @@ function parseRelease(data) { release.day = releaseDate.getUTCDate(); release.labels = []; - $.each(data.label.name.split(' - '), function (index, label) { + data.label.name.split(' - ').forEach(label => { release.labels.push({ name: label, catno: '[none]', // no catno on qobuz ? @@ -123,7 +123,7 @@ function parseRelease(data) { let tracks = [], classical_tracks = [], old_media_num = 1; - $.each(data.tracks.items, function (index, trackobj) { + data.tracks.items.forEach(trackobj => { release.isrcs.push(trackobj.isrc); if (trackobj.media_number != old_media_num) { release.discs.push({ @@ -149,7 +149,7 @@ function parseRelease(data) { if (typeof trackobj.composer !== 'undefined') { classical_artists.push(trackobj.composer.name); } else { - $.each(performers, function (index, performer) { + performers.forEach(performer => { if (performer[1].includes('Composer')) { classical_artists.push(performer[0]); } @@ -162,7 +162,7 @@ function parseRelease(data) { let artists = []; let featured_artists = []; - $.each(performers, function (index, performer) { + performers.forEach(performer => { if (performer[1].includes('Featured Artist')) { featured_artists.push(performer[0]); } else if ( @@ -482,7 +482,7 @@ function processDiscographyPage({ mblinks, locale }) { } // Build urls_data array for batch processing - artist_urls_map.forEach((artist_link_elements, artist_url) => { + Object.entries(artist_urls_map).forEach(([artist_link_elements, artist_url]) => { artist_urls_data.push({ url: artist_url, mb_type: 'artist', diff --git a/set-recording-comments.user.js b/set-recording-comments.user.js index b2c2eeb..3824b2c 100644 --- a/set-recording-comments.user.js +++ b/set-recording-comments.user.js @@ -172,7 +172,7 @@ function setRecordingComments() { let editData = [], deferred = $.Deferred(); - $.each($tracks, function (i, track) { + $tracks.forEach((track, i) => { if ($(track).filter(':visible').length > 0) { let $input = $inputs.eq(i), comment = $input.val(); diff --git a/src/userscripts/beatport_importer/index.ts b/src/userscripts/beatport_importer/index.ts index c91b241..aace4a1 100644 --- a/src/userscripts/beatport_importer/index.ts +++ b/src/userscripts/beatport_importer/index.ts @@ -122,7 +122,7 @@ function retrieveReleaseInfo(release_url: string, release_data: BeatportReleaseD const seen_tracks: { [key: number]: boolean } = {}; // to shoot duplicates ... const release_artists: string[] = []; - $.each(tracks_data, (index: number, track) => { + tracks_data.forEach(track => { if (track.release.id != release_data.id) { return; } @@ -132,7 +132,7 @@ function retrieveReleaseInfo(release_url: string, release_data: BeatportReleaseD seen_tracks[track.id] = true; const artists: string[] = []; - $.each(track.artists, (index2: number, artist: { name: string }) => { + track.artists.forEach((artist: { name: string }) => { artists.push(artist.name); release_artists.push(artist.name); }); @@ -149,7 +149,7 @@ function retrieveReleaseInfo(release_url: string, release_data: BeatportReleaseD }); const unique_artists: string[] = []; - $.each(release_artists, (index: number, el: string) => { + release_artists.forEach((el: string) => { if (!unique_artists.includes(el)) { unique_artists.push(el); } From 55e3913b0c0db47042275a784a1704f4bfd8fd79 Mon Sep 17 00:00:00 2001 From: arne Date: Fri, 27 Mar 2026 08:24:41 +0100 Subject: [PATCH 3/5] chore: replace `$.trim` with `''.trim` --- batch-add-recording-relationships.user.js | 4 ++-- discogs_importer.user.js | 2 +- mb_ui_enhancements.user.js | 2 +- metalarchives_importer.user.js | 9 ++++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/batch-add-recording-relationships.user.js b/batch-add-recording-relationships.user.js index eb88717..06d0c6c 100644 --- a/batch-add-recording-relationships.user.js +++ b/batch-add-recording-relationships.user.js @@ -524,8 +524,8 @@ function batch_recording_rels(gm_info) { TOTAL_PAGES = Math.ceil((re_match ? parseInt(re_match[1], 10) : 1) / 2); } - let NAME_FILTER = $.trim($('#id-filter\\.name').val()); - let ARTIST_FILTER = $.trim($('#id-filter\\.artist_credit_id').find('option:selected').text()); + let NAME_FILTER = $('#id-filter\\.name').val().trim(); + let ARTIST_FILTER = $('#id-filter\\.artist_credit_id').find('option:selected').text().trim(); if (NAME_FILTER || ARTIST_FILTER) { get_filtered_page(0); diff --git a/discogs_importer.user.js b/discogs_importer.user.js index 2d412d1..29f5d3e 100644 --- a/discogs_importer.user.js +++ b/discogs_importer.user.js @@ -309,7 +309,7 @@ function magnifyLinks(rootNode) { let elem = elems[i]; // Ignore empty links - if (!elem.href || $.trim(elem.textContent) === '' || elem.textContent.substring(4, 0) === 'http') continue; + if (!elem.href || elem.textContent.trim() === '' || elem.textContent.substring(4, 0) === 'http') continue; if (!elem.hasAttribute('mlink')) { elem.setAttribute('mlink', getDiscogsLinkKey(elem.href)); } diff --git a/mb_ui_enhancements.user.js b/mb_ui_enhancements.user.js index 787a7bc..3fbd075 100644 --- a/mb_ui_enhancements.user.js +++ b/mb_ui_enhancements.user.js @@ -91,7 +91,7 @@ $(document).ready(function () { re = new RegExp('musicbrainz.org/release/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})', 'i'); if (window.location.href.match(re)) { if ($('table.medium thead').length == 1) { - let text = $.trim($('table.medium thead').text()); + let text = $('table.medium thead').text().trim(); if (text.match(/ 1$/)) { $('table.medium thead a').text(text.replace(/ 1$/, '')); } diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js index 081e309..bba50d4 100644 --- a/metalarchives_importer.user.js +++ b/metalarchives_importer.user.js @@ -45,13 +45,13 @@ function setreleasedate(release, datestring) { function getGenericalData() { const keydata = $('dl.float_left dt, dl.float_right dt') .map(function () { - let s = $.trim($(this).text()); + let s = $(this).text().trim(); return s.substring(0, s.length - 1); }) .get(); const valuedata = $('dl.float_left dd,dl.float_right dd') .map(function () { - return $.trim($(this).text()); + return $(this).text().trim(); }) .get(); const rdata = []; @@ -62,7 +62,10 @@ function getGenericalData() { } function getArtistsList() { - return $.map($('h2.band_name').text().split('/'), $.trim); + return $('h2.band_name') + .text() + .split('/') + .map(name => name.trim()); } function retrieveReleaseInfo(release_url) { From c3140a1e8f56dac02baf2e903af6096daefb4b17 Mon Sep 17 00:00:00 2001 From: arne Date: Fri, 27 Mar 2026 08:24:47 +0100 Subject: [PATCH 4/5] chore: replace `$(document).ready(...)` with `document.addEventListener('DOMContentLoaded', ...)` --- bandcamp_importer.user.js | 2 +- cd1d_importer.user.js | 2 +- deezer_importer.user.js | 2 +- discogs_importer.user.js | 2 +- encyclopedisque_importer.user.js | 2 +- fma_importer.user.js | 2 +- hdtracks_importer.user.js | 2 +- juno_download_importer.user.js | 2 +- lib/mblinks.js | 2 +- loot_importer.user.js | 2 +- mb_discids_detector.user.js | 2 +- mb_relationship_shortcuts.user.js | 2 +- mb_ui_enhancements.user.js | 2 +- metalarchives_importer.user.js | 2 +- qobuz_importer.user.js | 2 +- src/userscripts/beatport_importer/index.ts | 2 +- takealot_importer.user.js | 2 +- vgmdb_importer.user.js | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bandcamp_importer.user.js b/bandcamp_importer.user.js index 14662ed..3d45cfb 100644 --- a/bandcamp_importer.user.js +++ b/bandcamp_importer.user.js @@ -355,7 +355,7 @@ const collectDiscographyReleaseLinks = ({ linksMatcher, hostname, insertionLocat return urls_data; }; -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { /* keep the following line as first, it is required to skip * pages which aren't actually a bandcamp page, since we support * bandcamp pages under third-party domains. diff --git a/cd1d_importer.user.js b/cd1d_importer.user.js index 3c89986..46886f3 100644 --- a/cd1d_importer.user.js +++ b/cd1d_importer.user.js @@ -260,7 +260,7 @@ const CD1DImporter = { }, }; -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { MBImportStyle(); /* CD1D uses same page with hidden tabs for all formats */ let formats = CD1DImporter.getFormats(); diff --git a/deezer_importer.user.js b/deezer_importer.user.js index cc03837..0d56352 100644 --- a/deezer_importer.user.js +++ b/deezer_importer.user.js @@ -18,7 +18,7 @@ // prevent JQuery conflicts, see http://wiki.greasespot.net/@grant this.$ = this.jQuery = jQuery.noConflict(true); -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { let gmXHR; if (typeof GM_xmlhttpRequest != 'undefined') { diff --git a/discogs_importer.user.js b/discogs_importer.user.js index 29f5d3e..f469502 100644 --- a/discogs_importer.user.js +++ b/discogs_importer.user.js @@ -35,7 +35,7 @@ if (DEBUG) { const mbLinks = new MBLinks('DISCOGS_MBLINKS_CACHE', '1'); -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { MBImportStyle(); MBSearchItStyle(); diff --git a/encyclopedisque_importer.user.js b/encyclopedisque_importer.user.js index 2f8a8d9..1f202df 100644 --- a/encyclopedisque_importer.user.js +++ b/encyclopedisque_importer.user.js @@ -17,7 +17,7 @@ const mbLinks = new MBLinks('ENCYLOPEDISQUE_MBLINKS_CACHE'); -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { MBImportStyle(); if (window.location.href.match(/encyclopedisque\.fr\/disque\/(\d+)/)) { diff --git a/fma_importer.user.js b/fma_importer.user.js index 09c7b0a..74cceff 100644 --- a/fma_importer.user.js +++ b/fma_importer.user.js @@ -48,7 +48,7 @@ const release_attributes = {}; // albumid, total_pages, artist_name, label const album_api_array = []; // album information [0] const tracks_api_array = []; // track information [0,1,2,..] one element for each pagination in FMA tracks API -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { // if we have something on local storage place that if (localStorage.getItem('FMA_API_KEY')) { FMA_API = localStorage.getItem('FMA_API_KEY'); // -> YOURAPIKEY diff --git a/hdtracks_importer.user.js b/hdtracks_importer.user.js index 9722b8c..d007ecd 100644 --- a/hdtracks_importer.user.js +++ b/hdtracks_importer.user.js @@ -18,7 +18,7 @@ // prevent JQuery conflicts, see http://wiki.greasespot.net/@grant this.$ = this.jQuery = jQuery.noConflict(true); -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { MBImportStyle(); window.addEventListener('hashchange', parsePage); // HDtracks is a single page app (SPA) }); diff --git a/juno_download_importer.user.js b/juno_download_importer.user.js index 21fa545..df7bd9a 100644 --- a/juno_download_importer.user.js +++ b/juno_download_importer.user.js @@ -17,7 +17,7 @@ // prevent JQuery conflicts, see http://wiki.greasespot.net/@grant this.$ = this.jQuery = jQuery.noConflict(true); -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { MBImportStyle(); let releaseUrl = window.location.href.replace('/?.*$/', '').replace(/#.*$/, ''); let release = retrieveReleaseInfo(releaseUrl); diff --git a/lib/mblinks.js b/lib/mblinks.js index 224aafb..865d9d2 100644 --- a/lib/mblinks.js +++ b/lib/mblinks.js @@ -2,7 +2,7 @@ // The main method is searchAndDisplayMbLink() // Example: -// $(document).ready(function () { +// document.addEventListener('DOMContentLoaded', () => { // // var mblinks = new MBLinks('EXAMPLE_MBLINKS_CACHE', 7*24*60); // force refresh of cached links once a week // diff --git a/loot_importer.user.js b/loot_importer.user.js index 5320dcf..8b40c2a 100644 --- a/loot_importer.user.js +++ b/loot_importer.user.js @@ -34,7 +34,7 @@ if (DEBUG) { * - http://www.loot.co.za/product/bette-midler-a-gift-of-love/mhgm-3483-g060 *** NOT WORKING *** extra tab */ -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { LOGGER.info('Document Ready & Loot Userscript executing'); let LootRelease = ParseLootPage(); insertMBSection(LootRelease); diff --git a/mb_discids_detector.user.js b/mb_discids_detector.user.js index ef443bd..f1fa391 100644 --- a/mb_discids_detector.user.js +++ b/mb_discids_detector.user.js @@ -26,7 +26,7 @@ LOGGER.setLevel('info'); const CHECK_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/gD+AP7rGNSCAAAACXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAAAQAAAAEABcxq3DAAADKklEQVQ4y32TS2hcZRiGn/8/Z87MNNc2zczEmptO0jSXagJtXCjWhhSEXpCI4EYENy6KG8FFBYtgEbzQ4k5QqNp2VyMtJVGpRU0tGDNoQxvrmCbkMslkSJrJXM6cOef8v4ukQqX4wbP5eL/327wv/M/Em+qNeFO9ASDEwzUPrM+fP8dqOhXqeGJ/f21ddCAYCsfRyFLJvru2mvnh9mTil8am1uJLQ8ceNOhoa+XC8HfMJm81x1q63glV179oBMLVhpQYEiQKzy0VNtZWLs9OT53s6X3qrxPHX+bSyNVNgyujV8lvrDXG2vZ/7oWig64nAY0hwZCCgIRwUGBJRSGbvp6cHH91R33078ODTyNOnXqPxcRl88ibX5wuBJuP5x2BVhop2PwuBA01kn2tJo4HtxfL5DIzZ7+/8MHrOx7tcMQ3I9dwnWKvF+kfTdlVEc/10f59A0HAgMEui90xgxvTLn8u+9SYhXUnNX60smr7z7Jx3wG8UOSZhUI4spJTrGwo0lssZxVSQlOdZGrJYyzpks4qlvLBWhWMHOgb7Mfsq4PfXOvx+bwgk/WxSwrfUwRNQSgAh7oCFB3N1xNllrMK04A5V7PLMOOvCSFMgFzJl6u2Jl8Gx9XkCppSWdEWNWiPGZy9XmIs6WJKKHuasq+p3qlkOwhz9B54dnbOkorOR0yG9gZJ3fP5cNTm4J4Akws+FyfKOK5GCFAatm/T4ObmB7RWxt74k9hrC0LVtLwwmw2FwyY8323hK2iLGnz2U4lMTiHvR04IGiqLxbrS7x/np3NJozoEmcTFTLTz2U7bivTcXNSsFxWHeyyGE2XGZ7x/j7WGyhA0W3e/LU58eiY1N+0IgLc++or1VLLb6hz6MmPGe/M2NFTBzIpH3lYoX6MQhC1NkzV/p2Jp5JX6eP+vn7wxsJnEXXUVnL6T59K7J/u2tR96365oey7nVQTKnsDzNFr5hETBq3ZmbrB47cS5M2+PdTbHmJpL89+OGbv3dLc81n/kWLih+yDhnTGtEcpeXXHSUz/OJ64M3/ojMS3BUw9rI2BsIUxBsLYyEJYC1nNuqawpARrwtwDgHxTwbTT5CxY9AAAALnpUWHRjcmVhdGUtZGF0ZQAAeNozMjCw0DWw0DUyCTEwsDIyszIw0jUwtTIwAABB3gURQfNnBAAAAC56VFh0bW9kaWZ5LWRhdGUAAHjaMzIwsNA1sNA1MggxNLMyNLYyNtM1MLUyMAAAQgUFF56jVzIAAAAASUVORK5CYII%3D'; -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { if (window.location.host.match(/orpheus\.network|redacted\.sh|passtheheadphones\.me|lztr\.(us|me)|mutracker\.org|notwhat\.cd/)) { LOGGER.info('Gazelle site detected'); gazellePageHandler(); diff --git a/mb_relationship_shortcuts.user.js b/mb_relationship_shortcuts.user.js index 6657030..b042bc5 100644 --- a/mb_relationship_shortcuts.user.js +++ b/mb_relationship_shortcuts.user.js @@ -134,7 +134,7 @@ this.$ = this.jQuery = jQuery.noConflict(true); if (!unsafeWindow) unsafeWindow = window; -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { // Get pageType (label or artist) let parent = {}; let child = {}; diff --git a/mb_ui_enhancements.user.js b/mb_ui_enhancements.user.js index 3fbd075..d54b3e8 100644 --- a/mb_ui_enhancements.user.js +++ b/mb_ui_enhancements.user.js @@ -53,7 +53,7 @@ function setGoogleSearchMenu() { } setGoogleSearchMenu(); -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { // Follow the instructions found at https://www.last.fm/api/authentication // then paste your API Key between the single quotes in the variable below. const LASTFM_APIKEY = ''; diff --git a/metalarchives_importer.user.js b/metalarchives_importer.user.js index bba50d4..e289467 100644 --- a/metalarchives_importer.user.js +++ b/metalarchives_importer.user.js @@ -16,7 +16,7 @@ // prevent JQuery conflicts, see http://wiki.greasespot.net/@grant this.$ = this.jQuery = jQuery.noConflict(true); -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { MBImportStyle(); let release_url = window.location.href.replace('/?.*$/', '').replace(/#.*$/, ''); diff --git a/qobuz_importer.user.js b/qobuz_importer.user.js index 24d2723..2e16720 100644 --- a/qobuz_importer.user.js +++ b/qobuz_importer.user.js @@ -557,7 +557,7 @@ function processReleasePage({ mblinks }) { } } -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { // Initialize MBLinks for checking already imported releases const mblinks = new MBLinks('QOBUZ_MBLINKS_CACHE'); const pageTypeRegex = new RegExp(`^\\/([a-z]{2}-[a-z]{2})?(?:\\/)?(interpreter|album|label)\\/`); diff --git a/src/userscripts/beatport_importer/index.ts b/src/userscripts/beatport_importer/index.ts index aace4a1..da17a2b 100644 --- a/src/userscripts/beatport_importer/index.ts +++ b/src/userscripts/beatport_importer/index.ts @@ -74,7 +74,7 @@ subscribeToSPANavigation({ onNavigate: () => processReleasePage(), }); -$(document).ready(() => { +document.addEventListener('DOMContentLoaded', () => { MBImportStyle(); // Process initial page load diff --git a/takealot_importer.user.js b/takealot_importer.user.js index 7f2e510..907d7bd 100644 --- a/takealot_importer.user.js +++ b/takealot_importer.user.js @@ -45,7 +45,7 @@ const release_attributes = {}; // albumid, total_pages, artist_name, label const album_api_array = []; // album information [0] const tracks_api_array = []; // track information [0,1,2,..] one element for each pagination in FMA tracks API -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { LOGGER.info('Document Ready & Takealot Userscript Executing'); parseFMApage(); diff --git a/vgmdb_importer.user.js b/vgmdb_importer.user.js index 3bbdaff..84b110f 100644 --- a/vgmdb_importer.user.js +++ b/vgmdb_importer.user.js @@ -19,7 +19,7 @@ const VGMDB_BLUESKY_UPDATE_LINK = 'https://bsky.app/profile/vgmdb.net/post/3lcvclcpny22d'; -$(document).ready(function () { +document.addEventListener('DOMContentLoaded', () => { MBImportStyle(); MBSearchItStyle(); From 0df8d48531199ced201d9e4fd254932697b0ac38 Mon Sep 17 00:00:00 2001 From: arne Date: Fri, 27 Mar 2026 08:24:48 +0100 Subject: [PATCH 5/5] chore: replace `$.isArray` with `Array.isArray` --- discogs_importer.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discogs_importer.user.js b/discogs_importer.user.js index f469502..98d2446 100644 --- a/discogs_importer.user.js +++ b/discogs_importer.user.js @@ -203,12 +203,12 @@ function insertMBLinks(current_page_key) { // ['discogs_type 1', 'discogs_type 2'] // [['discogs_type 1', 'mb type 1'], 'discogs_type 2'] // etc. - if (!$.isArray(types)) { + if (!Array.isArray(types)) { // just one string types = [types]; } types.forEach((val, idx) => { - if (!$.isArray(val)) { + if (!Array.isArray(val)) { types[idx] = [val, undefined]; } });