diff --git a/js/account/profile.js b/js/account/profile.js index 7953e09..e0cac54 100755 --- a/js/account/profile.js +++ b/js/account/profile.js @@ -1,5 +1,6 @@ const UserID = window.location.pathname.split('/')[2]; const AvatarRow = document.getElementsByClassName('d-flex flex-row flex-nowrap overflow-x-scroll px-3 px-lg-0 mb-2 mb-lg-0')[0] +const AvatarHeading = document.querySelector('.section-title:has(i.fa-user-crown)') var Settings; var BestFriends; @@ -26,14 +27,21 @@ if (UserID && !isNaN(UserID)) { } if (Settings.OutfitCostOn === true) { - CalculateButton = document.createElement('button') - CalculateButton.classList = 'btn btn-warning btn-sm' - CalculateButton.innerText = 'Calculate Avatar Cost' - AvatarRow.parentElement.parentElement.prepend(CalculateButton) - AvatarRow.parentElement.style.marginTop = '10px' + CalculateButton = document.createElement('small') + CalculateButton.classList = 'fw-normal text-success' + CalculateButton.style.letterSpacing = '0px' + CalculateButton.innerHTML = ` + $ calculate + ` + AvatarHeading.appendChild(CalculateButton) + let Calculating = false CalculateButton.addEventListener('click', function(){ - OutfitCost() + if (Calculating === false) { + Calculating = true + CalculateButton.innerText = '$ Calculating...' + OutfitCost() + } }); } }); @@ -104,7 +112,6 @@ if (UserID && !isNaN(UserID)) { async function IRLPrice() { const NetWorthElement = document.getElementsByClassName('float-end text-success')[0]; - //const NetWorth = parseInt(NetWorthElement.innerText.replace(/,/g, '')); const IRLResult = await Utilities.CalculateIRL(NetWorthElement.innerText, Settings.IRLPriceWithCurrencyCurrency) NetWorthElement.innerText = NetWorthElement.innerText + " ($" + IRLResult.result + " " + IRLResult.display + ")" } @@ -220,12 +227,11 @@ async function OutfitCost() { }) .catch(error => {console.log(error)}); } - - const TotalCostText = document.createElement('small') - TotalCostText.classList = 'text-muted' - TotalCostText.style.padding = '20px' - TotalCostText.innerHTML = `${ (AvatarCost.Limiteds > 0 || AvatarCost.Exclusives > 0) ? '~' : '' } ${AvatarCost.Total.toLocaleString()}${ (AvatarCost.Limiteds > 0) ? ` (has ${AvatarCost.Limiteds} limiteds)` : '' }${ (AvatarCost.Exclusives > 0) ? ` (has ${AvatarCost.Exclusives} exclusives)` : '' }` - AvatarRow.parentElement.parentElement.prepend(TotalCostText) - AvatarRow.parentElement.style.marginTop = '10px' - CalculateButton.remove(); + const ResultText = document.createElement('small') + ResultText.classList = 'fw-normal text-success' + ResultText.style.letterSpacing = '0px' + ResultText.innerHTML = `( ${ (AvatarCost.Limiteds > 0 || AvatarCost.Exclusives > 0) ? '~' : '' } ${ AvatarCost.Total.toLocaleString() }${ (AvatarCost.Limiteds > 0) ? `, ${AvatarCost.Limiteds} limiteds` : '' }${ (AvatarCost.Exclusives > 0) ? `, ${AvatarCost.Exclusives} exclusives` : '' })` + + CalculateButton.remove() + AvatarHeading.appendChild(ResultText) } \ No newline at end of file diff --git a/js/debug.js b/js/debug.js index 1371965..a59d6d7 100644 --- a/js/debug.js +++ b/js/debug.js @@ -1,4 +1,8 @@ -// DEBUG PAGE FOR BETA TESTING +/* + Debug page for Development + Accessable at /my/settings/polyplus-debug +*/ +document.title = 'Poly+ Debug - Polytoria' const Version = chrome.runtime.getManifest().version document.querySelector('#main-content .container').innerHTML = ` +
+

Poly+ Debug

+

This page is used by developers for debugging most data related things. It is unrecommended you modify any data on this page, but if you ever want to go ahead.

+
-
+

Version: v${Version}

-

Data Size: Loading byte(s)

+

Data Size: Loading byte(s)

Open GitHub
@@ -40,7 +48,7 @@ document.querySelector('#main-content .container').innerHTML = `
- +
@@ -60,16 +68,33 @@ document.querySelector('#main-content .container').innerHTML = `
- -

Quickly clear specific locations of the extension's local data

-
- - -
+
- -

This will clear all local data associated with the extension

- +
+
RUN TESTS
+
+ +

will add later

+
+
+ +
+ +
+
DANGER ZONE!
+
+ +

Quickly clear specific locations of the extension's local data

+
+ + +
+ + +

This will clear all local data associated with the extension

+ +
+
` diff --git a/js/settings.js b/js/settings.js index e9f72fe..5c0f316 100755 --- a/js/settings.js +++ b/js/settings.js @@ -1,22 +1,15 @@ +const SettingsURL = chrome.runtime.getURL('settings.html') const InExtensionSettings = (window.location.pathname.split('/')[3] === "polyplus") if (InExtensionSettings === true) { - window.location.href = chrome.runtime.getURL('settings.html') + window.location.hash + window.location.href = SettingsURL + window.location.hash } document.addEventListener('DOMContentLoaded', function(){ const Nav = document.getElementsByClassName('nav nav-pills')[0] - - if (InExtensionSettings === true) { - Array.from(Nav.children).forEach(item => { - if (item.classList.contains('active')) { - item.classList.remove('active') - } - }) - } const PolyPlusItem = document.createElement('a') PolyPlusItem.classList = 'nav-link' - PolyPlusItem.href = chrome.runtime.getURL('settings.html') + PolyPlusItem.href = SettingsURL PolyPlusItem.innerHTML = ` Poly+ `