This repository has been archived on 2026-01-04. You can view files and clone it, but cannot push or open issues or pull requests.
polyplus/js/guilds.js
Index 55ad153d2b 33 files changed - update + hoarders list
- Added new feature: "Collectibles' Hoarders List"

[ IMPROVEMENTS ]

- Reorganized resources folder to be in the root directory rather than a sub-folder of the javascript folder

- Added a new feature: "Quick Library Downloads"

- Basically finished the "Event Items Store Category" feature

- Added more manifest.json information
2024-04-25 17:04:38 -05:00

70 lines
No EOL
2.6 KiB
JavaScript

const StoreItems = document.getElementById('store-items')
var Settings;
let Utilities;
chrome.storage.sync.get(['PolyPlus_Settings'], function(result){
Settings = result.PolyPlus_Settings
if (Settings.IRLPriceWithCurrencyOn === true) {
(async () => {
Utilities = await import(chrome.runtime.getURL('resources/utils.js'));
Utilities = Utilities.default
for (let item of Array.from(StoreItems.children)) {
IRLPrice(item)
}
const PreviousPage = document.querySelector('#store-prev a')
const NextPage = document.querySelector('#store-next a')
//PreviousPage.addEventListener('click', IRLPrice)
//NextPage.addEventListener('click', IRLPrice)
})();
}
});
/*
async function IRLPrice() {
Array.from(document.getElementsByClassName('polyplus-price-tag')).forEach(tag => {tag.remove()})
for (let item of Array.from(StoreItems.children)) {
const Price = item.getElementsByClassName('text-success')[0]
if (Price !== undefined && Price.innerText !== "Free") {
const IRLResult = await Utilities.CalculateIRL(Price.innerText, Settings.IRLPriceWithCurrencyCurrency)
let Span = document.createElement('span')
Span.classList = 'text-muted polyplus-price-tag'
Span.style.fontSize = '0.7rem'
Span.innerText = " ($" + IRLResult.result + " " + IRLResult.display + ")"
Price.appendChild(Span)
}
}
}
*/
async function IRLPrice(item) {
const Price = item.getElementsByClassName('text-success')[0]
if (Price !== undefined && Price.innerText !== "Free") {
const IRLResult = await Utilities.CalculateIRL(Price.innerText, Settings.IRLPriceWithCurrencyCurrency)
let Span = document.createElement('span')
Span.classList = 'text-muted polyplus-price-tag'
Span.style.fontSize = '0.7rem'
Span.innerText = " ($" + IRLResult.result + " " + IRLResult.display + ")"
Price.appendChild(Span)
}
}
const observer = new MutationObserver(async function (list){
for (const record of list) {
for (const element of record.addedNodes) {
if (element.tagName === "DIV" && element.classList.value === 'col-auto mb-3') {
if (Settings.IRLPriceWithCurrencyOn === true) {
IRLPrice(element)
}
}
}
observer.observe(StoreItems, {attributes: false,childList: true,subtree: false});
}
});
observer.observe(StoreItems, {attributes: false,childList: true,subtree: false});