Skip to content

Instantly share code, notes, and snippets.

@Jonarzz
Last active December 9, 2019 18:34
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 Jonarzz/6cf42259a6bfb93bb1895999a6167057 to your computer and use it in GitHub Desktop.
Save Jonarzz/6cf42259a6bfb93bb1895999a6167057 to your computer and use it in GitHub Desktop.
// 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