From 877f38c36d56f6d8e55cdb3db44860863805f6aa Mon Sep 17 00:00:00 2001 From: loujine Date: Sun, 12 Mar 2023 21:04:14 +0000 Subject: [PATCH] [guess works] Replace jquery syntax (#82) --- mb-reledit-guess_works.user.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mb-reledit-guess_works.user.js b/mb-reledit-guess_works.user.js index 08727dd..80a8857 100644 --- a/mb-reledit-guess_works.user.js +++ b/mb-reledit-guess_works.user.js @@ -144,18 +144,18 @@ const guessWork = () => { }; const autoComplete = () => { - const $input = $('input#mainWork'); - const match = $input.val().match(MBID_REGEX); + const input = document.getElementById('mainWork'); + const match = input.value.match(MBID_REGEX); if (match) { const mbid = match[0]; requests.GET(`/ws/2/work/${mbid}?fmt=json`, (data) => { data = JSON.parse(data); - $input.data('mbid', mbid); - $input.val(data.title || data.name); - $input.css('background', '#bbffbb'); + input.setAttribute('mbid', mbid); + input.value = data.title || data.name; + input.style.backgroundColor = '#bbffbb'; }); } else { - $input.css('background', '#ffaaaa'); + input.style.backgroundColor = '#ffaaaa'; } }; @@ -254,11 +254,11 @@ $(document).ready(function() { appliedNote = true; } }); - $('input#mainWork').on('input', autoComplete); - document.querySelector('input#fetchSubworks').addEventListener('click', () => { + document.getElementById('mainWork').addEventListener('input', autoComplete); + document.getElementById('fetchSubworks').addEventListener('click', () => { fetchSubWorks( - $('input#mainWork').data('mbid'), - document.querySelector('input#replaceSubworks').checked + document.getElementById('mainWork').getAttribute('mbid'), + document.getElementById('replaceSubworks').checked, ); if (!appliedNote) { relEditor.editNote(GM_info.script, 'Set guessed subworks');