Skip to content

Instantly share code, notes, and snippets.

@jshawl
Last active December 15, 2015 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jshawl/5247126 to your computer and use it in GitHub Desktop.
Save jshawl/5247126 to your computer and use it in GitHub Desktop.
var doScrape = function () {
var productTemplate = "{{#.}}"
+ "<form method='post' action='SOME_URL' class='riu-form'>"
+ "<a class='riu-logo' href='http://rackituponline.com'>Rack It Up</a>"
+ "<img src='{{OrigImageURL}}' class='riu-img'>"
+ "<h1>{{Name}}</h1>"
+ "<label>Price:</label>"
+ "<input type='text' value='{{OrigPrice}}' readonly>"
+ "<label>Color:</label>"
// + "<p>Colors: {{#Colors}}{{.}}, {{/Colors}}</p>"
+ "<select>"
+ "<option>color 1</option>" // need to loop through each of {{#Colors}} and input value between <option>
+ "</select>"
+ "<label>Size:</label>
// + "<p>Sizes: {{#Sizes}}{{.}}, {{/Sizes}}</p>"
+ "<select>"
+ "<option>size 1</option>" // need to loop through each of {{#Sizes}} and input value between <option>
+ "</select>"
+ "<label>Category</label>"
+ "<select>"
+ "<option></option>" // some type of loop here, too.
+ "</select>"
+ "<label>Notify me when: </label>"
+ "<select>"
+ "<option>The price drops by $ amount</option>"
+ "<option>The price drops by % amount</option>"
+ "<option>The item goes on sale</option>"
+ "</select>"
+ "<label>Send me an alert when the price drops by $</label>" //we'll need to update that dollar sign dynamically at some point
+ "<input type='text'>"
+ "<button type='submit'>Rack It!</button>"
+ "</form>"
+ "{{/.}}",
products = riuScraper.getProducts();
$.modal(/*JSON.stringify(products) + */Mustache.render(productTemplate, products));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment