Last active
January 26, 2017 02:37
-
-
Save davemasse/0d75cfde47dd4a826efadf0d9d6de3fe to your computer and use it in GitHub Desktop.
Calculate the total dollar amount of the visible Amazon.com registry
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
(function ($) { | |
$(function () { | |
var total = 0; | |
var preg = new RegExp(/[^0-9.]/g); | |
$("[id^='item_price'] .a-color-price").each(function () { | |
total += parseFloat($(this).text().replace(preg, "")); | |
}); | |
console.log(total); | |
}); | |
})(jQuery); |
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
javascript:(function(e,a,g,h,f,c,b,d)%7Bif(!(f%3De.jQuery)%7C%7Cg>f.fn.jquery%7C%7Ch(f))%7Bc%3Da.createElement("script")%3Bc.type%3D"text/javascript"%3Bc.src%3D"https://ajax.googleapis.com/ajax/libs/jquery/"%2Bg%2B"/jquery.min.js"%3Bc.onload%3Dc.onreadystatechange%3Dfunction()%7Bif(!b%26%26(!(d%3Dthis.readyState)%7C%7Cd%3D%3D"loaded"%7C%7Cd%3D%3D"complete"))%7Bh((f%3De.jQuery).noConflict(1),b%3D1)%3Bf(c).remove()%7D%7D%3Ba.documentElement.childNodes%5B0%5D.appendChild(c)%7D%7D)(window,document,"3.1.1",function(%24,L)%7B %24(function () %7B var total %3D 0%3B var preg %3D new RegExp(/%5B%5E0-9.%5D/g)%3B %24("%5Bid%5E%3D%27item_price%27%5D .a-color-price").each(function () %7B total %2B%3D parseFloat(%24(this).text().replace(preg, ""))%3B %7D)%3B alert(total)%3B %7D)%3B%7D)%3B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment