Skip to content

Commit

Permalink
worked on task well-949
Browse files Browse the repository at this point in the history
  • Loading branch information
majin22 committed Oct 17, 2021
1 parent 3a9664e commit 71da1c7
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 106 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nutrition-label-jquery-plugin",
"version": "11.0.4",
"version": "11.0.5",
"homepage": "https://github.com/nutritionix/nutrition-label",
"authors": [
"Leo Joseph Gajitos <leejay22@gmail.com>",
Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

version 11.0.5 - October 17, 2021

- accessibility improvements listed here https://github.com/nutritionix/nutrition-label/issues/134

------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
version 11.0.4 - December 12, 2020

- css changes from Rommel to fix the validation issue "contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds" for Axe https://dequeuniversity.com/rules/axe/3.5/region?application=AxeChrome
Expand Down
4 changes: 2 additions & 2 deletions dist/css/nutritionLabel-min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/css/nutritionLabel.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* @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 11.0.4 |
* @stable version 11.0.2 |
* @current version 11.0.5 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
* |
Expand Down
6 changes: 3 additions & 3 deletions dist/js/nutritionLabel-min.js

Large diffs are not rendered by default.

77 changes: 39 additions & 38 deletions dist/js/nutritionLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* @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 11.0.4 |
* @stable version 11.0.2 |
* @current version 11.0.5 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
* |
Expand Down Expand Up @@ -1695,8 +1695,24 @@
//https://github.com/nutritionix/nutrition-label/wiki/How-the-Percent-Daily-Value-is-Computed
let localNutritionLabel = globalTab1 + '<div class="' + lineClass + '" tabindex="0">\n';

if (boldName) {
localNutritionLabel += globalTab2 + '<strong>' + $localSettings[attributeTexts] + '</strong> <span itemprop="' + itemPropValue + '">';
} else {
localNutritionLabel += globalTab2 + $localSettings[attributeTexts] + ' <span itemprop="' + itemPropValue + '">';
}

localNutritionLabel += (
$localSettings[naIndex] ?
localNaValue :
(
$localSettings.allowFDARounding ?
eval(roundFunctionName)($localSettings[valueIndex], $localSettings.decimalPlacesForNutrition) :
roundLoDash($localSettings[valueIndex], $localSettings.decimalPlacesForNutrition)
) + $localSettings[unitIndex]
) + '\n';

if (!$localSettings['hidePercentDailyValues'] && showPercentageCode) {
localNutritionLabel += globalTab2 + '<div class="dv" aria-hidden="true">';
localNutritionLabel += globalTab2 + '<div class="dv">';
localNutritionLabel += $localSettings[naIndex] ?
localNaValue :
'<strong>' +
Expand All @@ -1710,25 +1726,10 @@
) * 100,
$localSettings.decimalPlacesForDailyValues
) +
'</strong>%';
'</strong>% <span class="sr-only">' + $localSettings.textDailyValues + '</span>';
localNutritionLabel += '</div>\n';
}

if (boldName) {
localNutritionLabel += globalTab2 + '<strong>' + $localSettings[attributeTexts] + '</strong> <span itemprop="' + itemPropValue + '">';
} else {
localNutritionLabel += globalTab2 + $localSettings[attributeTexts] + ' <span itemprop="' + itemPropValue + '">';
}

localNutritionLabel += (
$localSettings[naIndex] ?
localNaValue :
(
$localSettings.allowFDARounding ?
eval(roundFunctionName)($localSettings[valueIndex], $localSettings.decimalPlacesForNutrition) :
roundLoDash($localSettings[valueIndex], $localSettings.decimalPlacesForNutrition)
) + $localSettings[unitIndex]
) + '\n';
return localNutritionLabel += globalTab1 + '</span></div>\n';
}//end of => function generateAttributeWithPercentageHtmlLegacy(**too many parameters**)

Expand All @@ -1745,24 +1746,6 @@
$localSettings.textDataNotAvailable + '</font>\n';
let localNutritionLabel = globalTab1 + '<div class="' + topDivClass + '" tabindex="0">\n';

if (showPercentageCode && !$localSettings['hidePercentDailyValues']) {
localNutritionLabel += globalTab2 + '<span class="nf-highlight nf-pr" aria-hidden="true">';
//https://github.com/nutritionix/nutrition-label/wiki/How-the-Percent-Daily-Value-is-Computed
localNutritionLabel += $localSettings[naIndex] ?
localNaValue :
roundLoDash(
(
(
$localSettings.allowFDARounding ? eval(roundFunctionRuleName)($localSettings[valueIndex]) : $localSettings[valueIndex]
) / (
$localSettings[dailyValueIndex] == 0 ? 1 : $localSettings[dailyValueIndex] * roundLoDash(parseFloat($localSettings.calorieIntake) / 2000, 2)
)
) * 100,
$localSettings.decimalPlacesForDailyValues
) + '%';
localNutritionLabel += '</span>\n';
}

//this is for everything else
if (valueIndex != 'valueAddedSugars') {
localNutritionLabel += globalTab2 + '<span class="' + labelClass + '">';
Expand Down Expand Up @@ -1795,6 +1778,24 @@
localNutritionLabel += '</span>\n';
}

if (showPercentageCode && !$localSettings['hidePercentDailyValues']) {
localNutritionLabel += globalTab2 + '<span class="nf-highlight nf-pr">';
//https://github.com/nutritionix/nutrition-label/wiki/How-the-Percent-Daily-Value-is-Computed
localNutritionLabel += $localSettings[naIndex] ?
localNaValue :
roundLoDash(
(
(
$localSettings.allowFDARounding ? eval(roundFunctionRuleName)($localSettings[valueIndex]) : $localSettings[valueIndex]
) / (
$localSettings[dailyValueIndex] == 0 ? 1 : $localSettings[dailyValueIndex] * roundLoDash(parseFloat($localSettings.calorieIntake) / 2000, 2)
)
) * 100,
$localSettings.decimalPlacesForDailyValues
) + '% <span class="sr-only">' + $localSettings.textDailyValues + '</span>';
localNutritionLabel += '</span>\n';
}

return localNutritionLabel += globalTab1 + '</div>\n';
}//end of => function generateAttributeHtml2018Version(**too many parameters**)

Expand Down Expand Up @@ -1854,7 +1855,7 @@
$localSettings[unitIndex_base] +
(
showPercentageCode ?
' <span class="nf-pr" aria-hidden="true">' +
' <span class="nf-pr">' +
roundLoDash($localSettings[valueIndex], $localSettings.decimalPlacesForDailyValues) + $localSettings[unitIndex_percent] +
'</span>' :
''
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* @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 11.0.4 |
* @stable version 11.0.2 |
* @current version 11.0.5 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
* |
Expand All @@ -29,7 +29,7 @@
<body>
<div class="container" style="width: 1250px;">
<div class="hero-unit">
<h1>Nutrition Label version 11.0.4</h1>
<h1>Nutrition Label version 11.0.5</h1>
<h4>from Nutritionix</h4>
<h4><a href="http://github.com/nutritionix/nutrition-label" target="_newDemo">Homepage</a></h4>
<p>
Expand Down
4 changes: 2 additions & 2 deletions nutritionLabel-min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions nutritionLabel-min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* @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 11.0.4 |
* @stable version 11.0.2 |
* @current version 11.0.5 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
* |
Expand Down Expand Up @@ -105,7 +105,7 @@
}

.nutritionLabel .dvCalorieDiet {
color: #777;
color: #707070;
}
.nutritionLabel .calorieNote {
padding: .60em 0 0 .70em;
Expand All @@ -117,7 +117,7 @@
font-size: .7em;
border-bottom: 1px solid #333;
text-align: left;
color: #777;
color: #707070;
}
.nutritionLabel .tblCalorieDiet {
width: 100%;
Expand All @@ -126,7 +126,7 @@
padding: 0;
line-height: normal;
font-size: .7em;
color: #777;
color: #707070;
}
.nutritionLabel .ar {
text-align: right;
Expand All @@ -139,7 +139,7 @@
}

.nutritionLabel #calcDisclaimer {
color: #777;
color: #707070;
}

.notApplicable{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* @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 11.0.4 |
* @stable version 11.0.2 |
* @current version 11.0.5 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
* |
Expand Down Expand Up @@ -2275,7 +2275,7 @@
}

//creates the html code for the label based on the settings
nutritionLabel = '<div itemscope itemtype="http://schema.org/NutritionInformation" class="nutritionLabel" style="' + borderCSS;
nutritionLabel = '<div itemscope itemtype="http://schema.org/NutritionInformation" class="nutritionLabel" role="region" aria-label="nutrition label" style="' + borderCSS;
if (!$this.settings.allowCustomWidth) {
nutritionLabel += ' width: ' + $this.settings.width + 'px;">\n';
} else {
Expand Down Expand Up @@ -2562,7 +2562,7 @@
}

//creates the html code for the label based on the settings
nutritionLabel = '<div itemscope itemtype="http://schema.org/NutritionInformation" class="nf" style="' + borderCSS;
nutritionLabel = '<div itemscope itemtype="http://schema.org/NutritionInformation" class="nf" role="region" aria-label="nutrition label" style="' + borderCSS;
if (!$this.settings.allowCustomWidth) {
nutritionLabel += ' width: ' + $this.settings.width + 'px;">\n';
} else {
Expand Down Expand Up @@ -2911,7 +2911,7 @@
}

//creates the html code for the label based on the settings
nutritionLabel = '<div itemscope itemtype="http://schema.org/NutritionInformation" class="uk_nf uk" style="' + borderCSS;
nutritionLabel = '<div itemscope itemtype="http://schema.org/NutritionInformation" role="region" aria-label="nutrition label" class="uk_nf uk" style="' + borderCSS;
if (!$this.settings.allowCustomWidth) {
nutritionLabel += ' width: ' + $this.settings.width + 'px;">\n';
} else {
Expand Down
Loading

0 comments on commit 71da1c7

Please sign in to comment.