minor: redesign great divide user statistics card

This commit is contained in:
Index 2024-06-28 23:57:29 -05:00
parent f11c21c2be
commit fe3901a5f5

View file

@ -1,3 +1,7 @@
let EventOngoing = true;
let Team;
let HasTeam = true;
(async () => { (async () => {
Utilities = await import(chrome.runtime.getURL('resources/utils.js')) Utilities = await import(chrome.runtime.getURL('resources/utils.js'))
.default .default
@ -9,16 +13,25 @@
return return
} }
let EventOngoing = true Team = document.querySelector('#user-avatar-card a[href^="/event/"]')
let HasTeam = true if (Team === null) {
if (document.querySelector('#user-avatar-card a[href="/event/the-great-divide"]') === null) { HasTeam = false } HasTeam = false
} else {
if (Team.getElementsByClassName('userlink-team-phantoms').length > 0) {
console.log('phartoms')
Team = "phantoms"
} else if (Team.getElementsByClassName('userlink-team-cobras').length > 0) {
console.log('cobras drool')
Team = "cobras"
}
}
if (new Date().getMonth().toString()+new Date().getDate().toString() >= 714) { EventOngoing = false } if (new Date().getMonth().toString()+new Date().getDate().toString() >= 714) { EventOngoing = false }
if (Settings.TheGreatDivide.UnbalancedIndicatorOn === true && window.location.pathname.split('/')[1] === 'places' && window.location.pathname.split('/')[2] === '9656') { if (Settings.TheGreatDivide.UnbalancedIndicatorOn === true && window.location.pathname.split('/')[1] === 'places' && window.location.pathname.split('/')[2] === '9656') {
UnbalancedServerMarkers() UnbalancedServerMarkers()
} }
console.log('ongoing|has team', EventOngoing, HasTeam) console.log('ongoing|has team|team', EventOngoing, HasTeam, Team)
if (Settings.TheGreatDivide.UserStatsOn === true && window.location.pathname.split('/')[1] === 'u') { if (Settings.TheGreatDivide.UserStatsOn === true && window.location.pathname.split('/')[1] === 'u') {
if (HasTeam === true) { if (HasTeam === true) {
UserStatsTab() UserStatsTab()
@ -38,7 +51,7 @@
Servers.forEach(server => { Servers.forEach(server => {
const TeamCounts = { const TeamCounts = {
phantoms: server.getElementsByClassName('border-phantoms').length, phantoms: server.getElementsByClassName('border-phantoms').length,
cobras: server.getElementsByClassName('border-cobras').length cobras: server.getElementsByClassName('border-cobras').length
} }
let Enemy = "cobras" let Enemy = "cobras"
@ -65,14 +78,16 @@
} }
} }
async function UserStatsTab() { async function UserStatsTab(hasTeam) {
const EventSection = document.createElement('div') const EventSection = document.createElement('div')
EventSection.innerHTML = ` EventSection.innerHTML = `
<div class="d-grid mt-2 mb-4"></div> <div class="d-grid mt-2 mb-4"></div>
<h6 class="section-title px-3 px-lg-0"> <h6 class="text-center section-title px-3 px-lg-0 fw-bold" style="background-clip:text;-webkit-background-clip:text;color:transparent;background-image: linear-gradient(90deg, #1ad05b, #68f);-webkit-text-fill-color: transparent;">
<i class="fas fa-swords me-1"></i> Great Divide <i class="fas fa-swords me-1"></i>
GREATEST DIVISION
<i class="fas fa-swords me-1"></i>
</h6> </h6>
<div class="card mcard card-themed mb-4"> <div class="card mcard mb-4" style="min-height: 226px; background-image: linear-gradient(rgba(0.7, 0.7, 0.7, 0.7), rgba(0.7, 0.7, 0.7, 0.7)), url(${ (HasTeam === true) ? (Team === "phantoms") ? 'https://c0.ptacdn.com/assets/N3DH4x5a6iW7raaQ-3lwHpRHHpWShdXc.png' : 'https://c0.ptacdn.com/assets/1HXpaoDLHJo2rrvwwxqJEDWvDZ6BgvSE.png' : '' }); background-size: cover; background-position: center; ${HasTeam === true ? 'border: 1.25px solid ' + ((Team === "phantoms") ? 'blue' : 'green') + ' !important;' : ''}">
<div class="card-body" id="p+greatdivide_card"> <div class="card-body" id="p+greatdivide_card">
<button class="btn btn-primary btn-sm w-100">Load Statistics</button> <button class="btn btn-primary btn-sm w-100">Load Statistics</button>
</div> </div>