Skip to content

Instantly share code, notes, and snippets.

@arvidkahl
Last active February 22, 2019 19:17
Show Gist options
  • Save arvidkahl/009d06f8177912c696a6cd147f949ffa to your computer and use it in GitHub Desktop.
Save arvidkahl/009d06f8177912c696a6cd147f949ffa to your computer and use it in GitHub Desktop.
Sum up the prices in an Amazon Wish List Print View
// Make sure to pass the correct currency symbol, three-letter-name and your locale
(function(currency='$', currencyName='USD', locale='en-US'){return (Math.ceil(100*Array.prototype.slice.call(document.getElementsByTagName('span')).reduce((acc,item,index,src)=>{if(item.innerText.indexOf(currency)>-1){return acc+parseFloat(item.innerText.replace(/,/g,'.').replace(RegExp(currency, "g"),''))}else{return acc}}, 0.0))/100).toLocaleString(locale,{style: 'currency',currency: currencyName,});})("€", "EUR", "de-DE")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment