This commit is contained in:
Aevann1 2022-02-01 06:01:04 +02:00
parent c2ab7be20c
commit fc080f5f49

View file

@ -33,7 +33,9 @@ function popovertrigger() {
popovertrigger() popovertrigger()
function popclick(author) { function popclick(author) {
popover = document.getElementsByClassName("popover")[0] setTimeout(() => {
let popover = document.getElementsByClassName("popover")
popover = popover[popover.length-1]
let badges = '' let badges = ''
for (const x of author["badges"]) { for (const x of author["badges"]) {
@ -48,13 +50,14 @@ function popclick(author) {
popover.getElementsByClassName('pop-coins')[0].innerHTML = author["coins"] popover.getElementsByClassName('pop-coins')[0].innerHTML = author["coins"]
popover.getElementsByClassName('pop-viewmore')[0].href = author["url"] popover.getElementsByClassName('pop-viewmore')[0].href = author["url"]
popover.getElementsByClassName('pop-badges')[0].innerHTML = badges popover.getElementsByClassName('pop-badges')[0].innerHTML = badges
; }, 1);
} }
document.addEventListener("click", function(){ document.addEventListener("click", function(){
active = document.activeElement.getAttributeNode("class"); active = document.activeElement.getAttributeNode("class");
if (!(active && active.nodeValue == "user-name text-decoration-none")){ if (active && active.nodeValue == "user-name text-decoration-none"){
let pop = document.getElementByClassName("popover") pops = document.getElementsByClassName('popover')
pop = pop[pop.length-1] if (pops.length > 1) pops[0].remove()
if (pop) document.body.removeChild(pop);
} }
else document.querySelectorAll('.popover').forEach(e => e.remove());
}); });