Last active
February 22, 2019 19:17
-
-
Save arvidkahl/009d06f8177912c696a6cd147f949ffa to your computer and use it in GitHub Desktop.
Sum up the prices in an Amazon Wish List Print View
This file contains 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
// 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