From 2d6e5bd947806565c24fe1d94d2eaedae255eb6b Mon Sep 17 00:00:00 2001 From: Index Date: Thu, 4 Jul 2024 04:45:45 -0500 Subject: [PATCH] feat: avatar sandbox change body part colors feature --- js/account/avatar-sandbox.js | 21 ++++++++++ resources/avatar-sandbox.html | 77 +++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/js/account/avatar-sandbox.js b/js/account/avatar-sandbox.js index 8846f4f..0fcdce6 100644 --- a/js/account/avatar-sandbox.js +++ b/js/account/avatar-sandbox.js @@ -70,6 +70,9 @@ let Order = "desc" let ShowOffsale = true let TabSelected = "hat" +/* Customization */ +let SelectedBodyPart + !(async () => { Utilities = await import(chrome.runtime.getURL('resources/utils.js')); Utilities = Utilities.default; @@ -118,6 +121,24 @@ async function PageLoad() { }); }); + const BodyColorsModal = document.getElementById('p+body_colors') + const BodyParts = Array.from(document.getElementsByClassName('bodypart')) + BodyParts.forEach(part => { + part.addEventListener('click', function(){ + SelectedBodyPart = part.id + BodyColorsModal.showModal() + }) + }) + + const BodyColors = Array.from(document.getElementsByClassName('colorpicker-color')) + BodyColors.forEach(color => { + color.addEventListener('click', function(){ + Avatar[SelectedBodyPart+'Color'] = color.style.backgroundColor + BodyColorsModal.close() + UpdateAvatar() + }) + }) + const ItemSearch = document.getElementById('search-btn') ItemSearch.addEventListener('click', function(){ Search = ItemSearch.previousElementSibling.value diff --git a/resources/avatar-sandbox.html b/resources/avatar-sandbox.html index 2afeb0c..922ce3f 100755 --- a/resources/avatar-sandbox.html +++ b/resources/avatar-sandbox.html @@ -35,6 +35,83 @@ margin-bottom: 3.5px; } + +
+
+
Modify Body Colors
+ Selected Body Part: none +
+
+ +
+
+ +