Last active
April 23, 2022 13:44
-
-
Save the-glima/802a82017a80bbcf02898ad5d72a7941 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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