Skip to content

Instantly share code, notes, and snippets.

@the-glima
Last active April 23, 2022 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the-glima/802a82017a80bbcf02898ad5d72a7941 to your computer and use it in GitHub Desktop.
Save the-glima/802a82017a80bbcf02898ad5d72a7941 to your computer and use it in GitHub Desktop.
var findStore = (store) => {
return $$('.estoque-linha .e-col1 > img').find(item => {
var storeName = item.getAttribute('title')
var regex = new RegExp(store,'gi')
console.log(storeName, storeName.match(regex))
console.log(regex)
if (storeName.match(regex))
return item
}
)
}
var scrollToStore = (store) => {
var store = findStore(store)
if (!store) return
store.scrollIntoView({ behavior: 'smooth' });
}
var goToStore = (store) => {
$$('.exibir-mais').forEach(btn => {
var click = btn.onclick
click(scrollToStore(store))
})
}
goToStore('arena')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment