From d5f44954b9ac10d72688162aee3d528e6dfaa554 Mon Sep 17 00:00:00 2001 From: iw0 Date: Thu, 11 Apr 2024 10:45:53 +0200 Subject: [PATCH] use the util functions --- content_script.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/content_script.js b/content_script.js index a8d3b5d..5fd1d16 100644 --- a/content_script.js +++ b/content_script.js @@ -333,12 +333,7 @@ const enterTitleAndActivateCountryDropdown = { const enterCountry = { name: "enterCountry", expects: "mutation", - match: mutation => { - return mutation.target.parentNode.parentNode.classList.contains("test-adresse-land") && - Array.from(mutation.addedNodes).some( - n => n.nodeType === Node.ELEMENT_NODE && - n.classList.contains("db-web-dropdown-outer-container")) - }, + match: mut => matchDropdown(mut, "test-adresse-land", "open"), execute: () => { ensureSettingsProp("addr__country", v => { const selectList = $(".test-adresse-land ul"); @@ -354,13 +349,8 @@ const enterCountry = { const enterTextPersonalData = { name: "enterTextPersonalData", expects: 'mutation', - /** @param {MutationRecord} mutation */ - match: mutation => { - return (mutation.target.parentNode.parentNode.classList.contains("test-name-titel") && - Array.from(mutation.removedNodes).some( - n => n.nodeType === Node.ELEMENT_NODE && - n.classList.contains("db-web-dropdown-outer-container"))) - }, + /** @param {MutationRecord} mut */ + match: mut => matchDropdown(mut, "test-name-titel", "close"), execute: () => { let node = document; let delay = 100;