diff --git a/js/extra-pages.js b/js/extra-pages.js index dc63b46..c7d9595 100644 --- a/js/extra-pages.js +++ b/js/extra-pages.js @@ -75,17 +75,21 @@ if (window.location.pathname.split('/')[3] === 'polyplus' && window.location.has
will add later
+ +Quickly clear specific locations of the extension's local data
@@ -234,7 +238,32 @@ if (window.location.pathname.split('/')[3] === 'polyplus' && window.location.has }); }); - chrome.storage.sync.getBytesInUse(['PolyPlus_Settings', 'PolyPlus_PinnedGames', 'PolyPlus_ItemWishlist'], function (sync) { + const GenerateEventItems = document.getElementById('generate-event-items') + GenerateEventItems.addEventListener('click', async function(){ + const EventItemsJSON = [] + const ItemIDs = GenerateEventItems.previousElementSibling.value.split(',') + for (let id of ItemIDs) { + const ItemDetails = (await (await fetch('https://api.polytoria.com/v1/store/' + id.trim())).json()) + EventItemsJSON.push({ + id: parseInt(id), + name: ItemDetails.name, + event: GenerateEventItems.previousElementSibling.previousElementSibling.value, + thumbnail: ItemDetails.thumbnail + }) + } + + console.log(EventItemsJSON) + + navigator.clipboard.writeText(JSON.stringify(EventItemsJSON, null, 2)) + .then(() => { + alert('Successfully copied generated event items JSON!') + }) + .catch(() => { + alert('Failure when trying to copy generated event items JSON.') + }) + }) + + chrome.storage.sync.getBytesInUse(['PolyPlus_Settings', 'PolyPlus_PinnedGames', 'PolyPlus_ItemWishlist', 'PolyPlus_TimePlayed', 'PolyPlus_AvatarSandboxOutfits'], function (sync) { chrome.storage.local.getBytesInUse(['PolyPlus_InventoryCache'], function(local){ document.getElementById('data-size').innerText = (sync + local).toLocaleString(); }) @@ -420,7 +449,7 @@ if (window.location.pathname.split('/')[3] === 'polyplus' && window.location.has } CheckForUpdatesButton.addEventListener('click', CheckForUpdates); - chrome.storage.sync.getBytesInUse(['PolyPlus_Settings', 'PolyPlus_PinnedGames', 'PolyPlus_ItemWishlist'], function (sync) { + chrome.storage.sync.getBytesInUse(['PolyPlus_Settings', 'PolyPlus_PinnedGames', 'PolyPlus_ItemWishlist', 'PolyPlus_TimePlayed', 'PolyPlus_AvatarSandboxOutfits'], function (sync) { chrome.storage.local.getBytesInUse(['PolyPlus_InventoryCache'], function(local){ document.getElementById('data-size').innerText = (sync + local).toLocaleString(); })