Last active
August 29, 2015 14:06
-
-
Save Widdershin/40c8bf8172a8ef0da127 to your computer and use it in GitHub Desktop.
Countdown Cart ID Extractor
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
products = $('.product-stamp-body'); | |
productDataExtractor = function (index, item) { | |
quantity = parseFloat($(".quantity-container").eq(index).text(), 10); | |
url = $(item).find(".details-container a").attr('href'); | |
itemID = parseInt(/\d{5,7}/.exec(url)[0]); | |
return [[itemID, quantity]]; | |
} | |
JSON.stringify($.makeArray(products.map(productDataExtractor))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment