minor: cache asset designer data
and rename "Item Modeler" to "Asset Designer"
This commit is contained in:
parent
d0799a127f
commit
9b20404929
2 changed files with 25 additions and 8 deletions
|
|
@ -546,7 +546,6 @@ async function ReaddCopyable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlaceDetails.isCopyable) {
|
if (PlaceDetails.isCopyable) {
|
||||||
console.log('is copyable')
|
|
||||||
const TitleCardButtons = document.querySelector('.card:has(h1.my-0) .col-auto[style^="m"]')
|
const TitleCardButtons = document.querySelector('.card:has(h1.my-0) .col-auto[style^="m"]')
|
||||||
|
|
||||||
const DownloadCopyButton = document.createElement('button')
|
const DownloadCopyButton = document.createElement('button')
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
const ItemID = window.location.pathname.split('/')[2];
|
const ItemID = window.location.pathname.split('/')[2];
|
||||||
|
let ItemModeler = null;
|
||||||
const ItemType = document.querySelector('.row .badge').innerHTML;
|
const ItemType = document.querySelector('.row .badge').innerHTML;
|
||||||
|
|
||||||
var Settings;
|
var Settings;
|
||||||
|
|
@ -65,7 +66,27 @@ var Utilities;
|
||||||
HandleItemWishlist();
|
HandleItemWishlist();
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemCreator()
|
if (Settings.AssetDesignerCreditOn == true) {
|
||||||
|
chrome.storage.local.get(['PolyPlus_AssetDesigners'], async function(result){
|
||||||
|
let AssetDesignerData = result['PolyPlus_AssetDesigners'];
|
||||||
|
|
||||||
|
// cache for 5 minutes
|
||||||
|
if (AssetDesignerData === undefined || (new Date().getTime() - AssetDesignerData.requested > 300000)) {
|
||||||
|
AssetDesignerData = await ((await fetch('https://polyplus.vercel.app/data/itemModelers.json')).json());
|
||||||
|
|
||||||
|
chrome.storage.local.set({['PolyPlus_AssetDesigners']: {
|
||||||
|
data: AssetDesignerData,
|
||||||
|
requested: new Date().getTime()
|
||||||
|
}}, function(){});
|
||||||
|
} else {
|
||||||
|
AssetDesignerData = AssetDesignerData.data
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AssetDesignerData[ItemID]) {
|
||||||
|
AssetDesignerInfo(AssetDesignerData)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
@ -868,18 +889,15 @@ async function ValueListData() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function ItemCreator() {
|
async function AssetDesignerInfo(data) {
|
||||||
const ItemCreatorData = await ((await fetch('https://polyplus.vercel.app/data/itemModelers.json')).json())
|
|
||||||
if (!ItemCreatorData[ItemID]) { return }
|
|
||||||
|
|
||||||
let QuickStats = document.querySelectorAll('.row:has(h3, h6, [data-bs-tooltip])')[2];
|
let QuickStats = document.querySelectorAll('.row:has(h3, h6, [data-bs-tooltip])')[2];
|
||||||
|
|
||||||
const CreatorStat = document.createElement('div')
|
const CreatorStat = document.createElement('div')
|
||||||
CreatorStat.classList = 'col text-center'
|
CreatorStat.classList = 'col text-center'
|
||||||
CreatorStat.innerHTML = `
|
CreatorStat.innerHTML = `
|
||||||
<h6>Item Modeler</h6>
|
<h6>Asset Designer</h6>
|
||||||
<h3 class="small">
|
<h3 class="small">
|
||||||
<a href="/u/${ItemCreatorData[ItemID]}" style="background-clip:text;-webkit-background-clip:text;color:transparent;background-image: linear-gradient(90deg, #1ad05b, #68f);-webkit-text-fill-color: transparent;">${ItemCreatorData[ItemID]}</a>
|
<a href="/u/${data[ItemID]}" style="background-clip:text;-webkit-background-clip:text;color:transparent;background-image: linear-gradient(90deg, #1ad05b, #68f);-webkit-text-fill-color: transparent;">${data[ItemID]}</a>
|
||||||
</h3>
|
</h3>
|
||||||
`
|
`
|
||||||
QuickStats.appendChild(CreatorStat)
|
QuickStats.appendChild(CreatorStat)
|
||||||
|
|
|
||||||
Reference in a new issue