Created
December 22, 2013 02:43
-
-
Save israelshirk/8077857 to your computer and use it in GitHub Desktop.
Extract prices from Photoshelter pricing page
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
| var varsToSelectors = { | |
| size: ["td.groupCat.size", "html"], | |
| name: ["td.name", "html"], | |
| vendor: ["td.vendor", "html"], | |
| 'type': ["td.type", "html"], | |
| finishes: ["td.finishes", "html"], | |
| wholesale: ["td.wholesale", "html"], | |
| price: ["td.price input:first", "val"] | |
| } | |
| jQuery("tr.USER.priced").each(function() { | |
| var jThis = jQuery(this); | |
| result = {}; | |
| for (var column in varsToSelectors) { | |
| field = jThis.find(varsToSelectors[column][0]); | |
| if (varsToSelectors[column][1] == "html") { | |
| result[column] = field.html(); | |
| } else { | |
| result[column] = field.val(); | |
| } | |
| } | |
| console.dir(JSON.stringify(result)); | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment