diff --git a/js/account/profile.js b/js/account/profile.js index a48f86d..161ebb4 100755 --- a/js/account/profile.js +++ b/js/account/profile.js @@ -1,4 +1,6 @@ let Username = window.location.pathname.split('/')[2]; +let Blocked = false; + 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)'); @@ -16,19 +18,44 @@ if (Username) { Utilities = await import(chrome.runtime.getURL('resources/utils.js')); Utilities = Utilities.default; - chrome.storage.sync.get(['PolyPlus_Settings'], function (result) { + if (document.querySelector('.card .fa-ban')) { + Blocked = true; + } + + chrome.storage.sync.get(['PolyPlus_Settings'], async function (result) { Settings = result.PolyPlus_Settings || {}; const InfoColumns = document.getElementById('user-stats-card'); const UserIDRow = document.createElement('div') - UserIDRow.classList = 'mb-1' + UserIDRow.classList = 'mb-1 text-start' UserIDRow.innerHTML = ` Player ID ${UserID.id} ` - InfoColumns.children[0].insertBefore(UserIDRow, InfoColumns.children[0].children[1]); + if (!Blocked) { + InfoColumns.children[0].insertBefore(UserIDRow, InfoColumns.children[0].children[1]); + } else { + if (Settings.MoreBlockedDetailsOn) { + const BlockedCard = document.querySelector('.card-body:has(.fa-ban)') + BlockedCard.appendChild(document.createElement('hr')) + + const AccountInfo = (await (await fetch('https://api.'+window.location.hostname+'/v1/users/' + UserID.id )).json()); + + const AccountCreatedRow = document.createElement('div') + AccountCreatedRow.classList = 'mb-1 text-start' + AccountCreatedRow.innerHTML = ` + Join date + + ${ ["January","February","March","April","May","June","July","August","September","November","December"][new Date(AccountInfo.registeredAt).getMonth() - 1] + " " + new Date(AccountInfo.registeredAt).getDate() + ", " + new Date(AccountInfo.registeredAt).getFullYear() } + + ` + + BlockedCard.appendChild(UserIDRow) + BlockedCard.appendChild(AccountCreatedRow) + } + } const CopyButton = UserIDRow.getElementsByTagName('a')[0] CopyButton.addEventListener('click', function(){ diff --git a/js/background.js b/js/background.js index f8ea846..e5f67da 100755 --- a/js/background.js +++ b/js/background.js @@ -105,7 +105,8 @@ const DefaultSettings = { PlaceFileDownloadOn: true, MultiWhitelistOn: true, ClearWhitelistOn: true - } + }, + MoreBlockedDetailsOn: true } // ON EXTENSION INSTALL / RELOAD diff --git a/resources/utils.js b/resources/utils.js index de22657..2ad94eb 100644 --- a/resources/utils.js +++ b/resources/utils.js @@ -124,7 +124,8 @@ export default { PlaceFileDownloadOn: true, MultiWhitelistOn: true, ClearWhitelistOn: true - } + }, + MoreBlockedDetailsOn: true }, Limits: { PinnedGames: 10, diff --git a/settings.html b/settings.html index fb6e8fa..caf7ef8 100755 --- a/settings.html +++ b/settings.html @@ -797,6 +797,21 @@ +
+ New in v1.3! +
+   + + See Player ID and Join Date when Blocked + +
+ +
+
+ + See someone's player ID and join date even if they have blocked you on their profile. + +