From 8b205996623e59ab40e1b39c5795b7494e1e780b Mon Sep 17 00:00:00 2001 From: Index Date: Sat, 20 Apr 2024 15:54:29 -0500 Subject: [PATCH] Fix "Try-On" Store Items - Improved detection for the purchase button on the store item view page AGAIN (hopefully it works 100% of the time now for all situations) - Fixed "Try-On" store items again (the code was working it was just the adding of the mesh to the list of items that broke) --- js/store/item-view.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/js/store/item-view.js b/js/store/item-view.js index e32bd04..34fbe21 100755 --- a/js/store/item-view.js +++ b/js/store/item-view.js @@ -29,17 +29,11 @@ var ItemOwned; chrome.storage.sync.get(['PolyPlus_Settings'], async function(result){ Settings = result.PolyPlus_Settings || {} - PurchaseBtn = document.querySelector('.btn[onclick^="buyAsset"]') + PurchaseBtn = document.querySelector('.btn[onclick^="buy"]') if (PurchaseBtn === null) { PurchaseBtn = document.querySelector('.btn#purchase-button') } - /* - if (ItemType === "gamePass") { - PurchaseBtn = document.querySelector('[onclick^="buyAsset"]') - } - */ ItemOwned = (PurchaseBtn.innerText === ' Item owned' || document.querySelector('.btn[onclick="sellItem()"]') !== null) - console.log(PurchaseBtn, ItemOwned) if (Settings.IRLPriceWithCurrencyOn === true && ItemOwned === false) { IRLPrice() @@ -210,11 +204,11 @@ function TryOnItems() { TryOnModal.setAttribute('style', 'width: 450px; border: 1px solid #484848; background-color: #181818; border-radius: 20px; overflow: hidden;') TryOnModal.innerHTML = `
-
Preview
- Try on this item! +
Preview
+ Try on this item!
` @@ -266,10 +260,10 @@ function TryOnItems() { return response.json(); }) .then(data => { - if (AssetType === 'hat') { - Avatar.items[Avatar.items.length] = data.url - } else if (AssetType === 'tool') { + if (AssetType === 'tool') { Avatar.tool = data.url + } else { + Avatar.items.push(data.url) } console.log(Avatar)