feat: new "see player id and join date when blocked" feature
This commit is contained in:
parent
29539ac59e
commit
fd55054ac6
4 changed files with 49 additions and 5 deletions
|
|
@ -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 = `
|
||||
<b><i class="fa fa-hashtag text-center d-inline-block" style="width:1.2em"></i> Player ID</b>
|
||||
<span class="float-end">
|
||||
${UserID.id} <a id="copy" href="#copy"><i class="fad fa-copy" style="margin-left: 5px;"></i></a>
|
||||
</span>
|
||||
`
|
||||
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 = `
|
||||
<b><i class="fad fa-calendar text-center d-inline-block" style="width:1.2em"></i> Join date</b>
|
||||
<span class="float-end">
|
||||
${ ["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() }
|
||||
</span>
|
||||
`
|
||||
|
||||
BlockedCard.appendChild(UserIDRow)
|
||||
BlockedCard.appendChild(AccountCreatedRow)
|
||||
}
|
||||
}
|
||||
|
||||
const CopyButton = UserIDRow.getElementsByTagName('a')[0]
|
||||
CopyButton.addEventListener('click', function(){
|
||||
|
|
|
|||
|
|
@ -105,7 +105,8 @@ const DefaultSettings = {
|
|||
PlaceFileDownloadOn: true,
|
||||
MultiWhitelistOn: true,
|
||||
ClearWhitelistOn: true
|
||||
}
|
||||
},
|
||||
MoreBlockedDetailsOn: true
|
||||
}
|
||||
|
||||
// ON EXTENSION INSTALL / RELOAD
|
||||
|
|
|
|||
|
|
@ -124,7 +124,8 @@ export default {
|
|||
PlaceFileDownloadOn: true,
|
||||
MultiWhitelistOn: true,
|
||||
ClearWhitelistOn: true
|
||||
}
|
||||
},
|
||||
MoreBlockedDetailsOn: true
|
||||
},
|
||||
Limits: {
|
||||
PinnedGames: 10,
|
||||
|
|
|
|||
|
|
@ -797,6 +797,21 @@
|
|||
<label class="form-check-label" for="clear-whitelist-button"> <span class="badge bg-primary mb-1">New in v1.3!</span> Quick Clear Whitelist Button </label>
|
||||
</span>
|
||||
</div>
|
||||
<div class="setting-container" id="more-blocked-details">
|
||||
<span class="badge bg-primary mb-1">New in v1.3!</span>
|
||||
<br>
|
||||
<span class="indicator"> </span>
|
||||
<span class="title">
|
||||
See Player ID and Join Date when Blocked
|
||||
</span>
|
||||
<div class="setting-buttons">
|
||||
<button class="btn btn-sm toggle-btn" data-setting="MoreBlockedDetailsOn">Toggle</button>
|
||||
</div>
|
||||
<br />
|
||||
<span class="desc">
|
||||
See someone's player ID and join date even if they have blocked you on their profile.
|
||||
</span>
|
||||
</div>
|
||||
<!---
|
||||
<div class="setting-container" id="auto-ad-bidding">
|
||||
<span class="indicator"> </span>
|
||||
|
|
|
|||
Reference in a new issue