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)
This commit is contained in:
Index 2024-04-20 15:54:29 -05:00
parent eeaafeb35a
commit 8b20599662

View file

@ -29,17 +29,11 @@ var ItemOwned;
chrome.storage.sync.get(['PolyPlus_Settings'], async function(result){ chrome.storage.sync.get(['PolyPlus_Settings'], async function(result){
Settings = result.PolyPlus_Settings || {} Settings = result.PolyPlus_Settings || {}
PurchaseBtn = document.querySelector('.btn[onclick^="buyAsset"]') PurchaseBtn = document.querySelector('.btn[onclick^="buy"]')
if (PurchaseBtn === null) { if (PurchaseBtn === null) {
PurchaseBtn = document.querySelector('.btn#purchase-button') 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) ItemOwned = (PurchaseBtn.innerText === ' Item owned' || document.querySelector('.btn[onclick="sellItem()"]') !== null)
console.log(PurchaseBtn, ItemOwned)
if (Settings.IRLPriceWithCurrencyOn === true && ItemOwned === false) { if (Settings.IRLPriceWithCurrencyOn === true && ItemOwned === false) {
IRLPrice() IRLPrice()
@ -266,10 +260,10 @@ function TryOnItems() {
return response.json(); return response.json();
}) })
.then(data => { .then(data => {
if (AssetType === 'hat') { if (AssetType === 'tool') {
Avatar.items[Avatar.items.length] = data.url
} else if (AssetType === 'tool') {
Avatar.tool = data.url Avatar.tool = data.url
} else {
Avatar.items.push(data.url)
} }
console.log(Avatar) console.log(Avatar)