I'm working on a Greasemonkey script, and would like to tally a specific value from an attribute. Problem is, the attribute values I want are paginated. I've tried changing the URL to see if it can list everything in one page, but no luck. It always limits to a view of only 40 per page.
I was wondering if the best way to achieve this is by incrementing a value in the URL, by using an if and then statement.
For instance, if a certain element is present (.standard-row), the start=0 in the URL will increment by 40 to start=40, then automatically reload the incremented URL and scan again, if the specific element (.standard-row) is present again, increment by another 40, to start=80. All the while storing the attribute values its fetching from each page.
When the specific element (.standard-row) is no longer visible, it will move onto tallying the attribute values it collected.
Below is the URL I'm trying to increment. The portion of the URL I would like to increment is "start=".
https://play.google.com/store/account?start=0&num=40
The code I listed below is what I'm using to tally the attribute value. It works great for one page, however, I would like to fetch all the attribute values from the paginated pages. If possible.
var total = 0;
$("#tab-body-account .rap-link").each(function() {
var price = +($(this).attr("data-docprice").replace(/[^\d\.]/g, ""));
total += price;
});
$('.tabbed-panel-tab').before('<div id="SumTotal">*Combined Value: $'+ total.toFixed(2) +'</div>');
Thanks in advance for any advice.