How to Track Weight Watchers Points on MFP!!
Replies
-
You can use the app on your phone and double track but WW is sooooo propriety they won’t share data. Somewhere on MFP is a script for installing a conversion to convert MFP food into WW points but (as far as I know) its in the old point system and only works on computer. My IT son had to install it for me but it was a headache0
-
If someone can get this to work it would be awesome, Don't like double tracking!1
-
Updated the script. I'm using FireFox w/ Tampermonkey on a Mac. I also updated the calcs, using https://wonkypie.com/ww-points-calculators/
// ==UserScript==
// @name MyFitnessPal Weight Watchers Points
// @version 2.0
// @description Add WW Smart Points to MFP
// @author Modified by Bondservant75
// @match https://www.myfitnesspal.com/food/diary
// @icon https://www.google.com/s2/favicons?domain=myfitnesspal.com
// @include http://www.myfitnesspal.com/food/diary/*
// @include https://www.myfitnesspal.com/food/diary/*
// ==/UserScript==
// Originally from: https://github.com/LeChuck71/MFP_WW_Points/blob/master/MFP_WW_Points.user.js but had to change a few things
(function() {
'use strict';
var usePointCalculation ="SmartPoints";
// original: Don't know why you'd use this.
// PointsPlus: be sure to set the 2nd option under Nutrients Tracked to "Fat" under Food > Food Diary > Settings
// SmartPoints be sure to set the 2nd option under Nutrients Tracked to "Saturated Fat" under Food > Food Diary > Settings
var precisonWW = true; //Change to true for true fractional point values (instead of just .25, .50, and .75)
var totalPoints = 0;
function startRun() {
var script = document.createElement('script');
script.setAttribute('src', 'https://www.google.com/jsapi');
script.addEventListener('load', function () {
loadscripts_1();
}, false);
document.body.appendChild(script);
}
function getPointOld(calories, fat, fiber, carbs, protein, sugar)
{
var points = 0;
switch (usePointCalculation) {
case "original":
if (fiber > 4 ) {
fiber = 4;
}
points = ((calories) / 50) + (fat / 12) - (fiber / 5);
break;
case "SmartPoints":
points = ((calories)+(4*sugar)+(9*fat)-(3.2*protein))/33
break;
case "PointsPlus":
points = ((3.2*protein)+(3.8*(carbs-fiber))+(9*fat)+(1*fiber))/35;
break;
}
if (precisonWW)
{
points = Math.round(points);
}
else
{
var intPoints = Math.floor(points);
var fraction = points - intPoints;
if (fraction < 0.25){
points = intPoints + 0;}
else if (fraction >= 0.25 && fraction < 0.75){
points = intPoints + 0.5;}
else{
points = intPoints + 1;}
}
return points;
}
function main()
{
$('tr:first').append('<th >');
$('tr:not(:first)').append('<td>');
var totalFound = false;
var diaryTable$ = $('.table0');
var totalPoints = 0;
var columnIndexMap = {
calories: -1,
carbs: -1,
fat: -1,
fiber: -1,
protein: -1,
sugar: -1,
remove: -1
};
//alert($(diaryTable$[12]).text());
diaryTable$.find('tr').each(function (rowInd)
{
if (rowInd === 0 && $(this).hasClass('meal_header')) {
$(this).append('<td class="alt">' + usePointCalculation +'</td>');
columnIndexMap = BuildColumnIndexMap($(this));
}
if (!totalFound && $(this).hasClass('total'))
{
totalFound = true;
$(this).find('td').eq(columnIndexMap.remove).html(totalPoints);
}
var fiber = 0;
var calories = 0;
var carbs = 0;
var fat = 0;
var protein = 0;
var sugar = 0;
var cols = $(this).find('td').each(function (column)
{
var value = GetNumberFromCell($(this));
console.log(column);
//console.log(JSON.parse(JSON.stringify(column)));
switch (column) {
case columnIndexMap.calories:
calories = value;
break;
case columnIndexMap.carbs:
carbs = value;
break;
case columnIndexMap.fat:
fat = value;
break;
case columnIndexMap.fiber:
fiber = value;
break;
case columnIndexMap.protein:
protein = value;
break;
case columnIndexMap.sugar:
sugar = value;
break;
case columnIndexMap.remove-1:
if ($(this).hasClass('delete')) {
var points = getPointOld(calories, fat, fiber, carbs, protein, sugar);
totalPoints += points;
$(this).next().append(points);
}
break;
}
});
});
}
function BuildColumnIndexMap(row$) {
var columnIndexMap = {
calories: -1,
carbs: -1,
fat: -1,
fiber: -1,
protein: -1,
remove: -1
};
row$.find('td').each(function (index) {
var text = $(this).text();
if (text.indexOf("Calories") != -1)
{
columnIndexMap.calories = index;
}
else if (text.indexOf("Carbs") != -1)
{
columnIndexMap.carbs = index;
}
else if (text.indexOf("Fat") != -1)
{
columnIndexMap.fat = index;
}
else if (text.indexOf("Fiber") != -1)
{
columnIndexMap.fiber = index;
}
else if (text.indexOf("Protein") != -1)
{
columnIndexMap.protein = index;
}
else if (text.indexOf("Sugar") != -1)
{
columnIndexMap.sugar = index;
}
});
columnIndexMap.remove = row$.find('td').length;
return columnIndexMap;
}
function GetNumberFromCell(cell) {
return parseInt(cell.text().replace(',', ''), 10);
}
function loadscripts_1()
{
var script = document.createElement('script');
script.setAttribute('src', 'https://code.jquery.com/jquery-3.4.1.min.js');
script.addEventListener('load', function () {
loadscripts_2();
}, false);
document.body.appendChild(script);
}
function loadscripts_2()
{
jQuery.noConflict();
/* fix for old prototype conflict with google viz api */
/* retrieves the Array reduce native function using cleverness */
var ifr = document.createElement('iframe');
document.body.appendChild(ifr);
Array.prototype.reduce = ifr.contentWindow.Array.prototype.reduce;
document.body.removeChild(ifr);
google.load('visualization', '1', {
packages: [
'corechart'
],
'callback': main
});
}
startRun();
})();0 -
Oops - forgot to adjust the includes (line 8 and 9) so it works for any day. Just copy everything BELOW the line. You'll will get error warnings when doing syntax checks in Tampermonkey but you can ignore them. Mine says there are 15 of them. (The interpreter doesn't like the JQuery stuff.)
Again, I'm using the free calcs posted on https://wonkypie.com/ww-points-calculators/. My guess is that they aren't exact but are very close. (I currently have WW as well)
//-- starting copy below this line ----
// ==UserScript==
// @name MyFitnessPal Weight Watchers Points
// @version 2.0
// @description Add WW Smart Points to MFP
// @author Modified by Bondservant75
// @match https://www.myfitnesspal.com/food/diary
// @icon https://www.google.com/s2/favicons?domain=myfitnesspal.com
// @include http://www.myfitnesspal.com/food/diary*
// @include https://www.myfitnesspal.com/food/diary*
// ==/UserScript==
// Originally from: https://github.com/LeChuck71/MFP_WW_Points/blob/master/MFP_WW_Points.user.js but had to change a few things
(function() {
'use strict';
var usePointCalculation ="SmartPoints";
// original: Don't know why you'd use this.
// PointsPlus: be sure to set the 2nd option under Nutrients Tracked "Fat" under Food > Food Diary > Settings
// SmartPoints be sure to set the 2nd option under Nutrients Tracked "Saturated Fat" under Food > Food Diary > Settings
var precisonWW = true; //Change to true for true fractional point values (instead of just .25, .50, and .75)
var totalPoints = 0;
function startRun() {
var script = document.createElement('script');
script.setAttribute('src', 'https://www.google.com/jsapi');
script.addEventListener('load', function () {
loadscripts_1();
}, false);
document.body.appendChild(script);
}
function getPointOld(calories, fat, fiber, carbs, protein, sugar)
{
var points = 0;
switch (usePointCalculation) {
case "original":
if (fiber > 4 ) {
fiber = 4;
}
points = ((calories) / 50) + (fat / 12) - (fiber / 5);
break;
case "SmartPoints":
points = ((calories)+(4*sugar)+(9*fat)-(3.2*protein))/33
break;
case "PointsPlus":
points = ((3.2*protein)+(3.8*(carbs-fiber))+(9*fat)+(1*fiber))/35;
break;
}
if (precisonWW)
{
points = Math.round(points);
}
else
{
var intPoints = Math.floor(points);
var fraction = points - intPoints;
if (fraction < 0.25){
points = intPoints + 0;}
else if (fraction >= 0.25 && fraction < 0.75){
points = intPoints + 0.5;}
else{
points = intPoints + 1;}
}
return points;
}
function main()
{
$('tr:first').append('<th >');
$('tr:not(:first)').append('<td>');
var totalFound = false;
var diaryTable$ = $('.table0');
var totalPoints = 0;
var columnIndexMap = {
calories: -1,
carbs: -1,
fat: -1,
fiber: -1,
protein: -1,
sugar: -1,
remove: -1
};
//alert($(diaryTable$[12]).text());
diaryTable$.find('tr').each(function (rowInd)
{
if (rowInd === 0 && $(this).hasClass('meal_header')) {
$(this).append('<td class="alt">' + usePointCalculation +'</td>');
columnIndexMap = BuildColumnIndexMap($(this));
}
if (!totalFound && $(this).hasClass('total'))
{
totalFound = true;
$(this).find('td').eq(columnIndexMap.remove).html(totalPoints);
}
var fiber = 0;
var calories = 0;
var carbs = 0;
var fat = 0;
var protein = 0;
var sugar = 0;
var cols = $(this).find('td').each(function (column)
{
var value = GetNumberFromCell($(this));
console.log(column);
//console.log(JSON.parse(JSON.stringify(column)));
switch (column) {
case columnIndexMap.calories:
calories = value;
break;
case columnIndexMap.carbs:
carbs = value;
break;
case columnIndexMap.fat:
fat = value;
break;
case columnIndexMap.fiber:
fiber = value;
break;
case columnIndexMap.protein:
protein = value;
break;
case columnIndexMap.sugar:
sugar = value;
break;
case columnIndexMap.remove-1:
if ($(this).hasClass('delete')) {
var points = getPointOld(calories, fat, fiber, carbs, protein, sugar);
totalPoints += points;
$(this).next().append(points);
}
break;
}
});
});
}
function BuildColumnIndexMap(row$) {
var columnIndexMap = {
calories: -1,
carbs: -1,
fat: -1,
fiber: -1,
protein: -1,
remove: -1
};
row$.find('td').each(function (index) {
var text = $(this).text();
if (text.indexOf("Calories") != -1)
{
columnIndexMap.calories = index;
}
else if (text.indexOf("Carbs") != -1)
{
columnIndexMap.carbs = index;
}
else if (text.indexOf("Fat") != -1)
{
columnIndexMap.fat = index;
}
else if (text.indexOf("Fiber") != -1)
{
columnIndexMap.fiber = index;
}
else if (text.indexOf("Protein") != -1)
{
columnIndexMap.protein = index;
}
else if (text.indexOf("Sugar") != -1)
{
columnIndexMap.sugar = index;
}
});
columnIndexMap.remove = row$.find('td').length;
return columnIndexMap;
}
function GetNumberFromCell(cell) {
return parseInt(cell.text().replace(',', ''), 10);
}
function loadscripts_1()
{
var script = document.createElement('script');
script.setAttribute('src', 'https://code.jquery.com/jquery-3.4.1.min.js');
script.addEventListener('load', function () {
loadscripts_2();
}, false);
document.body.appendChild(script);
}
function loadscripts_2()
{
jQuery.noConflict();
/* fix for old prototype conflict with google viz api */
/* retrieves the Array reduce native function using cleverness */
var ifr = document.createElement('iframe');
document.body.appendChild(ifr);
Array.prototype.reduce = ifr.contentWindow.Array.prototype.reduce;
document.body.removeChild(ifr);
google.load('visualization', '1', {
packages: [
'corechart'
],
'callback': main
});
}
startRun();
})();1 -
How to track WW? Don't2
-
Thank you @bondservant75 This works for me!!
The more data the better to keep me motivated. WW worked for me years ago but I've got a yearly sub to MFP and I still want to track macros, etc. Plus integration with Fitbit is useful to me as well.
Hoping to make some post-pandemic positive health changes.0 -
I still can't get the script to work1 Any help would be appreciated
0 -
Update got it to work this morning! Thank you @bondservant750
-
I just switched from WW to MFP. I would also appreciate step by step instructions to calculate my points on MFP0
Categories
- All Categories
- 1.4M Health, Wellness and Goals
- 393.3K Introduce Yourself
- 43.8K Getting Started
- 260.2K Health and Weight Loss
- 175.9K Food and Nutrition
- 47.4K Recipes
- 232.5K Fitness and Exercise
- 424 Sleep, Mindfulness and Overall Wellness
- 6.5K Goal: Maintaining Weight
- 8.5K Goal: Gaining Weight and Body Building
- 153K Motivation and Support
- 8K Challenges
- 1.3K Debate Club
- 96.3K Chit-Chat
- 2.5K Fun and Games
- 3.7K MyFitnessPal Information
- 24 News and Announcements
- 1.1K Feature Suggestions and Ideas
- 2.6K MyFitnessPal Tech Support Questions