forked from nutritionix/nutrition-label
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nutritionLabel-min.js
22 lines (22 loc) · 167 KB
/
nutritionLabel-min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
***************************************************************************************************************************************************+
* NUTRITIONIX.com |
* |
* This plugin allows you to create a fully customizable nutrition label |
* |
* @authors Leo Joseph Gajitos <leejay22@gmail.com>, Rommel Malang <genesis23rd@gmail.com> and Yurko Fedoriv <yurko.fedoriv@gmail.com> |
* @copyright Copyright (c) 2017 Nutritionix. |
* @license This Nutritionix jQuery Nutrition Label is dual licensed under the MIT and GPL licenses. |
* @link http://www.nutritionix.com |
* @github http://github.com/nutritionix/nutrition-label |
* @current version 8.1.0 |
* @stable version 8.0.5 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source
* @description modified to include additional vitamins and calculation options
* |
***************************************************************************************************************************************************+
*/
(function($){$.fn.nutritionLabel=function(option,settings){if(typeof option==="object"){settings=option;init(settings,$(this))}else if(typeof option==="string"&&option!==""){if(option==="destroy"){(new NutritionLabel).destroy($(this))}else if(option==="hide"){(new NutritionLabel).hide($(this))}else if(option==="show"){(new NutritionLabel).show($(this))}else{var values=[];var elements=this.each(function(){var data=$(this).data("_nutritionLabel");if(data){if($.fn.nutritionLabel.defaultSettings[option]!==undefined){if(settings!==undefined){data.settings[option]=settings;init(data.settings,$(this))}else{values.push(data.settings[option])}}}else if($.fn.nutritionLabel.defaultSettings[option]!==undefined){if(settings!==undefined){$.fn.nutritionLabel.defaultSettings[option]=settings;init(null,$(this))}}});if(values.length===1){return values[0]}return values.length>0?values:elements}}else if(typeof option==="undefined"||option===""){init(settings,$(this))}};$.fn.nutritionLabel.defaultSettings={width:280,allowCustomWidth:false,widthCustom:"auto",allowNoBorder:false,allowFDARounding:false,useMassForVitamins:false,allowGoogleAnalyticsEventLog:false,gooleAnalyticsFunctionName:"ga",userFunctionNameOnQuantityChange:null,userFunctionOnQuantityChange:null,hideNotApplicableValues:false,hidePercentDailyValues:false,brandName:"Brand where this item belongs to",scrollLongIngredients:false,scrollHeightComparison:100,scrollHeightPixel:95,decimalPlacesForNutrition:1,decimalPlacesForDailyValues:0,decimalPlacesForQuantityTextbox:1,scrollLongItemName:true,scrollLongItemNamePixel:36,scrollLongItemNamePixel2018Override:34,showBottomLink:false,urlBottomLink:"http://www.nutritionix.com",nameBottomLink:"Nutritionix",valueServingUnitQuantity:1,valueServingSizeUnit:"",showServingUnitQuantityTextbox:true,itemName:"Item / Ingredient Name",showServingUnitQuantity:true,hideTextboxArrows:false,originalServingUnitQuantity:0,nutritionValueMultiplier:1,totalContainerQuantity:1,calorieIntake:2e3,dailyValueTotalFat:65,dailyValueSatFat:20,dailyValueCholesterol:300,dailyValueSodium:2400,dailyValuePotassium:3500,dailyValuePotassium_2018:4700,dailyValueCarb:300,dailyValueFiber:25,dailyValueCalcium:1300,dailyValueIron:18,dailyValueVitaminD:20,dailyValueAddedSugar:50,dailyValueVitaminA_2018:5e3,dailyValueVitaminC_2018:60,dailyValueVitaminE:30,dailyValueVitaminK:80,dailyValueThiamin:1.5,dailyValueRiboflavin:1.7,dailyValueNiacin:20,dailyValueVitaminB6:2,dailyValueFolate:400,dailyValueVitaminB12:6,dailyValueBiotin:300,dailyValuePantothenicAcid:10,dailyValuePhosphorus:1e3,dailyValueIodine:150,dailyValueMagnesium:400,dailyValueZinc:15,dailyValueSelenium:70,dailyValueCopper:2,dailyValueManganese:2,dailyValueChromium:120,dailyValueMolybdenum:75,dailyValueChloride:3400,showCalories:true,showFatCalories:true,showTotalFat:true,showSatFat:true,showTransFat:true,showPolyFat:false,showMonoFat:false,showCholesterol:true,showSodium:true,showPotassium:false,showPotassium_2018:true,showTotalCarb:true,showFibers:true,showSugars:true,showAddedSugars:true,showSugarAlcohol:false,showProteins:true,showVitaminA:true,showVitaminA_2018:false,showVitaminC:true,showVitaminC_2018:false,showVitaminD:true,showCalcium:true,showIron:true,showVitaminE:false,showVitaminK:false,showThiamin:false,showRiboflavin:false,showNiacin:false,showVitaminB6:false,showFolate:false,showVitaminB12:false,showBiotin:false,showPantothenicAcid:false,showPhosphorus:false,showIodine:false,showMagnesium:false,showZinc:false,showSelenium:false,showCopper:false,showManganese:false,showChromium:false,showMolybdenum:false,showChloride:false,showAmountPerServing:true,showServingsPerContainer:false,showItemName:true,showBrandName:false,showIngredients:true,showCalorieDiet:false,showCustomFooter:false,showDisclaimer:false,scrollDisclaimerHeightComparison:100,scrollDisclaimer:95,valueDisclaimer:"Please note that these nutrition values are estimated based on our standard serving portions. "+"As food servings may have a slight variance each time you visit, please expect these values to be with in 10% +/- of your actual meal. "+"If you have any questions about our nutrition calculator, please contact Nutritionix.",ingredientLabel:"INGREDIENTS:",valueCustomFooter:"",naCalories:false,naFatCalories:false,naTotalFat:false,naSatFat:false,naTransFat:false,naPolyFat:false,naMonoFat:false,naCholesterol:false,naSodium:false,naPotassium:false,naPotassium_2018:false,naTotalCarb:false,naFibers:false,naSugars:false,naAddedSugars:false,naSugarAlcohol:false,naProteins:false,naVitaminA:false,naVitaminA_2018:false,naVitaminC:false,naVitaminC_2018:false,naVitaminD:false,naCalcium:false,naIron:false,naVitaminE:false,naVitaminK:false,naThiamin:false,naRiboflavin:false,naNiacin:false,naVitaminB6:false,naFolate:false,naVitaminB12:false,naBiotin:false,naPantothenicAcid:false,naPhosphorus:false,naIodine:false,naMagnesium:false,naZinc:false,naSelenium:false,naCopper:false,naManganese:false,naChromium:false,naMolybdenum:false,naChloride:false,valueServingWeightGrams:0,valueServingPerContainer:1,valueCalories:0,valueFatCalories:0,valueTotalFat:0,valueSatFat:0,valueTransFat:0,valuePolyFat:0,valueMonoFat:0,valueCholesterol:0,valueSodium:0,valuePotassium:0,valuePotassium_2018:0,valueTotalCarb:0,valueFibers:0,valueSugars:0,valueAddedSugars:0,valueSugarAlcohol:0,valueProteins:0,valueVitaminA:0,valueVitaminA_2018:0,valueVitaminC:0,valueVitaminC_2018:0,valueVitaminD:0,valueCalcium:0,valueIron:0,valueVitaminE:0,valueVitaminK:0,valueThiamin:0,valueRiboflavin:0,valueNiacin:0,valueVitaminB6:0,valueFolate:0,valueVitaminB12:0,valueBiotin:0,valuePantothenicAcid:0,valuePhosphorus:0,valueIodine:0,valueMagnesium:0,valueZinc:0,valueSelenium:0,valueCopper:0,valueManganese:0,valueChromium:0,valueMolybdenum:0,valueChloride:0,unitCalories:"",unitFatCalories:"",unitTotalFat:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitSatFat:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitTransFat:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitPolyFat:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitMonoFat:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitCholesterol:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitSodium:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitPotassium:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitPotassium_base:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitPotassium_percent:"%",unitTotalCarb:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitFibers:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitSugars:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitAddedSugars:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitSugarAlcohol:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitProteins:'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>',unitVitaminA:"%",unitVitaminA_base:'<span aria-hidden="true"> IU</span><span class="sr-only"> international units</span>',unitVitaminA_percent:"%",unitVitaminC:"%",unitVitaminC_base:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitVitaminC_percent:"%",unitVitaminD_base:'<span aria-hidden="true">mcg</span><span class="sr-only"> micrograms</span>',unitVitaminD_percent:"%",unitCalcium:"%",unitCalcium_base:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitCalcium_percent:"%",unitIron:"%",unitIron_base:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitIron_percent:"%",unitVitaminE_base:'<span aria-hidden="true"> IU</span><span class="sr-only"> international units</span>',unitVitaminE_percent:"%",unitVitaminK_base:'<span aria-hidden="true"> IU</span><span class="sr-only"> international units</span>',unitVitaminK_percent:"%",unitThiamin_base:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitThiamin_percent:"%",unitRiboflavin_base:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitRiboflavin_percent:"%",unitNiacin_base:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitNiacin_percent:"%",unitVitaminB6_base:'<span aria-hidden="true">mg</span><span class="sr-only"> milligrams</span>',unitVitaminB6_percent:"%",unitFolate_base:'<span aria-hidden="true">┬╡g</span><span class="sr-only"> micrograms</span>',unitFolate_percent:"%",unitVitaminB12_base:'<span aria-hidden="true">┬╡g</span><span class="sr-only"> micrograms</span>',unitVitaminB12_percent:"%",unitBiotin_base:'<span aria-hidden="true">┬╡g</span><span class="sr-only"> micrograms</span>',unitBiotin_percent:"%",unitPantothenicAcid_base:'<span aria-hidden="true">mg</span><span class="sr-only"> micrograms</span>',unitPantothenicAcid_percent:"%",unitPhosphorus_base:'<span aria-hidden="true">mg</span><span class="sr-only"> micrograms</span>',unitPhosphorus_percent:"%",unitIodine_base:'<span aria-hidden="true">┬╡g</span><span class="sr-only"> micrograms</span>',unitIodine_percent:"%",unitMagnesium_base:'<span aria-hidden="true">mg</span><span class="sr-only"> micrograms</span>',unitMagnesium_percent:"%",unitZinc_base:'<span aria-hidden="true">mg</span><span class="sr-only"> micrograms</span>',unitZinc_percent:"%",unitSelenium_base:'<span aria-hidden="true">┬╡g</span><span class="sr-only"> micrograms</span>',unitSelenium_percent:"%",unitCopper_base:'<span aria-hidden="true">mg</span><span class="sr-only"> micrograms</span>',unitCopper_percent:"%",unitManganese_base:'<span aria-hidden="true">mg</span><span class="sr-only"> micrograms</span>',unitManganese_percent:"%",unitChromium_base:'<span aria-hidden="true">┬╡g</span><span class="sr-only"> micrograms</span>',unitChromium_percent:"%",unitMolybdenum_base:'<span aria-hidden="true">┬╡g</span><span class="sr-only"> micrograms</span>',unitMolybdenum_percent:"%",unitChloride_base:'<span aria-hidden="true">mg</span><span class="sr-only"> micrograms</span>',unitChloride_percent:"%",valueCol1CalorieDiet:2e3,valueCol2CalorieDiet:2500,valueCol1DietaryTotalFat:0,valueCol2DietaryTotalFat:0,valueCol1DietarySatFat:0,valueCol2DietarySatFat:0,valueCol1DietaryCholesterol:0,valueCol2DietaryCholesterol:0,valueCol1DietarySodium:0,valueCol2DietarySodium:0,valueCol1DietaryPotassium:0,valueCol2DietaryPotassium:0,valueCol1DietaryTotalCarb:0,valueCol2DietaryTotalCarb:0,valueCol1Dietary:0,valueCol2Dietary:0,textNutritionFacts:"Nutrition Facts",textDailyValues:"Daily Value",textServingSize:"Serving Size:",textServingsPerContainer:"Servings Per Container",textAmountPerServing:"Amount Per Serving",textCalories:"Calories",textFatCalories:"Calories from Fat",textTotalFat:"Total Fat",textSatFat:"Saturated Fat",textTransFat:"<em>Trans</em> Fat",textPolyFat:"Polyunsaturated Fat",textMonoFat:"Monounsaturated Fat",textCholesterol:"Cholesterol",textSodium:"Sodium",textPotassium:"Potassium",textTotalCarb:"Total Carbohydrates",textFibers:"Dietary Fiber",textSugars:"Sugars",textAddedSugars1:"Includes ",textAddedSugars2:" Added Sugars",textSugarAlcohol:"Sugar Alcohol",textProteins:"Protein",textVitaminA:"Vitamin A",textVitaminC:"Vitamin C",textVitaminD:"Vitamin D",textCalcium:"Calcium",textIron:"Iron",textVitaminE:"Vitamin E",textVitaminK:"Vitamin K",textThiamin:"Thiamin",textRiboflavin:"Riboflavin",textNiacin:"Niacin",textVitaminB6:"Vitamin B<sub>6</sub>",textFolate:"Folate",textVitaminB12:"Vitamin B<sub>12</sub>",textBiotin:"Biotin",textPantothenicAcid:"Pantothenic Acid",textPhosphorus:"Phosphorus",textIodine:"Iodine",textMagnesium:"Magnesium",textZinc:"Zinc",textSelenium:"Selenium",textCopper:"Copper",textManganese:"Manganese",textChromium:"Chromium",textMolybdenum:"Molybdenum",textChloride:"Chloride",textNotApplicable:"-",ingredientList:"None",textPercentDailyPart1:"Percent Daily Values are based on a",textPercentDailyPart2:"calorie diet",textPercentDaily2018VersionPart1:"The % Daily Value (DV) tells you how much a nutrient in a serving of food contributes to a daily diet. ",textPercentDaily2018VersionPart2:" calories a day is used for general nutrition advice.",textGoogleAnalyticsEventCategory:"Nutrition Label",textGoogleAnalyticsEventActionUpArrow:"Quantity Up Arrow Clicked",textGoogleAnalyticsEventActionDownArrow:"Quantity Down Arrow Clicked",textGoogleAnalyticsEventActionTextbox:"Quantity Textbox Changed",showLegacyVersion:true,legacyVersion:1};function NutritionLabel(settings,$elem){this.nutritionLabel=null;this.settings=settings;this.$elem=$elem;return this}function cleanSettings(settings){var numericIndex=["width","scrollHeightComparison","scrollHeightPixel","decimalPlacesForNutrition","decimalPlacesForDailyValues","calorieIntake","dailyValueTotalFat","dailyValueSatFat","dailyValueCholesterol","dailyValueSodium","dailyValuePotassium","dailyValueCarb","dailyValueFiber","valueServingSize","valueServingWeightGrams","valueServingPerContainer","valueCalories","valueFatCalories","valueTotalFat","valueSatFat","valueTransFat","valuePolyFat","valueMonoFat","valueCholesterol","valueSodium","valuePotassium","valueTotalCarb","valueFibers","valueSugars","valueProteins","valueVitaminA","valueVitaminC","valueCalcium","valueIron","valueCol1CalorieDiet","valueCol2CalorieDiet","valueCol1DietaryTotalFat","valueCol2DietaryTotalFat","valueCol1DietarySatFat","valueCol2DietarySatFat","valueCol1DietaryCholesterol","valueCol2DietaryCholesterol","valueCol1DietarySodium","valueCol2DietarySodium","valueCol1DietaryPotassium","valueCol2DietaryPotassium","valueCol1DietaryTotalCarb","valueCol2DietaryTotalCarb","valueCol1Dietary","valueCol2Dietary","valueServingUnitQuantity","scrollLongItemNamePixel","scrollLongItemNamePixel2018Override","decimalPlacesForQuantityTextbox","valueAddedSugars","dailyValueVitaminD","dailyValueCalcium","dailyValueIron","valueVitaminD","valueSugarAlcohol"];$.each(settings,function(index,value){if(jQuery.inArray(index,numericIndex)!==-1){settings[index]=parseFloat(settings[index]);if(isNaN(settings[index])||settings[index]===undefined){settings[index]=0}}});if(settings["valueServingUnitQuantity"]<0){settings["valueServingUnitQuantity"]=0}return settings}function updateNutritionValueWithMultiplier(settings){var nutritionIndex=["valueCalories","valueFatCalories","valueTotalFat","valueSatFat","valueTransFat","valuePolyFat","valueMonoFat","valueCholesterol","valueSodium","valuePotassium","valueTotalCarb","valueFibers","valueSugars","valueProteins","valueVitaminA","valueVitaminC","valueCalcium","valueIron","valueServingWeightGrams","valueAddedSugars","valueVitaminD","valuePotassium_2018","valueSugarAlcohol"];$.each(settings,function(index,value){if(jQuery.inArray(index,nutritionIndex)!==-1){settings[index]=parseFloat(settings[index]);if(isNaN(settings[index])||settings[index]===undefined){settings[index]=0}settings[index]=parseFloat(settings[index])*parseFloat(settings["valueServingUnitQuantity"])*parseFloat(settings["nutritionValueMultiplier"])}});if(parseFloat(settings["valueServingUnitQuantity"])==0){settings["valueServingPerContainer"]=0}else if(!isNaN(settings["valueServingPerContainer"])&&settings["valueServingPerContainer"]!=undefined){settings["valueServingPerContainer"]=parseFloat(settings.totalContainerQuantity)/parseFloat(settings["valueServingUnitQuantity"])}return settings}function init(settings,$elem){var $settings=$.extend({},$.fn.nutritionLabel.defaultSettings,settings||{});$settings.totalContainerQuantity=parseFloat($settings.valueServingPerContainer)*parseFloat($settings["valueServingUnitQuantity"]);var $originalCleanSettings=cleanSettings($.extend({},$.fn.nutritionLabel.defaultSettings,settings||{}));$originalCleanSettings.totalContainerQuantity=parseFloat($originalCleanSettings.valueServingPerContainer)*parseFloat($originalCleanSettings["valueServingUnitQuantity"]);$settings=cleanSettings($settings);$originalCleanSettings=cleanSettings($originalCleanSettings);$settings.nutritionValueMultiplier=$settings.valueServingUnitQuantity<=0?1:1/$settings.valueServingUnitQuantity;var $updatedsettings=updateNutritionValueWithMultiplier($settings);$settings.originalServingUnitQuantity=$updatedsettings.valueServingUnitQuantity;if($updatedsettings.valueServingUnitQuantity<=0){$originalCleanSettings.valueServingUnitQuantity=1;$updatedsettings=updateNutritionValueWithMultiplier($originalCleanSettings);$updatedsettings.valueServingUnitQuantity=1}var nutritionLabel=new NutritionLabel($updatedsettings,$elem);if($updatedsettings.showLegacyVersion){updateValuesAfterAQuantityChanged($settings,nutritionLabel,$elem,true,true);if($settings.showServingUnitQuantityTextbox){$("#"+$elem.attr("id")).delegate(".unitQuantityUp","click",function(e){e.preventDefault();changeQuantityByArrow($(this),1,updateTheSettingsAfterAnEvent($settings,settings),nutritionLabel,$elem,true)});$("#"+$elem.attr("id")).delegate(".unitQuantityDown","click",function(e){e.preventDefault();changeQuantityByArrow($(this),-1,updateTheSettingsAfterAnEvent($settings,settings),nutritionLabel,$elem,true)});$("#"+$elem.attr("id")).delegate(".unitQuantityBox","change",function(e){e.preventDefault();changeQuantityTextbox($(this),updateTheSettingsAfterAnEvent($settings,settings),nutritionLabel,$elem,true)});$("#"+$elem.attr("id")).delegate(".unitQuantityBox","keydown",function(e){if(e.keyCode==13){e.preventDefault();changeQuantityTextbox($(this),updateTheSettingsAfterAnEvent($settings,settings),nutritionLabel,$elem,true)}})}}else{updateValuesAfterAQuantityChanged($settings,nutritionLabel,$elem,false,true);if($settings.showServingUnitQuantityTextbox){$("#"+$elem.attr("id")).delegate("div.nf-unitQuantityUp","click",function(e){e.preventDefault();changeQuantityByArrow($(this),1,updateTheSettingsAfterAnEvent($settings,settings),nutritionLabel,$elem,false)});$("#"+$elem.attr("id")).delegate("div.nf-unitQuantityDown","click",function(e){e.preventDefault();changeQuantityByArrow($(this),-1,updateTheSettingsAfterAnEvent($settings,settings),nutritionLabel,$elem,false)});$("#"+$elem.attr("id")).delegate(".nf-unitQuantityBox","change",function(e){e.preventDefault();changeQuantityTextbox($(this),updateTheSettingsAfterAnEvent($settings,settings),nutritionLabel,$elem,false)});$("#"+$elem.attr("id")).delegate(".nf-unitQuantityBox","keydown",function(e){if(e.keyCode==13){e.preventDefault();changeQuantityTextbox($(this),updateTheSettingsAfterAnEvent($settings,settings),nutritionLabel,$elem,false)}})}}$elem.data("_nutritionLabel",nutritionLabel)}function updateTheSettingsAfterAnEvent($localSettings,localSettings){var $localSettingsHolder=cleanSettings($.extend({},$.fn.nutritionLabel.defaultSettings,localSettings||{}));$localSettingsHolder.originalServingUnitQuantity=$localSettings.originalServingUnitQuantity;$localSettingsHolder.totalContainerQuantity=$localSettings.totalContainerQuantity;$localSettingsHolder.nutritionValueMultiplier=$localSettingsHolder.valueServingUnitQuantity<=0?1:1/$localSettingsHolder.valueServingUnitQuantity;return $localSettingsHolder}function addScrollToItemDiv($elem,$settings,localNameClass,forLegacyLabel){var local_scrollLongItemNamePixel=parseInt($settings.scrollLongItemNamePixel);if(!forLegacyLabel){local_scrollLongItemNamePixel=parseInt($settings.scrollLongItemNamePixel2018Override)}if($("#"+$elem.attr("id")+" ."+localNameClass+".inline").val()!=undefined){if($("#"+$elem.attr("id")+" ."+localNameClass+".inline").height()>local_scrollLongItemNamePixel+1){$("#"+$elem.attr("id")+" ."+localNameClass+".inline").css({"margin-left":"3.90em",height:local_scrollLongItemNamePixel+"px","overflow-y":"auto"})}}else{if(forLegacyLabel){if($("#"+$elem.attr("id")+" ."+localNameClass).height()>local_scrollLongItemNamePixel+1){$("#"+$elem.attr("id")+" ."+localNameClass).css({height:local_scrollLongItemNamePixel+"px","overflow-y":"auto"})}}else{if($("#"+$elem.attr("id")+" ."+localNameClass+" div").height()>=local_scrollLongItemNamePixel+1){$("#"+$elem.attr("id")+" ."+localNameClass+" div").css({height:local_scrollLongItemNamePixel+"px","overflow-y":"auto"})}}}}function notApplicableHover($elem){if($elem.attr("id")!==undefined&&$elem.attr("id")!==""){$("#"+$elem.attr("id")+" .notApplicable").hover(function(){$("#"+$elem.attr("id")+" .naTooltip").css({top:$(this).position().top+"px",left:$(this).position().left+10+"px"}).show()},function(){$("#"+$elem.attr("id")+" .naTooltip").hide()})}else{$("#"+$elem.attr("id")+" .notApplicable").hover(function(){$(".naTooltip").css({top:$(this).position().top+"px",left:$(this).position().left+10+"px"}).show()},function(){$(".naTooltip").hide()})}}function updateScrollingFeature($localElem,$localSettings,localIDToScroll,localScrollHeightComparison,localScrollHeight){if($localElem.attr("id")!==undefined&&$localElem.attr("id")!==""){$parentElement=$("#"+$localElem.attr("id")+" #"+localIDToScroll).parent()}else{$parentElement=$("#"+localIDToScroll).parent()}if($parentElement.innerHeight()>localScrollHeightComparison){$parentElement.addClass("scroll").css({height:localScrollHeight+"px"})}}function updateValuesAfterAQuantityChanged($localSettings,nutritionLabel,$elem,forLegacyLabel,forInitialization){var ingredientListID="ingredientList";var calcDisclaimerTextID="calcDisclaimerText";var nameElementClass="name";if(!forLegacyLabel){ingredientListID="nf-ingredientList";calcDisclaimerTextID="nf-calcDisclaimerText";nameElementClass="nf-item-name"}if(!forInitialization){$localSettings=updateNutritionValueWithMultiplier($localSettings);nutritionLabel=new NutritionLabel($localSettings,$elem)}if(forLegacyLabel){$elem.html(nutritionLabel.generateLegacy())}else{$elem.html(nutritionLabel.generate2018())}if($localSettings.showIngredients&&$localSettings.scrollLongIngredients){updateScrollingFeature($elem,$localSettings,ingredientListID,$localSettings.scrollHeightComparison,$localSettings.scrollHeightPixel)}if($localSettings.showDisclaimer){updateScrollingFeature($elem,$localSettings,calcDisclaimerTextID,$localSettings.scrollDisclaimerHeightComparison,$localSettings.scrollDisclaimer)}notApplicableHover($elem);if($localSettings.scrollLongItemName){addScrollToItemDiv($elem,$localSettings,nameElementClass,forLegacyLabel)}if(!forInitialization){return $localSettings}}function handleQuantityChange($localSettings,source,previousValue,newValue){var handler;if($localSettings.userFunctionOnQuantityChange){handler=$localSettings.userFunctionOnQuantityChange}else if($localSettings.userFunctionNameOnQuantityChange){handler=window[$localSettings.userFunctionNameOnQuantityChange]}if(typeof handler==="function"){handler(source,previousValue,newValue)}}function changeQuantityTextbox($thisTextbox,$localSettings,nutritionLabel,$elem,forLegacyLabel){var nixLabelBeforeQuantityID="nixLabelBeforeQuantity";if(!forLegacyLabel){nixLabelBeforeQuantityID="nf-nixLabelBeforeQuantity"}var previousValue=parseFloat($("#"+$elem.attr("id")+" #"+nixLabelBeforeQuantityID).val());textBoxValue=!regIsPosNumber($thisTextbox.val())?previousValue:parseFloat($thisTextbox.val());$thisTextbox.val(textBoxValue.toFixed($localSettings.decimalPlacesForQuantityTextbox));$localSettings.valueServingUnitQuantity=textBoxValue;$localSettings=updateValuesAfterAQuantityChanged($localSettings,nutritionLabel,$elem,forLegacyLabel,false);if($localSettings.allowGoogleAnalyticsEventLog){window[$localSettings.gooleAnalyticsFunctionName]("send","event",$localSettings.textGoogleAnalyticsEventCategory,$localSettings.textGoogleAnalyticsEventActionTextbox)}handleQuantityChange($localSettings,"textbox",previousValue.toFixed($localSettings.decimalPlacesForQuantityTextbox),textBoxValue.toFixed($localSettings.decimalPlacesForQuantityTextbox))}function changeQuantityByArrow($thisQuantity,changeValueBy,$localSettings,nutritionLabel,$elem,forLegacyLabel){var unitQuantityBoxClass="unitQuantityBox";if(!forLegacyLabel){unitQuantityBoxClass="nf-unitQuantityBox"}var currentQuantity=parseFloat($thisQuantity.parent().parent().find("input."+unitQuantityBoxClass).val());if(isNaN(currentQuantity)){currentQuantity=1}var beforeCurrentQuantityWasChanged=currentQuantity;if(currentQuantity<=1&&changeValueBy==-1){changeValueBy=-.5;currentQuantity+=changeValueBy}else if(currentQuantity<1&&changeValueBy==1){changeValueBy=.5;currentQuantity+=changeValueBy}else if(currentQuantity<=2&¤tQuantity>1&&changeValueBy==-1){currentQuantity=1}else{currentQuantity+=changeValueBy}if(currentQuantity<0){currentQuantity=0}$thisQuantity.parent().parent().find("input."+unitQuantityBoxClass).val(currentQuantity.toFixed($localSettings.decimalPlacesForQuantityTextbox));$localSettings.valueServingUnitQuantity=currentQuantity;$localSettings=updateValuesAfterAQuantityChanged($localSettings,nutritionLabel,$elem,forLegacyLabel,false);if($localSettings.allowGoogleAnalyticsEventLog){if(changeValueBy>0){window[$localSettings.gooleAnalyticsFunctionName]("send","event",$localSettings.textGoogleAnalyticsEventCategory,$localSettings.textGoogleAnalyticsEventActionUpArrow)}else{window[$localSettings.gooleAnalyticsFunctionName]("send","event",$localSettings.textGoogleAnalyticsEventCategory,$localSettings.textGoogleAnalyticsEventActionDownArrow)}}handleQuantityChange($localSettings,changeValueBy>0?"up arrow":"down arrow",beforeCurrentQuantityWasChanged,currentQuantity)}function roundToNearestNum(input,nearest){if(nearest<0){return Math.round(input*nearest)/nearest}else{return Math.round(input/nearest)*nearest}}function roundCalories(toRound,decimalPlace){toRound=roundCaloriesRule(toRound);if(toRound>0){toRound=parseFloat(toRound.toFixed(decimalPlace))}return toRound}function roundFat(toRound,decimalPlace){toRound=roundFatRule(toRound);if(toRound>0){toRound=parseFloat(toRound.toFixed(decimalPlace))}return toRound}function roundSodium(toRound,decimalPlace){toRound=roundSodiumRule(toRound);if(toRound>0){toRound=parseFloat(toRound.toFixed(decimalPlace))}return toRound}function roundPotassium(toRound,decimalPlace){toRound=roundPotassiumRule(toRound);if(toRound>0){toRound=parseFloat(toRound.toFixed(decimalPlace))}return toRound}function roundCholesterol(toRound,decimalPlace){var normalVersion=true;var roundResult=roundCholesterolRule(toRound);if(roundResult===false){normalVersion=false}else{toRound=roundResult}if(normalVersion){if(toRound>0){toRound=parseFloat(toRound.toFixed(decimalPlace))}}else{toRound="< 5"}return toRound}function roundCarbFiberSugarProtein(toRound,decimalPlace){var normalVersion=true;var roundResult=roundCarbFiberSugarProteinRule(toRound);if(roundResult===false){normalVersion=false}else{toRound=roundResult}if(normalVersion){if(toRound>0){toRound=parseFloat(toRound.toFixed(decimalPlace))}}else{toRound="< 1"}return toRound}function roundCaloriesRule(toRound){if(toRound<5){return 0}else if(toRound<=50){return roundToNearestNum(toRound,5)}else{return roundToNearestNum(toRound,10)}}function roundFatRule(toRound){if(toRound<.5){return 0}else if(toRound<5){return roundToNearestNum(toRound,.5)}else{return roundToNearestNum(toRound,1)}}function roundSodiumRule(toRound){if(toRound<5){return 0}else if(toRound<=140){return roundToNearestNum(toRound,5)}else{return roundToNearestNum(toRound,10)}}function roundPotassiumRule(toRound){if(toRound<5){return 0}else if(toRound<=140){return roundToNearestNum(toRound,5)}else{return roundToNearestNum(toRound,10)}}function roundCholesterolRule(toRound){if(toRound<2){return 0}else if(toRound<=5){return false}else{return roundToNearestNum(toRound,5)}}function roundCarbFiberSugarProteinRule(toRound){if(toRound<.5){return 0}else if(toRound<1){return false}else{return roundToNearestNum(toRound,1)}}function roundVitaminsCalciumIron(toRound){if(toRound>0){if(toRound<10){return roundToNearestNum(toRound,2)}else if(toRound<50){return roundToNearestNum(toRound,5)}else{return roundToNearestNum(toRound,10)}}else{return 0}}function regIsPosNumber(fData){return new RegExp("(^[0-9]+[.]?[0-9]+$)|(^[0-9]+$)").test(fData)}function itemNameHtmlLegacy($localSettings){for(x=1;x<5;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var tabTemp=localTab1;var localNutritionLabel=itemNameClass="";if($localSettings.showServingUnitQuantityTextbox){if($localSettings.valueServingSizeUnit==null||$localSettings.valueServingSizeUnit==""||$localSettings.valueServingSizeUnit!==""&&$localSettings.valueServingSizeUnit!==null&&$localSettings.originalServingUnitQuantity<=0){localNutritionLabel+=localTab1+'<div class="cf">\n';localNutritionLabel+=localTab2+'<div class="rel servingSizeField">\n';var textboxClass="unitQuantityBox";if(!$localSettings.hideTextboxArrows){localNutritionLabel+=localTab3+'<div class="setter">\n';localNutritionLabel+=localTab4+'<a href="Increase the quantity" class="unitQuantityUp" aria-label="increase the Quantity Arrow" rel="nofollow" tabindex="0"></a>\n';localNutritionLabel+=localTab4+'<a href="Decrease the quantity" class="unitQuantityDown" aria-label="Decrease the Quantity Arrow" rel="nofollow" tabindex="0"></a>\n';localNutritionLabel+=localTab3+'</div>\x3c!-- closing class="setter" --\x3e\n\n'}else{textboxClass="unitQuantityBox arrowsAreHidden"}localNutritionLabel+=localTab3+'<input type="text" value="'+parseFloat($localSettings.valueServingUnitQuantity.toFixed($localSettings.decimalPlacesForQuantityTextbox))+'" class="'+textboxClass+'" aria-label="Change the Quantity Textbox">\n';localNutritionLabel+=localTab3+'<input type="hidden" value="'+parseFloat($localSettings.valueServingUnitQuantity.toFixed($localSettings.decimalPlacesForQuantityTextbox))+'" id="nixLabelBeforeQuantity">\n';localNutritionLabel+=localTab2+'</div>\x3c!-- closing class="servingSizeField" --\x3e\n\n';tabTemp=localTab2;var itemNameClass="inline"}}localNutritionLabel+=tabTemp+'<div class="name '+itemNameClass+'" tabindex="0">';localNutritionLabel+=$localSettings.itemName;if($localSettings.showBrandName&&$localSettings.brandName!=null&&$localSettings.brandName!=""){localNutritionLabel+=" - "+$localSettings.brandName}localNutritionLabel+="</div>\n";if($localSettings.showServingUnitQuantityTextbox){if($localSettings.valueServingSizeUnit==null||$localSettings.valueServingSizeUnit==""||$localSettings.valueServingSizeUnit!==""&&$localSettings.valueServingSizeUnit!==null&&$localSettings.originalServingUnitQuantity<=0){localNutritionLabel+=localTab1+'</div>\x3c!-- closing class="cf" --\x3e\n\n'}}return localNutritionLabel}function sevingUnitQuantityHtmlLegacy($localSettings){for(x=1;x<6;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var localServingSizeIsHidden=localServingContainerIsHidden=false;var localNutritionLabel="";if($localSettings.showServingUnitQuantity){localNutritionLabel+=localTab1+'<div class="serving" tabIndex="0">\n';if($localSettings.originalServingUnitQuantity>0){localNutritionLabel+=localTab2+'<div class="cf">\n';localNutritionLabel+=localTab3+'<div class="servingSizeText fl">'+$localSettings.textServingSize+"</div>\n";localNutritionLabel+=$localSettings.showServingUnitQuantityTextbox?"":localTab3+'<div class="servingUnitQuantity fl" itemprop="servingSize">'+parseFloat($localSettings.originalServingUnitQuantity.toFixed($localSettings.decimalPlacesForNutrition))+"</div>\n";var unitAddedClass="";var gramsAddedClass="";if($localSettings.valueServingSizeUnit!==""&&$localSettings.valueServingSizeUnit!==null){if($localSettings.showServingUnitQuantityTextbox&&$localSettings.valueServingSizeUnit!=null&&$localSettings.valueServingSizeUnit!=""){unitAddedClass="unitHasTextbox";gramsAddedClass="gramsHasTextbox";localNutritionLabel+=localTab3+'<div class="rel servingSizeField fl">\n';var textboxClass="unitQuantityBox";if(!$localSettings.hideTextboxArrows){localNutritionLabel+=localTab4+'<div class="setter">\n';localNutritionLabel+=localTab5+'<a href="Increase the quantity" class="unitQuantityUp" aria-label="increase the Quantity Arrow" rel="nofollow" tabindex="0"></a>\n'
;localNutritionLabel+=localTab5+'<a href="Decrease the quantity" class="unitQuantityDown" aria-label="Decrease the Quantity Arrow" rel="nofollow" tabindex="0"></a>\n';localNutritionLabel+=localTab4+'</div>\x3c!-- closing class="setter" --\x3e\n\n'}else{textboxClass="unitQuantityBox arrowsAreHidden"}localNutritionLabel+=localTab4+'<input type="text" value="'+parseFloat($localSettings.valueServingUnitQuantity.toFixed($localSettings.decimalPlacesForQuantityTextbox))+'" class="'+textboxClass+'" aria-label="Change the Quantity Textbox">\n';localNutritionLabel+=localTab4+'<input type="hidden" value="'+parseFloat($localSettings.valueServingUnitQuantity.toFixed($localSettings.decimalPlacesForQuantityTextbox))+'" id="nixLabelBeforeQuantity">\n';localNutritionLabel+=localTab3+'</div>\x3c!-- closing class="servingSizeField" --\x3e\n\n'}else if($localSettings.originalServingUnitQuantity>0&&$localSettings.showServingUnitQuantityTextbox){localNutritionLabel+=localTab3+'<div class="servingUnitQuantity" itemprop="servingSize">'+parseFloat($localSettings.originalServingUnitQuantity.toFixed($localSettings.decimalPlacesForNutrition))+"</div>\n"}localNutritionLabel+=localTab3+'<div class="servingUnit fl '+unitAddedClass+'">'+$localSettings.valueServingSizeUnit+($localSettings.legacyVersion==1?"</div>\n":"")}else if($localSettings.originalServingUnitQuantity>0&&$localSettings.showServingUnitQuantityTextbox){localNutritionLabel+=localTab3+'<div class="servingUnitQuantity fl" itemprop="servingSize">'+parseFloat($localSettings.originalServingUnitQuantity.toFixed($localSettings.decimalPlacesForNutrition))+"</div>\n"}if($localSettings.valueServingWeightGrams>0){localNutritionLabel+=localTab3+"<"+($localSettings.legacyVersion==1?"div":"span")+' class="servingWeightGrams '+($localSettings.legacyVersion==1?"fl":"")+" "+gramsAddedClass+'">'+'(<span itemprop="servingSize">'+parseFloat($localSettings.valueServingWeightGrams.toFixed($localSettings.decimalPlacesForNutrition))+'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>'+"</span>)\n</"+($localSettings.legacyVersion==1?"div":"span")+">\n"}localNutritionLabel+=localTab3+($localSettings.legacyVersion==1?"":"</div>\n");localNutritionLabel+=localTab2+'</div>\x3c!-- closing class="cf" --\x3e\n\n'}else{localServingSizeIsHidden=true}if($localSettings.showServingsPerContainer){if($localSettings.valueServingPerContainer>0){localNutritionLabel+=localTab2+'<div tabindex="0">'+$localSettings.textServingsPerContainer+" "+parseFloat($localSettings.valueServingPerContainer.toFixed($localSettings.decimalPlacesForNutrition))+"</div>\n"}else{localServingContainerIsHidden=true}}else{localServingContainerIsHidden=true}localNutritionLabel+=localTab1+'</div>\x3c!-- closing class="serving" --\x3e\n\n'}return{servingSizeIsHidden:localServingSizeIsHidden,servingContainerIsHidden:localServingContainerIsHidden,nutritionLabel:localNutritionLabel}}function calorieDietHtmlLegacy($localSettings){for(x=2;x<6;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var localNutritionLabel=localTab2+'<table class="tblCalorieDiet" aria-hidden="true">\n';localNutritionLabel+=localTab3+"<thead>\n";localNutritionLabel+=localTab4+"<tr>\n";localNutritionLabel+=localTab5+"<th> </th>\n";localNutritionLabel+=localTab5+"<th>Calories</th>\n";localNutritionLabel+=localTab5+"<th>"+$localSettings.valueCol1CalorieDiet+"</th>\n";localNutritionLabel+=localTab5+"<th>"+$localSettings.valueCol2CalorieDiet+"</th>\n";localNutritionLabel+=localTab4+"</tr>\n";localNutritionLabel+=localTab3+"</thead>\n";localNutritionLabel+=localTab3+"<tbody>\n";localNutritionLabel+=localTab4+"<tr>\n";localNutritionLabel+=localTab5+"<td>Total Fat</td>\n";localNutritionLabel+=localTab5+"<td>Less than</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol1DietaryTotalFat+"g</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol2DietaryTotalFat+"g</td>\n";localNutritionLabel+=localTab4+"</tr>\n";localNutritionLabel+=localTab4+"<tr>\n";localNutritionLabel+=localTab5+"<td> Saturated Fat</td>\n";localNutritionLabel+=localTab5+"<td>Less than</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol1DietarySatFat+"g</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol2DietarySatFat+"g</td>\n";localNutritionLabel+=localTab4+"</tr>\n";localNutritionLabel+=localTab4+"<tr>\n";localNutritionLabel+=localTab5+"<td>Cholesterol</td>\n";localNutritionLabel+=localTab5+"<td>Less than</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol1DietaryCholesterol+"mg</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol2DietaryCholesterol+"mg</td>\n";localNutritionLabel+=localTab4+"</tr>\n";localNutritionLabel+=localTab4+"<tr>\n";localNutritionLabel+=localTab5+"<td>Sodium</td>\n";localNutritionLabel+=localTab5+"<td>Less than</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol1DietarySodium+"mg</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol2DietarySodium+"mg</td>\n";localNutritionLabel+=localTab4+"</tr>\n";localNutritionLabel+=localTab4+"<tr>\n";localNutritionLabel+=localTab5+"<td>Potassium</td>\n";localNutritionLabel+=localTab5+"<td>Less than</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol1DietaryPotassium+"mg</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol2DietaryPotassium+"mg</td>\n";localNutritionLabel+=localTab4+"</tr>\n";localNutritionLabel+=localTab4+"<tr>\n";localNutritionLabel+=localTab5+"<td>Total Carbohydrate</td>\n";localNutritionLabel+=localTab5+"<td> </td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol1DietaryTotalCarb+"g</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol2DietaryTotalCarb+"g</td>\n";localNutritionLabel+=localTab4+"</tr>\n";localNutritionLabel+=localTab4+"<tr>\n";localNutritionLabel+=localTab5+"<td> Dietary</td>\n";localNutritionLabel+=localTab5+"<td> </td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol1Dietary+"g</td>\n";localNutritionLabel+=localTab5+"<td>"+$localSettings.valueCol2Dietary+"g</td>\n";localNutritionLabel+=localTab4+"</tr>\n";localNutritionLabel+=localTab3+"</tbody>\n";return localNutritionLabel+=localTab2+"</table>\n"}function ingredientsHtmlLegacy($localSettings){for(x=3;x<5;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var localNutritionLabel="";if(!$localSettings.hidePercentDailyValues){localNutritionLabel+=localTab3+"<br/>\n"}localNutritionLabel+=localTab3+'<div class="'+($localSettings.hidePercentDailyValues?"ingredientListDivHiddenDailyValues":"ingredientListDiv")+'" tabindex="0">\n';localNutritionLabel+=localTab4+'<strong class="active" id="ingredientList">'+$localSettings.ingredientLabel+"</strong>\n";localNutritionLabel+=localTab4+$localSettings.ingredientList+"\n";return localNutritionLabel+=localTab3+'</div>\x3c!-- closing class="ingredientListDiv" --\x3e\n\n'}function disclaimerHtmlLegacy($localSettings){for(x=3;x<5;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var localNutritionLabel=localTab3+"<br/>\n\n";localNutritionLabel+=localTab3+'<div id="calcDisclaimer">\n';localNutritionLabel+=localTab4+'<span id="calcDisclaimerText" tabindex="0">'+$localSettings.valueDisclaimer+"</span>\n";localNutritionLabel+=localTab3+"</div>\n";return localNutritionLabel+=localTab3+"<br/>\n\n"}function bottomLinkHtmlLegacy($localSettings,localTab1){var localNutritionLabel=localTab1+'<div class="spaceAbove"></div>\n';localNutritionLabel+=localTab1+'<a href="'+$localSettings.urlBottomLink+'" target="_newSite" class="homeLinkPrint">'+$localSettings.nameBottomLink+"</a>\n";return localNutritionLabel+=localTab1+'<div class="spaceBelow"></div>\n'}function generateAttributeWithoutPercentageHtmlLegacy($localSettings,valueIndex,unitIndex,naIndex,attributeText,localTabValue,lineClass,attributeDisplayType,itemPropValue,localExtraTab,roundFunctionName){var localNaValue='<font class="notApplicable" aria-hidden="true">'+$localSettings.textNotApplicable+" </font>"+'<font class="sr-only">Data not available'+(attributeDisplayType==5?" for ":"")+"</font>";var localNutritionLabel=localTabValue+'<div class="'+lineClass+'" tabindex="0">';if(attributeDisplayType==1){localNutritionLabel+="<strong>"+$localSettings[attributeText]+'</strong> <span itemprop="'+itemPropValue+'">'}else if(attributeDisplayType==2){localNutritionLabel+=$localSettings[attributeText]+" "}else if(attributeDisplayType==3){localNutritionLabel+=localExtraTab+$localSettings[attributeText]+' <span itemprop="'+itemPropValue+'">'}else if(attributeDisplayType==4){localNutritionLabel+=$localSettings[attributeText]+' <span itemprop="'+itemPropValue+'">'}else if(attributeDisplayType==5){localNutritionLabel+=localExtraTab+'<div class="dv">\n'}localNutritionLabel+=$localSettings[naIndex]?localNaValue:($localSettings.allowFDARounding?eval(roundFunctionName)($localSettings[valueIndex],$localSettings.decimalPlacesForNutrition):parseFloat($localSettings[valueIndex].toFixed($localSettings.decimalPlacesForNutrition)))+$localSettings[unitIndex];if(attributeDisplayType==1||attributeDisplayType==4){localNutritionLabel+="</span></div>\n"}else if(attributeDisplayType==2){localNutritionLabel+="</div>\n"}else if(attributeDisplayType==3){localNutritionLabel+="\n"+localTabValue+"</span></div>\n"}else if(attributeDisplayType==5){localNutritionLabel+="</div>\n";localNutritionLabel+=localExtraTab+$localSettings[attributeText]+"\n";localNutritionLabel+=localTabValue+"</div>\n"}return localNutritionLabel}function generateAttributeWithPercentageHtmlLegacy($localSettings,valueIndex,dailyValueIndex,unitIndex,naIndex,attributeTexts,lineClass,itemPropValue,roundFunctionName,roundFunctionRuleName,boldName){for(x=1;x<3;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var localNaValue='<font class="notApplicable" aria-hidden="true">'+$localSettings.textNotApplicable+' </font><font class="sr-only">Data not available</font>';var localNutritionLabel=localTab1+'<div class="'+lineClass+'" tabindex="0">\n';if(!$localSettings["hidePercentDailyValues"]){localNutritionLabel+=localTab2+'<div class="dv" aria-hidden="true">';localNutritionLabel+=$localSettings[naIndex]?localNaValue:"<strong>"+parseFloat(parseFloat(($localSettings.allowFDARounding?eval(roundFunctionRuleName)($localSettings[valueIndex]):$localSettings[valueIndex])/($localSettings[dailyValueIndex]==0?1:$localSettings[dailyValueIndex]*(parseFloat($localSettings.calorieIntake)/2e3).toFixed(2))*100).toFixed($localSettings.decimalPlacesForDailyValues))+"</strong>%";localNutritionLabel+="</div>\n"}if(boldName){localNutritionLabel+=localTab2+"<strong>"+$localSettings[attributeTexts]+'</strong> <span itemprop="'+itemPropValue+'">'}else{localNutritionLabel+=localTab2+$localSettings[attributeTexts]+' <span itemprop="'+itemPropValue+'">'}localNutritionLabel+=($localSettings[naIndex]?localNaValue:($localSettings.allowFDARounding?eval(roundFunctionName)($localSettings[valueIndex],$localSettings.decimalPlacesForNutrition):parseFloat($localSettings[valueIndex].toFixed($localSettings.decimalPlacesForNutrition)))+$localSettings[unitIndex])+"\n";return localNutritionLabel+=localTab1+"</span></div>\n"}function generateAttributeHtml2018Version($localSettings,valueIndex,unitIndex,naIndex,attributeText,itemPropValue,topDivClass,showPercentageCode,roundFunctionName,roundFunctionRuleName,labelClass,valueClass,dailyValueIndex){for(x=1;x<4;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var localNaValue='<font class="notApplicable" aria-hidden="true">'+$localSettings.textNotApplicable+' </font><font class="sr-only">Data not available</font>';var localNutritionLabel=localTab1+'<div class="'+topDivClass+'" tabindex="0">\n';if(showPercentageCode&&!$localSettings["hidePercentDailyValues"]){localNutritionLabel+=localTab2+'<span class="nf-highlight nf-pr" aria-hidden="true">';localNutritionLabel+=$localSettings[naIndex]?localNaValue:parseFloat(parseFloat(($localSettings.allowFDARounding?eval(roundFunctionRuleName)($localSettings[valueIndex]):$localSettings[valueIndex])/($localSettings[dailyValueIndex]==0?1:$localSettings[dailyValueIndex]*(parseFloat($localSettings.calorieIntake)/2e3).toFixed(2))*100).toFixed($localSettings.decimalPlacesForDailyValues))+"%";localNutritionLabel+="</span>\n"}if(valueIndex!="valueAddedSugars"){localNutritionLabel+=localTab2+'<span class="'+labelClass+'">';localNutritionLabel+=$localSettings[attributeText];localNutritionLabel+="</span>\n";localNutritionLabel+=localTab2+'<span class="'+valueClass+'" itemprop="'+itemPropValue+'">';localNutritionLabel+=$localSettings[naIndex]?localNaValue:($localSettings.allowFDARounding?eval(roundFunctionName)($localSettings[valueIndex],$localSettings.decimalPlacesForNutrition):parseFloat($localSettings[valueIndex].toFixed($localSettings.decimalPlacesForNutrition)))+$localSettings[unitIndex];localNutritionLabel+="</span>\n"}else{localNutritionLabel+=localTab2+'<span class="'+labelClass+'">\n';localNutritionLabel+=$localSettings["textAddedSugars1"]+"\n";localNutritionLabel+=localTab3+'<span class="'+valueClass+'" itemprop="'+itemPropValue+'">';localNutritionLabel+=$localSettings[naIndex]?localNaValue:($localSettings.allowFDARounding?eval(roundFunctionName)($localSettings[valueIndex],$localSettings.decimalPlacesForNutrition):parseFloat($localSettings[valueIndex].toFixed($localSettings.decimalPlacesForNutrition)))+$localSettings[unitIndex];localNutritionLabel+="</span>\n";localNutritionLabel+=$localSettings["textAddedSugars2"];localNutritionLabel+="</span>\n"}return localNutritionLabel+=localTab1+"</div>\n"}function ingredientsHtml2018Version($localSettings){for(x=3;x<5;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var localNutritionLabel="";if(!$localSettings.hidePercentDailyValues){localNutritionLabel+=localTab3+"<br/>\n\n"}localNutritionLabel+=localTab3+'<div class="'+($localSettings.hidePercentDailyValues?"nf-ingredientListDivHiddenDailyValues":"nf-ingredientListDiv")+'" tabindex="0">\n';localNutritionLabel+=localTab4+'<strong class="active" id="nf-ingredientList">'+$localSettings.ingredientLabel+"</strong>\n";localNutritionLabel+=localTab4+$localSettings.ingredientList+"\n";return localNutritionLabel+=localTab3+'</div>\x3c!-- closing class="nf-ingredientListDiv" --\x3e\n\n'}function disclaimerHtml2018Version($localSettings){for(x=3;x<5;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var localNutritionLabel=localTab3+"<br/>\n\n";localNutritionLabel+=localTab3+'<div id="nf-calcDisclaimer">\n';localNutritionLabel+=localTab4+'<span id="nf-calcDisclaimerText" tabindex="0">'+$localSettings.valueDisclaimer+"</span>\n";localNutritionLabel+=localTab3+"</div>\n";return localNutritionLabel+=localTab3+"<br/>\n\n"}function bottomLinkHtml2018Version($localSettings,localTab1){var localNutritionLabel=localTab1+'<div class="nf-spaceAbove"></div>\n';localNutritionLabel+=localTab1+'<a href="'+$localSettings.urlBottomLink+'" target="_newSite" class="nf-homeLinkPrint">'+$localSettings.nameBottomLink+"</a>\n";return localNutritionLabel+=localTab1+'<div class="nf-spaceBelow"></div>\n'}function generateHtmlAndComputeValueGivenThePercentage($localSettings,valueIndex,dailyValueIndex,unitIndex_base,unitIndex_percent,naIndex,attributeTexts){var localNaValue='<font class="notApplicable" aria-hidden="true">'+$localSettings.textNotApplicable+' </font><font class="sr-only">Data not available</font>';var localNutritionLabel='<div class="nf-vitamin-column" tabindex="0">\n';localNutritionLabel+=$localSettings[attributeTexts]+" ";if($localSettings.useMassForVitamins){localNutritionLabel+=($localSettings[naIndex]?localNaValue:$localSettings[valueIndex]+$localSettings[unitIndex_base]+' <span class="nf-pr" aria-hidden="true">'+($localSettings[valueIndex]/$localSettings[dailyValueIndex]*100).toFixed($localSettings.decimalPlacesForDailyValues)+$localSettings[unitIndex_percent]+"</span>")+"\n"}else{localNutritionLabel+=($localSettings[naIndex]?localNaValue:parseFloat($localSettings[valueIndex]/100*$localSettings[dailyValueIndex]).toFixed($localSettings.decimalPlacesForDailyValues)+$localSettings[unitIndex_base]+' <span class="nf-pr" aria-hidden="true">'+$localSettings[valueIndex].toFixed($localSettings.decimalPlacesForDailyValues)+$localSettings[unitIndex_percent]+"</span>")+"\n"}return localNutritionLabel+="</div>\n"}function generateHtmlAndComputeValueGivenTheMass($localSettings,valueIndex,dailyValueIndex,unitIndex_base,unitIndex_percent,naIndex,attributeTexts){var localNaValue='<font class="notApplicable" aria-hidden="true">'+$localSettings.textNotApplicable+' </font><font class="sr-only">Data not available</font>';var localNutritionLabel='<div class="nf-vitamin-column" tabindex="0">\n';localNutritionLabel+=$localSettings[attributeTexts]+" ";localNutritionLabel+=($localSettings[naIndex]?localNaValue:$localSettings[valueIndex]+$localSettings[unitIndex_base]+' <span class="nf-pr" aria-hidden="true">'+($localSettings[valueIndex]/$localSettings[dailyValueIndex]*100).toFixed($localSettings.decimalPlacesForDailyValues)+$localSettings[unitIndex_percent]+"</span>")+"\n";return localNutritionLabel+="</div>\n"}function itemNameHtml2018($localSettings){for(x=3;x<6;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var itemNameClass="";localNutritionLabel="";if($localSettings.showServingUnitQuantityTextbox){if($localSettings.valueServingSizeUnit==null||$localSettings.valueServingSizeUnit==""||$localSettings.valueServingSizeUnit!==""&&$localSettings.valueServingSizeUnit!==null&&$localSettings.originalServingUnitQuantity<=0){var hideArrowsClass="";var textboxClass="nf-unitQuantityBox nf-modifier-field";if(!$localSettings.hideTextboxArrows){localNutritionLabel+=localTab3+'<div class="nf-arrows">\n';localNutritionLabel+=localTab4+'<div class="nf-unitQuantityUp nf-arrow-up" aria-label="Increase the Quantity Arrow" rel="nofollow" tabindex="0"></div>\n';localNutritionLabel+=localTab4+'<div class="nf-unitQuantityDown nf-arrow-down" aria-label="Decrease the Quantity Arrow" rel="nofollow" tabindex="0"></div>\n';localNutritionLabel+=localTab3+'</div>\x3c!-- closing class="nf-arrows v1" --\x3e\n\n'}else{textboxClass="nf-unitQuantityBox nf-modifier-field nf-arrowsAreHidden";hideArrowsClass="nf-fixed-serving "}localNutritionLabel+=localTab3+'<input type="text" value="'+parseFloat($localSettings.valueServingUnitQuantity.toFixed($localSettings.decimalPlacesForQuantityTextbox))+'" class="'+textboxClass+'" data-role="none" aria-label="Change the Quantity Textbox">\n';localNutritionLabel+=localTab3+'<input type="hidden" value="'+parseFloat($localSettings.valueServingUnitQuantity.toFixed($localSettings.decimalPlacesForQuantityTextbox))+'" id="nf-nixLabelBeforeQuantity">\n\n';var itemNameClass=hideArrowsClass}else if(!$localSettings.showServingUnitQuantity){itemNameClass+="no-indent"}}else{itemNameClass+="no-indent"}localNutritionLabel+=localTab3+'<div class="nf-item-name '+itemNameClass+'" tabindex="0">'+"\n";if($localSettings.showServingUnitQuantity&&$localSettings.originalServingUnitQuantity>0&&$localSettings.valueServingSizeUnit!==""&&$localSettings.valueServingSizeUnit!==null){localNutritionLabel+=localTab4+$localSettings.valueServingSizeUnit+"\n";if($localSettings.valueServingWeightGrams>0){localNutritionLabel+=localTab4+'(<span itemprop="servingSize">'+parseFloat($localSettings.valueServingWeightGrams.toFixed($localSettings.decimalPlacesForNutrition))+'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>'+"</span>)\n"}}localNutritionLabel+=localTab4+"<div>\n";localNutritionLabel+=localTab5+$localSettings.itemName+"\n";if($localSettings.showBrandName&&$localSettings.brandName!=null&&$localSettings.brandName!=""){localNutritionLabel+=" - "+$localSettings.brandName}localNutritionLabel+="\n"+localTab4+"</div>\n";localNutritionLabel+=localTab3+"</div>\n";return localNutritionLabel}function sevingUnitQuantityHtml2018($localSettings){for(x=3;x<7;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var localTab"+x+' = "'+tab+'";')}var localServingSizeIsHidden=localServingContainerIsHidden=false;var localNutritionLabel="";if($localSettings.showServingUnitQuantity){if($localSettings.originalServingUnitQuantity>0){localNutritionLabel+=localTab3+'<div tabIndex="0">\x3c!-- opening for serving size div --\x3e\n';localNutritionLabel+=localTab4+$localSettings.textServingSize;localNutritionLabel+=$localSettings.showServingUnitQuantityTextbox?"":' <span itemprop="servingSize">'+parseFloat($localSettings.originalServingUnitQuantity.toFixed($localSettings.decimalPlacesForNutrition))+"</span>\n";var servingSizeDivAlreadyClosed=false;var unitAddedClass="";var gramsAddedClass="";if($localSettings.valueServingSizeUnit!==""&&$localSettings.valueServingSizeUnit!==null){if($localSettings.showServingUnitQuantityTextbox&&$localSettings.valueServingSizeUnit!=null&&$localSettings.valueServingSizeUnit!=""){unitAddedClass="nf-unitHasTextbox";gramsAddedClass="nf-gramsHasTextbox";servingSizeDivAlreadyClosed=true;localNutritionLabel+="\n"+localTab3+"</div>\x3c!-- closing for serving size div --\x3e\n\n";var textboxClass="nf-unitQuantityBox nf-modifier-field";if(!$localSettings.hideTextboxArrows){localNutritionLabel+=localTab5+'<div class="nf-arrows">\x3c!-- opening class="nf-arrows" --\x3e\n';localNutritionLabel+=localTab6+'<div class="nf-unitQuantityUp nf-arrow-up" aria-label="Increase the Quantity Arrow" rel="nofollow" tabindex="0"></div>\n';localNutritionLabel+=localTab6+'<div class="nf-unitQuantityDown nf-arrow-down" aria-label="DePcrease the Quantity Arrow" rel="nofollow" tabindex="0"></div>\n';localNutritionLabel+=localTab5+'</div>\x3c!-- closing class="nf-arrows v2" --\x3e\n\n'}else{textboxClass="nf-unitQuantityBox nf-modifier-field nf-arrowsAreHidden"}localNutritionLabel+=localTab5+'<input type="text" data-role="none" value="'+parseFloat($localSettings.valueServingUnitQuantity.toFixed($localSettings.decimalPlacesForQuantityTextbox))+'" class="'+textboxClass+'" aria-label="Change the Quantity Textbox">\n';localNutritionLabel+=localTab5+'<input type="hidden" value="'+parseFloat($localSettings.valueServingUnitQuantity.toFixed($localSettings.decimalPlacesForQuantityTextbox))+'" id="nf-nixLabelBeforeQuantity">\n\n'}else if($localSettings.originalServingUnitQuantity>0&&$localSettings.showServingUnitQuantityTextbox){localNutritionLabel+=' <span itemprop="servingSize">'+parseFloat($localSettings.originalServingUnitQuantity.toFixed($localSettings.decimalPlacesForNutrition))+"</span>\n"}if(!$localSettings.showItemName){localNutritionLabel+=localTab5+'<div class="nf-item-name" tabindex="0">\n';localNutritionLabel+=localTab6+$localSettings.valueServingSizeUnit+"\n";if($localSettings.valueServingWeightGrams>0){localNutritionLabel+=localTab6+"("+$localSettings.valueServingWeightGrams.toFixed($localSettings.decimalPlacesForQuantityTextbox)+'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>)\n'}localNutritionLabel+=localTab5+"</div>\n"}}else if($localSettings.originalServingUnitQuantity>0&&$localSettings.showServingUnitQuantityTextbox){localNutritionLabel+=' <span itemprop="servingSize">'+parseFloat($localSettings.originalServingUnitQuantity.toFixed($localSettings.decimalPlacesForNutrition))+"</span>\n";if(($localSettings.valueServingSizeUnit==""||$localSettings.valueServingSizeUnit==null)&&$localSettings.valueServingWeightGrams>0){localNutritionLabel+=localTab4+"("+$localSettings.valueServingWeightGrams.toFixed($localSettings.decimalPlacesForQuantityTextbox)+'<span aria-hidden="true">g</span><span class="sr-only"> grams</span>)\n'}}if(!servingSizeDivAlreadyClosed){localNutritionLabel+=localTab3+"</div>\x3c!-- closing for serving size div --\x3e\n\n"}}else{localServingSizeIsHidden=true}}return{servingSizeIsHidden:localServingSizeIsHidden,servingContainerIsHidden:localServingContainerIsHidden,nutritionLabel:localNutritionLabel}}NutritionLabel.prototype={generateLegacy:function(){var $this=this;if($this.nutritionLabel){return $this.nutritionLabel}if($this.settings.hideNotApplicableValues){$this.settings.showCalories=$this.settings.naCalories?false:$this.settings.showCalories;$this.settings.showFatCalories=$this.settings.naFatCalories?false:$this.settings.showFatCalories;$this.settings.showTotalFat=$this.settings.naTotalFat?false:$this.settings.showTotalFat;$this.settings.showSatFat=$this.settings.naSatFat?false:$this.settings.showSatFat;$this.settings.showTransFat=$this.settings.naTransFat?false:$this.settings.showTransFat;$this.settings.showPolyFat=$this.settings.naPolyFat?false:$this.settings.showPolyFat;$this.settings.showMonoFat=$this.settings.naMonoFat?false:$this.settings.showMonoFat;$this.settings.showCholesterol=$this.settings.naCholesterol?false:$this.settings.showCholesterol;$this.settings.showSodium=$this.settings.naSodium?false:$this.settings.showSodium;$this.settings.showPotassium=$this.settings.naPotassium?false:$this.settings.showPotassium;$this.settings.showTotalCarb=$this.settings.naTotalCarb?false:$this.settings.showTotalCarb;$this.settings.showFibers=$this.settings.naFibers?false:$this.settings.showFibers;$this.settings.showSugars=$this.settings.naSugars?false:$this.settings.showSugars;$this.settings.showSugarAlcohol=$this.settings.naSugarAlcohol?false:$this.settings.showSugarAlcohol;$this.settings.showProteins=$this.settings.naProteins?false:$this.settings.showProteins;$this.settings.showVitaminA=$this.settings.naVitaminA?false:$this.settings.showVitaminA;$this.settings.showVitaminC=$this.settings.naVitaminC?false:$this.settings.showVitaminC;$this.settings.showCalcium=$this.settings.naCalcium?false:$this.settings.showCalcium;$this.settings.showIron=$this.settings.naIron?false:$this.settings.showIron}if($this.settings.hidePercentDailyValues){$this.settings.showVitaminA=false;$this.settings.showVitaminC=false;$this.settings.showCalcium=false;$this.settings.showIron=false}for(x=1;x<9;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var tab"+x+' = "'+tab+'";')}var borderCSS="";if($this.settings.allowNoBorder){borderCSS="border: 0;"}var nutritionLabel='<div itemscope itemtype="http://schema.org/NutritionInformation" class="nutritionLabel" style="'+borderCSS;if(!$this.settings.allowCustomWidth){nutritionLabel+=" width: "+$this.settings.width+'px;">\n'}else{nutritionLabel+=" width: "+$this.settings.widthCustom+';">\n'}nutritionLabel+=tab1+'<div class="title" tabindex="0">'+$this.settings.textNutritionFacts+"</div>\n";if($this.settings.showItemName){nutritionLabel+=itemNameHtmlLegacy($this.settings)}var sevingUnitQuantityHtmlLegacyResult=sevingUnitQuantityHtmlLegacy($this.settings);var servingSizeIsHidden=sevingUnitQuantityHtmlLegacyResult.servingSizeIsHidden;var servingContainerIsHidden=sevingUnitQuantityHtmlLegacyResult.servingContainerIsHidden;nutritionLabel+=sevingUnitQuantityHtmlLegacyResult.nutritionLabel;if(!$this.settings.showItemName&&!$this.settings.showServingUnitQuantity||!$this.settings.showItemName&&servingSizeIsHidden&&servingContainerIsHidden){nutritionLabel+=tab1+'<div class="headerSpacer"></div>\n'}nutritionLabel+=tab1+'<div class="bar1"></div>\n';if($this.settings.showAmountPerServing){nutritionLabel+=tab1+'<div class="line m" tabindex="0">';nutritionLabel+="<strong>"+$this.settings.textAmountPerServing+"</strong>";nutritionLabel+="</div>\n"}nutritionLabel+=tab1+'<div class="line">\n';if($this.settings.showFatCalories){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueFatCalories","unitFatCalories","naFatCalories","textFatCalories",tab2,"fr",2,"","","roundCalories")}if($this.settings.showCalories){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueCalories","unitCalories","naCalories","textCalories",tab2,"",1,"calories","","roundCalories")}else if($this.settings.showFatCalories){nutritionLabel+=tab2+"<div> </div>\n"}nutritionLabel+=tab1+"</div>\n";nutritionLabel+=tab1+'<div class="bar2"></div>\n';if(!$this.settings.hidePercentDailyValues){nutritionLabel+=tab1+'<div class="line ar ">';nutritionLabel+="<strong>% "+$this.settings.textDailyValues+"<sup>*</sup></strong>";nutritionLabel+="</div>\n"}if($this.settings.showTotalFat){nutritionLabel+=generateAttributeWithPercentageHtmlLegacy($this.settings,"valueTotalFat","dailyValueTotalFat","unitTotalFat","naTotalFat","textTotalFat","line","fatContent","roundFat","roundFatRule",true)}if($this.settings.showSatFat){nutritionLabel+=generateAttributeWithPercentageHtmlLegacy($this.settings,"valueSatFat","dailyValueSatFat","unitSatFat","naSatFat","textSatFat","line indent","saturatedFatContent","roundFat","roundFatRule",false)}if($this.settings.showTransFat){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueTransFat","unitTransFat","naTransFat","textTransFat",tab1,"line indent",3,"transFatContent",tab2,"roundFat")}if($this.settings.showPolyFat){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valuePolyFat","unitPolyFat","naPolyFat","textPolyFat",tab1,"line indent",2,"","","roundFat")}if($this.settings.showMonoFat){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueMonoFat","unitMonoFat","naMonoFat","textMonoFat",tab1,"line indent",2,"","","roundFat")}if($this.settings.showCholesterol){nutritionLabel+=generateAttributeWithPercentageHtmlLegacy($this.settings,"valueCholesterol","dailyValueCholesterol","unitCholesterol","naCholesterol","textCholesterol","line","cholesterolContent","roundCholesterol","roundCholesterolRule",true)}if($this.settings.showSodium){nutritionLabel+=generateAttributeWithPercentageHtmlLegacy($this.settings,"valueSodium","dailyValueSodium","unitSodium","naSodium","textSodium","line","sodiumContent","roundSodium","roundSodiumRule",true)}if($this.settings.showPotassium){nutritionLabel+=generateAttributeWithPercentageHtmlLegacy($this.settings,"valuePotassium","dailyValuePotassium","unitPotassium","naPotassium","textPotassium","line","potassiumContent","roundPotassium","roundPotassiumRule",true)}if($this.settings.showTotalCarb){nutritionLabel+=generateAttributeWithPercentageHtmlLegacy($this.settings,"valueTotalCarb","dailyValueCarb","unitTotalCarb","naTotalCarb","textTotalCarb","line","carbohydrateContent","roundCarbFiberSugarProtein","roundCarbFiberSugarProteinRule",true)}if($this.settings.showFibers){nutritionLabel+=generateAttributeWithPercentageHtmlLegacy($this.settings,"valueFibers","dailyValueFiber","unitFibers","naFibers","textFibers","line indent","fiberContent","roundCarbFiberSugarProtein","roundCarbFiberSugarProteinRule",false)}if($this.settings.showSugars){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueSugars","unitSugars","naSugars","textSugars",tab1,"line indent",4,"sugarContent","","roundCarbFiberSugarProtein")}if($this.settings.showSugarAlcohol){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueSugarAlcohol","unitSugarAlcohol","naSugarAlcohol","textSugarAlcohol",tab1,"line indent",4,"","","roundCarbFiberSugarProtein")}if($this.settings.showProteins){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueProteins","unitProteins","naProteins","textProteins",tab1,"line",1,"proteinContent","","roundCarbFiberSugarProtein")}nutritionLabel+=tab1+'<div class="bar1"></div>\n';if($this.settings.showVitaminA){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueVitaminA","unitVitaminA","naVitaminA","textVitaminA",tab1,"line vitaminA",5,"",tab2,"roundVitaminsCalciumIron")}if($this.settings.showVitaminC){
nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueVitaminC","unitVitaminC","naVitaminC","textVitaminC",tab1,"line vitaminC",5,"",tab2,"roundVitaminsCalciumIron")}if($this.settings.showCalcium){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueCalcium","unitCalcium","naCalcium","textCalcium",tab1,"line calcium",5,"",tab2,"roundVitaminsCalciumIron")}if($this.settings.showIron){nutritionLabel+=generateAttributeWithoutPercentageHtmlLegacy($this.settings,"valueIron","unitIron","naIron","textIron",tab1,"line iron",5,"",tab2,"roundVitaminsCalciumIron")}nutritionLabel+=tab1+'<div class="dvCalorieDiet line">\n';nutritionLabel+=tab2+'<div class="calorieNote">\n';if(!$this.settings.hidePercentDailyValues){nutritionLabel+=tab3+'<span tabindex="0"><span class="star" aria-hidden="true">*</span> '+$this.settings.textPercentDailyPart1+" "+$this.settings.calorieIntake+" "+$this.settings.textPercentDailyPart2+".</span>\n"}if($this.settings.showIngredients){nutritionLabel+=ingredientsHtmlLegacy($this.settings)}if($this.settings.showDisclaimer){nutritionLabel+=disclaimerHtmlLegacy($this.settings)}nutritionLabel+=tab2+'</div>\x3c!-- closing class="calorieNote" --\x3e\n\n';if($this.settings.showCalorieDiet){nutritionLabel+=calorieDietHtmlLegacy($this.settings)}nutritionLabel+=tab1+'</div>\x3c!-- closing class="dvCalorieDiet line" --\x3e\n\n';if($this.settings.showBottomLink){nutritionLabel+=bottomLinkHtmlLegacy($this.settings,tab1)}if($this.settings.showCustomFooter){nutritionLabel+=tab1+'<div class="customFooter" tabindex="0">'+$this.settings.valueCustomFooter+"</div>\n"}nutritionLabel+='</div>\x3c!-- closing class="nutritionLabel" --\x3e\n\n';return nutritionLabel+='<div class="naTooltip">Data not available</div>\n'},generate2018:function(){var $this=this;if($this.nutritionLabel){return $this.nutritionLabel}if($this.settings.hideNotApplicableValues){$this.settings.showCalories=$this.settings.naCalories?false:$this.settings.showCalories;$this.settings.showFatCalories=$this.settings.naFatCalories?false:$this.settings.showFatCalories;$this.settings.showTotalFat=$this.settings.naTotalFat?false:$this.settings.showTotalFat;$this.settings.showSatFat=$this.settings.naSatFat?false:$this.settings.showSatFat;$this.settings.showTransFat=$this.settings.naTransFat?false:$this.settings.showTransFat;$this.settings.showPolyFat=$this.settings.naPolyFat?false:$this.settings.showPolyFat;$this.settings.showMonoFat=$this.settings.naMonoFat?false:$this.settings.showMonoFat;$this.settings.showCholesterol=$this.settings.naCholesterol?false:$this.settings.showCholesterol;$this.settings.showSodium=$this.settings.naSodium?false:$this.settings.showSodium;$this.settings.showPotassium_2018=$this.settings.naPotassium_2018?false:$this.settings.showPotassium_2018;$this.settings.showTotalCarb=$this.settings.naTotalCarb?false:$this.settings.showTotalCarb;$this.settings.showFibers=$this.settings.naFibers?false:$this.settings.showFibers;$this.settings.showSugars=$this.settings.naSugars?false:$this.settings.showSugars;$this.settings.showAddedSugars=$this.settings.naAddedSugars?false:$this.settings.showAddedSugars;$this.settings.showSugarAlcohol=$this.settings.naSugarAlcohol?false:$this.settings.showSugarAlcohol;$this.settings.showProteins=$this.settings.naProteins?false:$this.settings.showProteins;$this.settings.showVitaminD=$this.settings.naVitaminD?false:$this.settings.showVitaminD;$this.settings.showCalcium=$this.settings.naCalcium?false:$this.settings.showCalcium;$this.settings.showIron=$this.settings.naIron?false:$this.settings.showIron;$this.settings.showVitaminA_2018=$this.settings.naVitaminA_2018?false:$this.settings.showVitaminA_2018;$this.settings.showVitaminC_2018=$this.settings.naVitaminC_2018?false:$this.settings.showVitaminC_2018;$this.settings.showVitaminE=$this.settings.naVitaminE?false:$this.settings.showVitaminE;$this.settings.showVitaminK=$this.settings.naVitaminK?false:$this.settings.showVitaminK;$this.settings.showThiamin=$this.settings.naThiamin?false:$this.settings.showThiamin;$this.settings.showRiboflavin=$this.settings.naRiboflavin?false:$this.settings.showRiboflavin;$this.settings.showNiacin=$this.settings.naNiacin?false:$this.settings.showNiacin;$this.settings.showVitaminB6=$this.settings.naVitaminB6?false:$this.settings.showVitaminB6;$this.settings.showFolate=$this.settings.naFolate?false:$this.settings.showFolate;$this.settings.showVitaminB12=$this.settings.naVitaminB12?false:$this.settings.showVitaminB12;$this.settings.showBiotin=$this.settings.naBiotin?false:$this.settings.showBiotin;$this.settings.showPantothenicAcid=$this.settings.naPantothenicAcid?false:$this.settings.showPantothenicAcid;$this.settings.showPhosphorus=$this.settings.naPhosphorus?false:$this.settings.showPhosphorus;$this.settings.showIodine=$this.settings.naIodine?false:$this.settings.showIodine;$this.settings.showMagnesium=$this.settings.naMagnesium?false:$this.settings.showMagnesium;$this.settings.showZinc=$this.settings.naZinc?false:$this.settings.showZinc;$this.settings.showSelenium=$this.settings.naSelenium?false:$this.settings.showSelenium;$this.settings.showCopper=$this.settings.naCopper?false:$this.settings.showCopper;$this.settings.showManganese=$this.settings.naManganese?false:$this.settings.showManganese;$this.settings.showChromium=$this.settings.naChromium?false:$this.settings.showChromium;$this.settings.showMolybdenum=$this.settings.naMolybdenum?false:$this.settings.showMolybdenum;$this.settings.showChloride=$this.settings.naChloride?false:$this.settings.showChloride}if($this.settings.hidePercentDailyValues){$this.settings.showVitaminD=false;$this.settings.showCalcium=false;$this.settings.showIron=false;$this.settings.showPotassium_2018=false}for(x=1;x<9;x++){var tab="";for(y=1;y<=x;y++){tab+="\t"}eval("var tab"+x+' = "'+tab+'";')}var borderCSS="";if($this.settings.allowNoBorder){borderCSS="border: 0;"}var nutritionLabel='<div itemscope itemtype="http://schema.org/NutritionInformation" class="nf" style="'+borderCSS;if(!$this.settings.allowCustomWidth){nutritionLabel+=" width: "+$this.settings.width+'px;">\n'}else{nutritionLabel+=" width: "+$this.settings.widthCustom+';">\n'}nutritionLabel+=tab1+'<div class="nf-title" tabindex="0">'+$this.settings.textNutritionFacts+"</div>\n";var sevingUnitQuantityHtml2018Result=sevingUnitQuantityHtml2018($this.settings);var servingSizeIsHidden=sevingUnitQuantityHtml2018Result.servingSizeIsHidden;var servingContainerIsHidden=sevingUnitQuantityHtml2018Result.servingContainerIsHidden;var showLineDiv=$this.settings.showItemName||!$this.settings.showItemName&&servingSizeIsHidden&&servingContainerIsHidden||!$this.settings.showItemName&&$this.settings.originalServingUnitQuantity>0&&$this.settings.valueServingWeightGrams>0||$this.settings.showServingUnitQuantity&&$this.settings.originalServingUnitQuantity>0&&$this.settings.showServingsPerContainer&&$this.settings.valueServingPerContainer>0;if(showLineDiv){nutritionLabel+=tab1+'<div class="nf-line">\n'}if($this.settings.showServingUnitQuantity&&$this.settings.originalServingUnitQuantity>0&&$this.settings.showServingsPerContainer&&$this.settings.valueServingPerContainer>0){nutritionLabel+=tab2+'<div class="nf-per-container" tabindex="0">\n';nutritionLabel+=tab3+parseFloat($this.settings.valueServingPerContainer.toFixed($this.settings.decimalPlacesForNutrition));nutritionLabel+=" "+$this.settings.textServingsPerContainer+"\n";nutritionLabel+=tab2+"</div>\n\n"}nutritionLabel+=tab2+'<div class="nf-serving">\n';nutritionLabel+=sevingUnitQuantityHtml2018Result.nutritionLabel;if($this.settings.showItemName){nutritionLabel+=itemNameHtml2018($this.settings)}nutritionLabel+=tab2+'</div>\x3c!-- end of class="nf-serving" --\x3e\n\n';if(showLineDiv){nutritionLabel+=tab1+'</div>\x3c!-- end of class="nf-line" --\x3e\n\n'}nutritionLabel+=tab1+'<div class="nf-bar2"></div>\n';nutritionLabel+=tab1+'<div class="nf-amount-per-serving" tabindex="0">Amount per serving</div>\n';if($this.settings.showCalories){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueCalories","unitCalories","naCalories","textCalories","calories","nf-calories",false,"roundCalories","","","nf-pr","")}nutritionLabel+=tab1+'<div class="nf-bar1"></div>\n';if(!$this.settings.hidePercentDailyValues){nutritionLabel+=tab1+'<div class="nf-line nf-text-right">\n';nutritionLabel+=tab2+'<span class="nf-highlight nf-percent-dv">% '+$this.settings.textDailyValues+"*</span>\n";nutritionLabel+=tab1+"</div>\n"}if($this.settings.showTotalFat){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueTotalFat","unitTotalFat","naTotalFat","textTotalFat","fatContent","nf-line",true,"roundFat","roundFatRule","nf-highlight","","dailyValueTotalFat")}if($this.settings.showSatFat){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueSatFat","unitSatFat","naSatFat","textSatFat","saturatedFatContent","nf-line nf-indent",true,"roundFat","roundFatRule","","","dailyValueSatFat")}if($this.settings.showTransFat){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueTransFat","unitTransFat","naTransFat","textTransFat","transFatContent","nf-line nf-indent",false,"roundFat","","","","")}if($this.settings.showPolyFat){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valuePolyFat","unitPolyFat","naPolyFat","textPolyFat","","nf-line nf-indent",false,"roundFat","","","","")}if($this.settings.showMonoFat){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueMonoFat","unitMonoFat","naMonoFat","textMonoFat","","nf-line nf-indent",false,"roundFat","","","","")}if($this.settings.showCholesterol){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueCholesterol","unitCholesterol","naCholesterol","textCholesterol","cholesterolContent","nf-line",true,"roundCholesterol","roundCholesterolRule","nf-highlight","","dailyValueCholesterol")}if($this.settings.showSodium){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueSodium","unitSodium","naSodium","textSodium","cholesterolContent","nf-line",true,"roundSodium","roundSodiumRule","nf-highlight","","dailyValueSodium")}if($this.settings.showTotalCarb){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueTotalCarb","unitTotalCarb","naTotalCarb","textTotalCarb","carbohydrateContent","nf-line",true,"roundCarbFiberSugarProtein","roundCarbFiberSugarProteinRule","nf-highlight","","dailyValueCarb")}if($this.settings.showFibers){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueFibers","unitFibers","naFibers","textFibers","fiberContent","nf-line nf-indent",true,"roundCarbFiberSugarProtein","roundCarbFiberSugarProteinRule","","","dailyValueFiber")}if($this.settings.showSugars){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueSugars","unitSugars","naSugars","textSugars","sugarContent","nf-line nf-indent",false,"roundCarbFiberSugarProtein","","","","")}if($this.settings.showAddedSugars){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueAddedSugars","unitAddedSugars","naAddedSugars","textAddedSugars1","","nf-line nf-indent2",true,"roundCarbFiberSugarProtein","roundCarbFiberSugarProteinRule","","","dailyValueAddedSugar")}if($this.settings.showSugarAlcohol){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueSugarAlcohol","unitSugarAlcohol","naSugarAlcohol","textSugarAlcohol","","nf-line nf-indent",false,"roundCarbFiberSugarProtein","","","","")}if($this.settings.showProteins){nutritionLabel+=generateAttributeHtml2018Version($this.settings,"valueProteins","unitProteins","naProteins","textProteins","proteinContent","nf-line",false,"roundCarbFiberSugarProtein","","nf-highlight","","")}if($this.settings.showVitaminD||$this.settings.showCalcium||$this.settings.showIron||$this.settings.showPotassium_2018){nutritionLabel+=tab1+'<div class="nf-bar2"></div>\n';nutritionLabel+=tab1+'<div class="nf-vitamins">\n'}if($this.settings.showVitaminD||$this.settings.showCalcium||$this.settings.showIron||$this.settings.showPotassium_2018){nutritionLabel+=tab2+'<div class="nf-vitamins">\n';if($this.settings.showVitaminD){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueVitaminD","dailyValueVitaminD","unitVitaminD_base","unitVitaminD_percent","naVitaminD","textVitaminD")}if($this.settings.showCalcium){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueCalcium","dailyValueCalcium","unitCalcium_base","unitCalcium_percent","naCalcium","textCalcium")}if($this.settings.showIron){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueIron","dailyValueIron","unitIron_base","unitIron_percent","naIron","textIron")}if($this.settings.showPotassium_2018){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valuePotassium_2018","dailyValuePotassium_2018","unitPotassium_base","unitPotassium_percent","naPotassium_2018","textPotassium")}if($this.settings.showVitaminA_2018){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueVitaminA_2018","dailyValueVitaminA_2018","unitVitaminA_base","unitVitaminA_percent","naVitaminA_2018","textVitaminA")}if($this.settings.showVitaminC_2018){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueVitaminC_2018","dailyValueVitaminC_2018","unitVitaminC_base","unitVitaminC_percent","naVitaminC_2018","textVitaminC")}if($this.settings.showVitaminE){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueVitaminE","dailyValueVitaminE","unitVitaminE_base","unitVitaminE_percent","naVitaminE","textVitaminE")}if($this.settings.showVitaminK){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueVitaminK","dailyValueVitaminK","unitVitaminK_base","unitVitaminK_percent","naVitaminK","textVitaminK")}if($this.settings.showThiamin){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueThiamin","dailyValueThiamin","unitThiamin_base","unitThiamin_percent","naThiamin","textThiamin")}if($this.settings.showRiboflavin){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueRiboflavin","dailyValueRiboflavin","unitRiboflavin_base","unitRiboflavin_percent","naRiboflavin","textRiboflavin")}if($this.settings.showNiacin){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueNiacin","dailyValueNiacin","unitNiacin_base","unitNiacin_percent","naNiacin","textNiacin")}if($this.settings.showVitaminB6){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueVitaminB6","dailyValueVitaminB6","unitVitaminB6_base","unitVitaminB6_percent","naVitaminB6","textVitaminB6")}if($this.settings.showFolate){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueFolate","dailyValueFolate","unitFolate_base","unitFolate_percent","naFolate","textFolate")}if($this.settings.showVitaminB12){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueVitaminB12","dailyValueVitaminB12","unitVitaminB12_base","unitVitaminB12_percent","naVitaminB12","textVitaminB12")}if($this.settings.showBiotin){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueBiotin","dailyValueBiotin","unitBiotin_base","unitBiotin_percent","naBiotin","textBiotin")}if($this.settings.showPantothenicAcid){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valuePantothenicAcid","dailyValuePantothenicAcid","unitPantothenicAcid_base","unitPantothenicAcid_percent","naPantothenicAcid","textPantothenicAcid")}if($this.settings.showPhosphorus){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valuePhosphorus","dailyValuePhosphorus","unitPhosphorus_base","unitPhosphorus_percent","naPhosphorus","textPhosphorus")}if($this.settings.showIodine){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueIodine","dailyValueIodine","unitIodine_base","unitIodine_percent","naIodine","textIodine")}if($this.settings.showMagnesium){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueMagnesium","dailyValueMagnesium","unitMagnesium_base","unitMagnesium_percent","naMagnesium","textMagnesium")}if($this.settings.showZinc){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueZinc","dailyValueZinc","unitZinc_base","unitZinc_percent","naZinc","textZinc")}if($this.settings.showSelenium){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueSelenium","dailyValueSelenium","unitSelenium_base","unitSelenium_percent","naSelenium","textSelenium")}if($this.settings.showCopper){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueCopper","dailyValueCopper","unitCopper_base","unitCopper_percent","naCopper","textCopper")}if($this.settings.showManganese){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueManganese","dailyValueManganese","unitManganese_base","unitManganese_percent","naManganese","textManganese")}if($this.settings.showChromium){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueChromium","dailyValueChromium","unitChromium_base","unitChromium_percent","naChromium","textChromium")}if($this.settings.showMolybdenum){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueMolybdenum","dailyValueMolybdenum","unitMolybdenum_base","unitMolybdenum_percent","naMolybdenum","textMolybdenum")}if($this.settings.showChloride){nutritionLabel+=tab3+generateHtmlAndComputeValueGivenThePercentage($this.settings,"valueChloride","dailyValueChloride","unitChloride_base","unitChloride_percent","naChloride","textChloride")}nutritionLabel+=tab2+"</div>\n"}if($this.settings.showVitaminD||$this.settings.showCalcium||$this.settings.showIron||$this.settings.showPotassium_2018){nutritionLabel+=tab1+"</div>\n"}nutritionLabel+=tab1+'<div class="nf-bar1"></div>\n';nutritionLabel+=tab1+'<div class="'+($this.settings.hidePercentDailyValues?"nf-footnoteHiddenDailyValues":"nf-footnote")+'">\n';if(!$this.settings.hidePercentDailyValues){nutritionLabel+=tab2+'<span tabIndex="0">'+$this.settings.textPercentDaily2018VersionPart1;nutritionLabel+=$this.settings.calorieIntake;nutritionLabel+=$this.settings.textPercentDaily2018VersionPart2+"</span>\n"}if($this.settings.showIngredients){nutritionLabel+=ingredientsHtml2018Version($this.settings)}if($this.settings.showDisclaimer){nutritionLabel+=disclaimerHtml2018Version($this.settings)}nutritionLabel+=tab1+"</div>\n";if($this.settings.showBottomLink){nutritionLabel+=bottomLinkHtml2018Version($this.settings,tab1)}if($this.settings.showCustomFooter){nutritionLabel+=tab1+'<div class="nf-customFooter" tabindex="0">'+$this.settings.valueCustomFooter+"</div>\n"}nutritionLabel+='</div>\x3c!-- closing class="nutritionLabel" --\x3e\n\n';return nutritionLabel+='<div class="naTooltip">Data not available</div>\n'}}})(jQuery);