/*
get nutrition facts for food item (e.g. 1 banana)
show image of food item
determine how much user should eat, if at all
add food item to daily food journal/tracker
count nutrition values & show how much of each primary (and secondary) nutrients they need to reach daily recommendation (or how much they've exceeded it by)
are they at healthy level, safe level, or in danger (health meter)
suggest food items as user enters search term
have user check if food belongs to standard / branded data source, and filter results based on that
user profile: health condition, history, age, gender
*/
var search = $( "input[name='search']");
var food_Item = search.val();
var QUERY_LIMIT = 5;
var NUTRIENT_QUERY_MAX = 100;
var NAMES_OF_STANDARD_NUTRIENTS = ["Sodium, NA", "Sugars, total", "Protein", "Carbohydrate, by difference", "Cholesterol", "Fatty acids, total trans", "Fatty acids, total saturated", "Fiber, total dietary", "Calcium, Ca", "Potassium, K"];
var Google_API_Key = 'AIzaSyChFmxcotyJD1iIKw0WL-uy2AXO7o5xF9Q';
var Google_Search_Engine_Id = '012029723201963103841:tmf9zdgfp_k';
/************************************* FIRST SCREEN - COLLECT USER INFO *****************************************/
var name = $('#userName');
var submit = $('#submit');
var q1 = $('#q1');
var q2 = $('#q2');
var prompt = $('#prompt');
var field = $('#field');
/* USER PROFILE */
var user = {};
// $(document).ready(function() {
// submitName().then(function(name) {
// submitAge()}).then(function(age) {
// submitCondition();
// });
// });
function updateAgeInput(val) {
$('#textInput').html(val);
}
submitName().then(function(name) {
// prompt.html(`Hello ${user.name}! How old are you?`);
submitAge()
}).then(function(age) {
// console.log('yo');
user.age = age;
// console.log(user);
submitCondition()
}).done(function() {
profileComplete();
// console.log(user);
});
function submitName() {
var dfd = $.Deferred();
// var...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.