Skip to content

Instantly share code, notes, and snippets.

@UnluckyNinja
Created June 23, 2022 23:16
Show Gist options
  • Save UnluckyNinja/2a53dc28b862bea3e2e3b422ab3f0d9d to your computer and use it in GitHub Desktop.
Save UnluckyNinja/2a53dc28b862bea3e2e3b422ab3f0d9d to your computer and use it in GitHub Desktop.
It goes through each category on current page and highlight result for you.
(async function(){
document.head.insertAdjacentHTML('beforeend',`<style>.waves {animation: shockwave 2s infinite;border-style: solid;border-color: red;position: absolute;border-width: 12px;filter: blur(2px);pointer-events: none;z-index: 100;box-sizing: border-box;}@keyframes shockwave {0% {opacity: 0%;-webkit-transform: scale(130%);transform: scale(130%);}20% {opacity: 80%;}80% {opacity: 80%;}100% {opacity: 0%;-webkit-transform: scale(100%);transform: scale(100%);}}</style>`);
let _$$ = $$
let found = false
let ele
for (let tab of [..._$$('.SaleSectionTabs .SaleTab')]){
tab.click()
await new Promise(res=>setTimeout(()=>res(), 1000))
window.scroll({ top: document.body.scrollHeight, behavior: 'smooth' })
await new Promise(res=>setTimeout(()=>res(), 2000))
let target = _$$('a.Focusable:not([href])')
if (target.length > 0){
found = true
ele = target[0]
ele.scrollIntoView()
function createHL(num=0){
const hl = document.createElement('div')
hl.classList.add('waves')
hl.style['animation-delay'] = `${0.4*num}s`
const t = ele.parentElement.parentElement.parentElement
const rect = ele.getBoundingClientRect()
hl.style.top = rect.top + window.scrollY + 'px'
hl.style.left = rect.left + window.scrollX + 'px'
hl.style.width = rect.width + 'px'
hl.style.height = rect.height + 'px'
document.body.appendChild(hl)
}
ele.style.position = 'relative'
createHL(0);createHL(1);createHL(2);
break
}
}
if (!found) alert("Found nothing. Have you already clicked it?")
else console.log(ele)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment