Open RomeoAnchor opened 4 years ago
Recently Active is available for free. I've been trying to code that part... but I didn't have luck yet. I am a JS beginner. This is what I have so far...
`function greeny(){ const divs = Array.from(document.querySelectorAll('div')) const parentClass = 'D(f) Jc(fs) Ai(c) Fld(r) Mb(4px)' const childDivClass = 'Sq(8px) Bgc($c-active-indicator-green) Bdrs(50%) Mend(6px) My(4px)' const childSpanClass = 'C(#fff) Fz($xs)' const childSpanText = 'Recently Active'
const match = divs.filter(elem => elem.className === parentClass) .filter(elem => elem.childElementCount === 2) .filter(elem => { const firstChild = elem.firstElementChild
if (firstChild.nodeName !== 'DIV') return false return firstChild.className === childDivClass }) .filter(elem => { const lastChild = elem.lastElementChild if (lastChild.nodeName !== 'SPAN') return false return lastChild.className === childSpanClass && lastChild.textContent === childSpanText }) .length === 1
console.log(match); }
Recently Active is available for free. I've been trying to code that part... but I didn't have luck yet. I am a JS beginner. This is what I have so far...
`function greeny(){ const divs = Array.from(document.querySelectorAll('div')) const parentClass = 'D(f) Jc(fs) Ai(c) Fld(r) Mb(4px)' const childDivClass = 'Sq(8px) Bgc($c-active-indicator-green) Bdrs(50%) Mend(6px) My(4px)' const childSpanClass = 'C(#fff) Fz($xs)' const childSpanText = 'Recently Active'
const match = divs.filter(elem => elem.className === parentClass) .filter(elem => elem.childElementCount === 2) .filter(elem => { const firstChild = elem.firstElementChild
console.log(match); }