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:
parent
eeaafeb35a
commit
8b20599662
1 changed files with 7 additions and 13 deletions
|
|
@ -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()
|
||||||
|
|
@ -210,11 +204,11 @@ function TryOnItems() {
|
||||||
TryOnModal.setAttribute('style', 'width: 450px; border: 1px solid #484848; background-color: #181818; border-radius: 20px; overflow: hidden;')
|
TryOnModal.setAttribute('style', 'width: 450px; border: 1px solid #484848; background-color: #181818; border-radius: 20px; overflow: hidden;')
|
||||||
TryOnModal.innerHTML = `
|
TryOnModal.innerHTML = `
|
||||||
<div class="text-muted mb-2" style="font-size: 0.8rem;">
|
<div class="text-muted mb-2" style="font-size: 0.8rem;">
|
||||||
<h5 class="mb-0" style="color: #fff;">Preview</h5>
|
<h5 class="mb-0" style="color: #fff;">Preview</h5>
|
||||||
Try on this item!
|
Try on this item!
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<button class="btn btn-primary w-100 mx-auto" onclick="this.parentElement.parentElement.close();">Close</button>
|
<button class="btn btn-primary w-100 mx-auto" onclick="this.parentElement.parentElement.close();">Close</button>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
Reference in a new issue