From ff36766e8e2318871b45a02d80197366d144b19a Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 19 Oct 2023 23:17:48 -0400 Subject: [PATCH] refactor: Reduce unnecessary function calls --- options/options.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/options/options.js b/options/options.js index eafec66..dc3724b 100644 --- a/options/options.js +++ b/options/options.js @@ -61,7 +61,7 @@ profileFunction = 'createProfile'; } - const id = targetProfile.dataset.id || uuid(); + const id = targetProfile.dataset.id; const profile = { id, name, content }; backgroundPage[profileFunction](profile); @@ -102,8 +102,7 @@ profileDiv.classList.add('profile'); buttonsWrapper.classList.add('buttons-wrapper'); saveButton.classList.add('button'); - deleteButton.classList.add('button'); - deleteButton.classList.add('delete-button'); + deleteButton.classList.add('button', 'delete-button'); profileName.placeholder = 'Profile Name'; profileContent.placeholder = 'mpv args (1 per line)'; @@ -117,12 +116,8 @@ saveButton.textContent = 'save'; deleteButton.textContent = 'delete'; - buttonsWrapper.appendChild(saveButton); - buttonsWrapper.appendChild(deleteButton); - - profileDiv.appendChild(profileName); - profileDiv.appendChild(profileContent); - profileDiv.appendChild(buttonsWrapper); + buttonsWrapper.append(saveButton, deleteButton); + profileDiv.append(profileName, profileContent, buttonsWrapper); return profileDiv; }