How to Track Weight Watchers Points on MFP!!
Replies
-
WalkingAlong wrote: »Is there any reason I can't paste the script here to simplify things? SCRIPT CODE:
(function () {
// ==UserScript==
// @name MyFitnessPal Weight Watchers Points
// @version 1.1.4
// @description Adds display of Weightwatcher points to any daily food diary page. Also adds "Real Calories" calcalation based off 4/4/9 algorithm.
// @include http://www.myfitnesspal.com/food/diary/*
// @include https://www.myfitnesspal.com/food/diary/*
// ==/UserScript==
var pointsPlus=true;
var precisonWW=true;
if (window.top !== window.self) {
return; /* do not run in frames */
}
if (typeof unsafeWindow != 'undefined')
{
(function page_scope_runner() {
// If we're _not_ already running in the page, grab the full source
// of this script.
var my_src = "(" + page_scope_runner.caller.toString() + ")();";
// Create a script node holding this script, plus a marker that lets us
// know we are running in the page scope (not the Greasemonkey sandbox).
// Note that we are intentionally *not* scope-wrapping here.
var script = document.createElement('script');
script.setAttribute("type", "application/javascript");
script.textContent = my_src;
document.body.appendChild(script);
})();
return;
}
function startRun() {
var script = document.createElement("script");
script.setAttribute("src", "http://www.google.com/jsapi");
script.addEventListener('load', function() {
loadscripts_1();
}, false);
document.body.appendChild(script);
}
var points, totalPoints=0;
function getPointOld(cal1, fat1, fiber1, carbs, protein)
{
points=0;
if (fiber1>4 && !pointsPlus)
fiber1=4;
points = cal1/50;
points += fat1/12;
points -= fiber1/5;
if (pointsPlus)
points = (protein / 10.94) + (carbs / 9.17) + (fat1/3.89)- (fiber1 / 12.49);
//alert(points);
if (precisonWW)
{
points=Math.round(points)
}
else
{
var intPoints = Math.floor(points);
fraction = points - intPoints;
if (fraction<0.25)
points = intPoints + 0.0;
else if (fraction>=0.25 && fraction<0.75)
points = intPoints +0.5;
else
points = intPoints+1;
}
}
function main()
{
//$("tr:first").append('<col class="col-2" />');
$("tr:first").append('<th >');
$("tr:not(:first)").append("<td>");
var found=false;
var totalFound=false;
var table1 = jQuery('.table0');
var totalPoints=0;
//alert($(table1[12]).text());
var rowInd=-1;
table1.find('tr').each(function()
{
rowInd++;
var index=0;
found=false;
if ($(this).hasClass('meal_header') && rowInd==0)
$(this).append('<td class="alt">Weight Watcher Points+</td>');
if (!totalFound && $(this).hasClass('total'))
{
totalFound=true;
$(this).find('td').eq(7).html(totalPoints);
}
var cols=$(this).find('td').each(function()
{
if (index==0)
;
else if (index==1)
{
cal11=($(this).text());
}
else if (index==2)
carbs=($(this).text());
else if (index==3)
fat11=$(this).text();
else if (index==4)
fiber11=$(this).text();
else if (index==5)
protein=($(this).text());
else if (index==6 && $(this).hasClass('delete'))
{
found=true;
getPointOld(cal11, fat11, fiber11, carbs, protein);
totalPoints+=points;
//$(this).append(points);
}
else
{
if (found)
$(this).append(points);
/*if (totalFound)
{
totalFound=false;
$(this).append('<td/><td/><td/>'+totalPoints);
}*/
}
index +=1;
}
);
});
}
function loadscripts_1()
{
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.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();
})();
It works in Chrome, now!
I had to do it manually. I clicked on Tampermonkey in the upper right corner of Chrome, and "Add a new script". I copied that exact code above into the box and hit save. Voila!
I hope my trial and error helps others using Chrome.
1 -
I use MFP daily to track/log meals/exercise and LOVE IT! But it sure would be helpful if it could track WW points. Can it? I use Google Chrome desktop, or ipad, or android phone.0
-
WalkingAlong wrote: »Is there any reason I can't paste the script here to simplify things? SCRIPT CODE:
(function () {
// ==UserScript==
// @name MyFitnessPal Weight Watchers Points
// @version 1.1.4
// @description Adds display of Weightwatcher points to any daily food diary page. Also adds "Real Calories" calcalation based off 4/4/9 algorithm.
// @include http://www.myfitnesspal.com/food/diary/*
// @include https://www.myfitnesspal.com/food/diary/*
// ==/UserScript==
var pointsPlus=true;
var precisonWW=true;
if (window.top !== window.self) {
return; /* do not run in frames */
}
if (typeof unsafeWindow != 'undefined')
{
(function page_scope_runner() {
// If we're _not_ already running in the page, grab the full source
// of this script.
var my_src = "(" + page_scope_runner.caller.toString() + ")();";
// Create a script node holding this script, plus a marker that lets us
// know we are running in the page scope (not the Greasemonkey sandbox).
// Note that we are intentionally *not* scope-wrapping here.
var script = document.createElement('script');
script.setAttribute("type", "application/javascript");
script.textContent = my_src;
document.body.appendChild(script);
})();
return;
}
function startRun() {
var script = document.createElement("script");
script.setAttribute("src", "http://www.google.com/jsapi");
script.addEventListener('load', function() {
loadscripts_1();
}, false);
document.body.appendChild(script);
}
var points, totalPoints=0;
function getPointOld(cal1, fat1, fiber1, carbs, protein)
{
points=0;
if (fiber1>4 && !pointsPlus)
fiber1=4;
points = cal1/50;
points += fat1/12;
points -= fiber1/5;
if (pointsPlus)
points = (protein / 10.94) + (carbs / 9.17) + (fat1/3.89)- (fiber1 / 12.49);
//alert(points);
if (precisonWW)
{
points=Math.round(points)
}
else
{
var intPoints = Math.floor(points);
fraction = points - intPoints;
if (fraction<0.25)
points = intPoints + 0.0;
else if (fraction>=0.25 && fraction<0.75)
points = intPoints +0.5;
else
points = intPoints+1;
}
}
function main()
{
//$("tr:first").append('<col class="col-2" />');
$("tr:first").append('<th >');
$("tr:not(:first)").append("<td>");
var found=false;
var totalFound=false;
var table1 = jQuery('.table0');
var totalPoints=0;
//alert($(table1[12]).text());
var rowInd=-1;
table1.find('tr').each(function()
{
rowInd++;
var index=0;
found=false;
if ($(this).hasClass('meal_header') && rowInd==0)
$(this).append('<td class="alt">Weight Watcher Points+</td>');
if (!totalFound && $(this).hasClass('total'))
{
totalFound=true;
$(this).find('td').eq(7).html(totalPoints);
}
var cols=$(this).find('td').each(function()
{
if (index==0)
;
else if (index==1)
{
cal11=($(this).text());
}
else if (index==2)
carbs=($(this).text());
else if (index==3)
fat11=$(this).text();
else if (index==4)
fiber11=$(this).text();
else if (index==5)
protein=($(this).text());
else if (index==6 && $(this).hasClass('delete'))
{
found=true;
getPointOld(cal11, fat11, fiber11, carbs, protein);
totalPoints+=points;
//$(this).append(points);
}
else
{
if (found)
$(this).append(points);
/*if (totalFound)
{
totalFound=false;
$(this).append('<td/><td/><td/>'+totalPoints);
}*/
}
index +=1;
}
);
});
}
function loadscripts_1()
{
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.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();
})();
It works in Chrome, now!
I had to do it manually. I clicked on Tampermonkey in the upper right corner of Chrome, and "Add a new script". I copied that exact code above into the box and hit save. Voila!
I hope my trial and error helps others using Chrome.
This DEFINITELY helped me, as I was having the same issue. I've been using WW exclusively for months with great success (for some reason, I find WW points easier to track than calories on MFP, strangely enough). But MFP has the better scanning abilities via the mobile app, so this is the best of both worlds. Thank you!0 -
I'm a bit lost, could someone kindly tell me exactly what to do to get WW points added? And does this work on the mobile app?
0 -
Thank you, I have some friends who use WW and some who use MFP. I was always curious about which way is better to track. Although, tracking works as long as you are tracking somewhere. Wish it worked on the app too!0
-
Looks like it still gives points for fruit! I edited script to say true for points plus. Any suggestions?0
-
Can anyone help me troubleshoot? I installed Tampermokey, added the copied code above as instructed, made sure that I have Calories-Carbs-Fat-Fiber-Protein displayed in MFP, and restarted Chrome (and then my computer) and I'm still not seeing the WW Points column in my Food Diary. Am I missing something? Thanks so much!!0
-
Bump0
-
Wow, I just finally successfully added this. For my day, I was perfectly within my MFP calorie limit but it was 41 WW points! My normal WW allotment is 30 points. What should I make of this...?0
-
I see the WW Points+ column, but there are no numbers. (I'm using Chrome)
Update- I removed sugar and it worked. My points are accurate!0 -
I just discovered this thread today. WHEE. got it to work with chrome. I do have a programming background, so that helped me to sort of understand ...0
-
dup post, sorry0
-
WalkingAlong wrote: »Is there any reason I can't paste the script here to simplify things? SCRIPT CODE:
(function () {
// ==UserScript==
// @name MyFitnessPal Weight Watchers Points
// @version 1.1.4
// @description Adds display of Weightwatcher points to any daily food diary page. Also adds "Real Calories" calcalation based off 4/4/9 algorithm.
// @include http://www.myfitnesspal.com/food/diary/*
// @include https://www.myfitnesspal.com/food/diary/*
// ==/UserScript==
var pointsPlus=true;
var precisonWW=true;
if (window.top !== window.self) {
return; /* do not run in frames */
}
if (typeof unsafeWindow != 'undefined')
{
(function page_scope_runner() {
// If we're _not_ already running in the page, grab the full source
// of this script.
var my_src = "(" + page_scope_runner.caller.toString() + ")();";
// Create a script node holding this script, plus a marker that lets us
// know we are running in the page scope (not the Greasemonkey sandbox).
// Note that we are intentionally *not* scope-wrapping here.
var script = document.createElement('script');
script.setAttribute("type", "application/javascript");
script.textContent = my_src;
document.body.appendChild(script);
})();
return;
}
function startRun() {
var script = document.createElement("script");
script.setAttribute("src", "http://www.google.com/jsapi");
script.addEventListener('load', function() {
loadscripts_1();
}, false);
document.body.appendChild(script);
}
var points, totalPoints=0;
function getPointOld(cal1, fat1, fiber1, carbs, protein)
{
points=0;
if (fiber1>4 && !pointsPlus)
fiber1=4;
points = cal1/50;
points += fat1/12;
points -= fiber1/5;
if (pointsPlus)
points = (protein / 10.94) + (carbs / 9.17) + (fat1/3.89)- (fiber1 / 12.49);
//alert(points);
if (precisonWW)
{
points=Math.round(points)
}
else
{
var intPoints = Math.floor(points);
fraction = points - intPoints;
if (fraction<0.25)
points = intPoints + 0.0;
else if (fraction>=0.25 && fraction<0.75)
points = intPoints +0.5;
else
points = intPoints+1;
}
}
function main()
{
//$("tr:first").append('<col class="col-2" />');
$("tr:first").append('<th >');
$("tr:not(:first)").append("<td>");
var found=false;
var totalFound=false;
var table1 = jQuery('.table0');
var totalPoints=0;
//alert($(table1[12]).text());
var rowInd=-1;
table1.find('tr').each(function()
{
rowInd++;
var index=0;
found=false;
if ($(this).hasClass('meal_header') && rowInd==0)
$(this).append('<td class="alt">Weight Watcher Points+</td>');
if (!totalFound && $(this).hasClass('total'))
{
totalFound=true;
$(this).find('td').eq(7).html(totalPoints);
}
var cols=$(this).find('td').each(function()
{
if (index==0)
;
else if (index==1)
{
cal11=($(this).text());
}
else if (index==2)
carbs=($(this).text());
else if (index==3)
fat11=$(this).text();
else if (index==4)
fiber11=$(this).text();
else if (index==5)
protein=($(this).text());
else if (index==6 && $(this).hasClass('delete'))
{
found=true;
getPointOld(cal11, fat11, fiber11, carbs, protein);
totalPoints+=points;
//$(this).append(points);
}
else
{
if (found)
$(this).append(points);
/*if (totalFound)
{
totalFound=false;
$(this).append('<td/><td/><td/>'+totalPoints);
}*/
}
index +=1;
}
);
});
}
function loadscripts_1()
{
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.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();
})();
It works in Chrome, now!
I had to do it manually. I clicked on Tampermonkey in the upper right corner of Chrome, and "Add a new script". I copied that exact code above into the box and hit save. Voila!
I hope my trial and error helps others using Chrome.
This was super helpful thank you!! Has anyone got fancy and added to the code their personal daily goal and the calculation for remaining. Not that I can't just do that manually. I'm just anal like that. Messing around with the code myself haven't got to it yet.0 -
canucksweetie wrote: »WalkingAlong wrote: »Is there any reason I can't paste the script here to simplify things? SCRIPT CODE:
(function () {
// ==UserScript==
// @name MyFitnessPal Weight Watchers Points
// @version 1.1.4
// @description Adds display of Weightwatcher points to any daily food diary page. Also adds "Real Calories" calcalation based off 4/4/9 algorithm.
// @include http://www.myfitnesspal.com/food/diary/*
// @include https://www.myfitnesspal.com/food/diary/*
// ==/UserScript==
var pointsPlus=true;
var precisonWW=true;
if (window.top !== window.self) {
return; /* do not run in frames */
}
if (typeof unsafeWindow != 'undefined')
{
(function page_scope_runner() {
// If we're _not_ already running in the page, grab the full source
// of this script.
var my_src = "(" + page_scope_runner.caller.toString() + ")();";
// Create a script node holding this script, plus a marker that lets us
// know we are running in the page scope (not the Greasemonkey sandbox).
// Note that we are intentionally *not* scope-wrapping here.
var script = document.createElement('script');
script.setAttribute("type", "application/javascript");
script.textContent = my_src;
document.body.appendChild(script);
})();
return;
}
function startRun() {
var script = document.createElement("script");
script.setAttribute("src", "http://www.google.com/jsapi");
script.addEventListener('load', function() {
loadscripts_1();
}, false);
document.body.appendChild(script);
}
var points, totalPoints=0;
function getPointOld(cal1, fat1, fiber1, carbs, protein)
{
points=0;
if (fiber1>4 && !pointsPlus)
fiber1=4;
points = cal1/50;
points += fat1/12;
points -= fiber1/5;
if (pointsPlus)
points = (protein / 10.94) + (carbs / 9.17) + (fat1/3.89)- (fiber1 / 12.49);
//alert(points);
if (precisonWW)
{
points=Math.round(points)
}
else
{
var intPoints = Math.floor(points);
fraction = points - intPoints;
if (fraction<0.25)
points = intPoints + 0.0;
else if (fraction>=0.25 && fraction<0.75)
points = intPoints +0.5;
else
points = intPoints+1;
}
}
function main()
{
//$("tr:first").append('<col class="col-2" />');
$("tr:first").append('<th >');
$("tr:not(:first)").append("<td>");
var found=false;
var totalFound=false;
var table1 = jQuery('.table0');
var totalPoints=0;
//alert($(table1[12]).text());
var rowInd=-1;
table1.find('tr').each(function()
{
rowInd++;
var index=0;
found=false;
if ($(this).hasClass('meal_header') && rowInd==0)
$(this).append('<td class="alt">Weight Watcher Points+</td>');
if (!totalFound && $(this).hasClass('total'))
{
totalFound=true;
$(this).find('td').eq(7).html(totalPoints);
}
var cols=$(this).find('td').each(function()
{
if (index==0)
;
else if (index==1)
{
cal11=($(this).text());
}
else if (index==2)
carbs=($(this).text());
else if (index==3)
fat11=$(this).text();
else if (index==4)
fiber11=$(this).text();
else if (index==5)
protein=($(this).text());
else if (index==6 && $(this).hasClass('delete'))
{
found=true;
getPointOld(cal11, fat11, fiber11, carbs, protein);
totalPoints+=points;
//$(this).append(points);
}
else
{
if (found)
$(this).append(points);
/*if (totalFound)
{
totalFound=false;
$(this).append('<td/><td/><td/>'+totalPoints);
}*/
}
index +=1;
}
);
});
}
function loadscripts_1()
{
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.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();
})();
It works in Chrome, now!
I had to do it manually. I clicked on Tampermonkey in the upper right corner of Chrome, and "Add a new script". I copied that exact code above into the box and hit save. Voila!
I hope my trial and error helps others using Chrome.
This was super helpful thank you!! Has anyone got fancy and added to the code their personal daily goal and the calculation for remaining. Not that I can't just do that manually. I'm just anal like that. Messing around with the code myself haven't got to it yet.
Darn spoke too soon. Worked great for a day. Today it doesn't work? Tried deleting it and adding again. No go.0 -
Does anyone know if you can add the WW points if you are using Chrome. I can't use Firefox, long story, don't ask.0
-
This is so great!! Thanks for all the advice everyone! It works on Chrome for me!0
-
Chrome success. thanks.
One question - which iteration of the WW points system is this based on so I an lookup the appropriate points value I should be following.0 -
Bump0
-
WOW just came across this today...awesome. It took me about 2 minutes to set up thanks all.0
-
I need HELP. I followed everything, but no points column is showing up. When I click on the monkey icon, it says
"no installed script runs on this page". I have rebooted Firefox and nothing. Anyone have any ideas how to fix?0 -
Okay, so I got it working in Chrome. I pasted in the script into Tampermonkey as described above. Then I restarted Chrome Windows 7. I ran into a couple of problems.
First, I had to go to Settings > Diary Settings and set it to the following order exactly: Calories, carbs, fat, fiber, protein, none. (I wanted iron to be one of the things I track, but it didn't work).
Second, it seems like it doesn't always work if you just navigate to your diary using the MFP buttons. I had to paste the URL http://www.myfitnesspal.com/food/diary/ in and hit enter. No big deal, I can just make a favorite to that.
Finally, it seems like it takes a few minutes for the extra column to appear after the page loads so watch out for that.
Hope it helps. I don't want to use WWs software, but I also want to have some idea of what points I'm eating for when I go to meetings.
0 -
I've been tracking WW through MFP on Chrome and love it! I have the Chrome app on my phone. Does anyone know if there is a Greasemonkey, Tampermonkey, something I can add to the Chrome app to make it show the WW points on my phone?0
-
mine only works if I use the link http://www.myfitnesspal.com/food/diary/ as per midsummer1 instructions but I can only view points for the same day. If I go back to previous day no points are shown... any thoughts?
0 -
Thanks for this awesome script. I tweaked it a bit and figured out how to make it show the points if you go to previous days.
At the top of the script you will see:// @include http://www.myfitnesspal.com/food/diary/
Put this under directly under:// @include http://www.myfitnesspal.com/food/diary?*
0 -
Add this as well so that the points will show when you click the "FOOD" tab on the website:
// @include http://www.myfitnesspal.com/food/diary
0 -
Does this work with the phone app???0
-
bump0
-
Thank you, thank you, thank you! All you smart coders just made my day! I was able to get this to work in both Firefox and Chrome! I am so grateful!0
-
Thanks. Works well. Switched back to MFP because they changed the points system again..0
-
Hi,
I hope someone is still following this thread because I need help. I'm on a Macbook and using Chrome. I copied the script at the top of this page and pasted in the Tampermonkey editor and saved it (as suggested). I've changed the values in lines 9 & 10 to "true" (var pointsPlus=true;).
I have the WW points column on my "food" tab but no values show up at all. I also followed Tatooz305 regarding the tweaks (a few posts earlier). Nothing has worked. I've gone through this thread from top to bottom and had no success.
Can someone please talk me through everything step by step? Or is there an obvious step missing? I've spent hours on this already. Lol
Also, would it be difficult to rework this algorithm to reflect the newest changes to WW (ie. Smart Points)?
Thanks so much for your help.
0
Categories
- All Categories
- 1.4M Health, Wellness and Goals
- 393.2K 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
- 421 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
- 23 News and Announcements
- 1.1K Feature Suggestions and Ideas
- 2.6K MyFitnessPal Tech Support Questions