feat: store "owned tags" in event items category

This commit is contained in:
Index 2024-07-02 03:14:32 -05:00
parent eb644e8f1e
commit 26c63d3bf6

View file

@ -100,8 +100,13 @@ async function LoadIRLPrices(element) {
} }
} }
function LoadOwnedTags(element) { function LoadOwnedTags(element, id) {
let Item = CheckInventory(parseInt(element.querySelector('[href^="/store/"]').getAttribute('href').split('/')[2])); let Item;
if (id !== undefined) {
Item = CheckInventory(parseInt(id))
} else {
Item = CheckInventory(parseInt(element.querySelector('[href^="/store/"]').getAttribute('href').split('/')[2]));
}
if (Item !== null) { if (Item !== null) {
const Tag = document.createElement('span'); const Tag = document.createElement('span');
Tag.classList = `badge ${Item.asset.isLimited === false ? 'bg-primary' : 'bg-warning'} polyplus-own-tag`; Tag.classList = `badge ${Item.asset.isLimited === false ? 'bg-primary' : 'bg-warning'} polyplus-own-tag`;
@ -247,6 +252,12 @@ function EventItems() {
const Next = document.getElementById('p+ei-pagination-next'); const Next = document.getElementById('p+ei-pagination-next');
const Last = document.getElementById('p+ei-pagination-last'); const Last = document.getElementById('p+ei-pagination-last');
if (Settings.StoreOwnTagOn === true) {
Array.from(Container.querySelectorAll('a[href^="/store"]')).forEach((element) => {
LoadOwnedTags(element);
});
}
if (Page > 0) { if (Page > 0) {
Prev.parentElement.classList.remove('disabled'); Prev.parentElement.classList.remove('disabled');
First.parentElement.classList.remove('disabled'); First.parentElement.classList.remove('disabled');
@ -347,6 +358,12 @@ function EventItems() {
Next.parentElement.classList.add('disabled'); Next.parentElement.classList.add('disabled');
Last.parentElement.classList.add('disabled'); Last.parentElement.classList.add('disabled');
} }
if (Settings.StoreOwnTagOn === true) {
Array.from(Container.querySelectorAll('a[href^="/store"]')).forEach((element) => {
LoadOwnedTags(element);
});
}
}; };
}); });
} }