chore: remove old great divide user stats function

This commit is contained in:
Index 2024-06-28 10:34:24 -05:00
parent f9e3e5b09f
commit 0f7aea03b2

View file

@ -88,68 +88,3 @@ async function UserStatsTab() {
userID: document.querySelector('.dropdown-item.text-danger[href^="/report"]').getAttribute('href').split('?')[0].split('/')[3] userID: document.querySelector('.dropdown-item.text-danger[href^="/report"]').getAttribute('href').split('?')[0].split('/')[3]
}); });
} }
async function UserStatsTabOLD() {
const Tabs = document.getElementById('user-info-tabs')
const EventTab = document.createElement('li')
EventTab.classList = 'nav-item'
EventTab.style.marginLeft = 'auto'
EventTab.innerHTML = `
<a class="nav-link fw-semibold" href="#!" aria-selected="false" tabindex="-1" role="tab" style="background-clip:text;-webkit-background-clip:text;color:transparent;background-image: linear-gradient(90deg, #1ad05b, #68f);-webkit-text-fill-color: transparent;">
<img style="width: 25px;height: auto;" src="https://c0.ptacdn.com/static/images/misc/event/dpoint.af12a3d7.png">
Great Divide
</a>
`
Tabs.appendChild(EventTab)
const TabContainer = document.createElement('div')
TabContainer.id = 'p+greatdivide_stats'
TabContainer.classList = 'tab-pane fade d-none'
TabContainer.innerHTML = `
<small class="d-block text-center text-muted" style="font-size: 0.8rem;">
loading...
</small>
<lottie-player id="avatar-loading" src="https://c0.ptacdn.com/static/images/lottie/poly-brick-loading.2b51aa85.json" background="transparent" speed="1" style="width: 20%;height: auto;margin: -16px auto 50px;margin-top: 0px;" loop="" autoplay=""></lottie-player>
`
document.getElementById('user-friends').parentElement.appendChild(TabContainer)
const ToggleTab = function(tab){
Array.from(Tabs.children).forEach((tab) => {
tab.children[0].classList.remove('active');
});
Array.from(document.getElementById('user-friends').parentElement.children).forEach((tab) => {
tab.classList.add('d-none');
tab.classList.remove('active');
tab.classList.remove('show');
});
tab.children[0].classList.add('active');
let SelectedTab
if (tab.children[0].getAttribute('data-bs-target')) {
SelectedTab = document.getElementById(tab.children[0].getAttribute('data-bs-target').substring(1))
} else if (tab.children[0].classList.contains('fw-bold')) {
SelectedTab = TabContainer
}
SelectedTab.classList.add('active');
SelectedTab.classList.add('show');
SelectedTab.classList.remove('d-none');
}
Array.from(Tabs.children).forEach((tab) => {
tab.addEventListener('click', function () {
ToggleTab(tab)
});
});
let Fetched = false
EventTab.addEventListener('click', async function(){
if (Fetched === false) {
chrome.runtime.sendMessage({
action: "greatdivide_stats",
userID: document.querySelector('.dropdown-item.text-danger[href^="/report"]').getAttribute('href').split('?')[0].split('/')[3]
});
Fetched = true
}
})
}