Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am sarming on github.
  • I am sarming (https://keybase.io/sarming) on keybase.
  • I have a public key ASAUa9OGo6eKkz5i10wnPaNaAt-TIYsNn22cI51XnO52iwo

To claim this, I am signing this object:

@sarming
sarming / sum.js
Created September 4, 2017 11:46
extract sum of all orders on page
function sum(query) {
function add_price(s,e) {
price = e.innerText.replace(/[^\d]*(\d+)[.,](\d+)/,"$1.$2")
return s + parseFloat(price)
}
return $$(query).reduce(add_price,0)
}
[
sum(".amount-num"), //aliexpress