Last active
December 9, 2019 18:34
-
-
Save Jonarzz/6cf42259a6bfb93bb1895999a6167057 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
// appends an Untappd link to each of search results on SmakPiwa.pl site | |
const titles = Array.from(document.querySelectorAll('h3.abs-product-name')); | |
titles.forEach(title => { | |
const untappdLink = document.createElement('a'); | |
untappdLink.innerText = '[UT]'; | |
untappdLink.target = '_blank'; | |
const name = title.innerText.replace(/[^\S ]+/g, ' ').replace('(puszka)', '').replace(/\d+( ml)?/g, ''); | |
untappdLink.href = 'https://untappd.com/search?q=' + name.split(' ').join('+'); | |
title.appendChild(untappdLink); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment