How to Track Weight Watchers Points on MFP!!

11718192123

Replies

  • Odessit68
    Odessit68 Posts: 1 Member
    @alloy1028 Thank you for the script. It works great, except it doesn't seem to get all the points quite right. :smile:
    I was trying to figure out the formula that you were using and couldn't.
    The formula that I've found on another web site is (calories + 4xSugar + 9xSat.Fat - 3.2xProtein)/33
  • TC4IOWASTATE
    TC4IOWASTATE Posts: 64 Member
    Cool, cant' wait until this afternoon to try to do this. Thank you.
  • jan_michelle_clark
    jan_michelle_clark Posts: 1 Member
    I can't get the points to display in my diary what am I doing wrong?
  • heathercaldwell75
    heathercaldwell75 Posts: 2 Member
    Worked perfectly - thank you!
  • cassalon
    cassalon Posts: 1 Member
    Thank you to so many of you for your help. This used to work on Firefox, then didn't, then did occasionally. Now after tweaking line 5 and 6 of the script and removing the / - it works!
  • midsummer174627
    midsummer174627 Posts: 386 Member
    I tried Zaphod71's github script for Smart Points. I had to remove the final / from lines 6 & 7 as someone suggested, but now it works fine. . . Except that the calculations are way off. For example WW says a Haas Avocado is 7 points, but the script says it's 17.5!

    Right now I have my nutrients set in this order: Saturated Fat, Protein, Fat, Sugar, None.

    Any suggestions?
  • golfgame
    golfgame Posts: 2 Member
    Has anyone been able to update the WW pts to the new "New Smart Points"?
  • golfgame
    golfgame Posts: 2 Member
    I tried Zaphod71's github script for Smart Points. I had to remove the final / from lines 6 & 7 as someone suggested, but now it works fine. . . Except that the calculations are way off. For example WW says a Haas Avocado is 7 points, but the script says it's 17.5!

    Right now I have my nutrients set in this order: Saturated Fat, Protein, Fat, Sugar, None.

    Any suggestions?

    How about furnishing the script or a link to it? Thanks
  • Limon421
    Limon421 Posts: 23 Member
    I do mfp on my phone. But covert to points with the sp calculator. I count all foods, nothing free.
  • ahtullos
    ahtullos Posts: 2 Member
    Does anyone know of a script for WW Fit Points??
  • mboushey
    mboushey Posts: 1 Member
    edited June 2016
    This has worked for me for a few weeks and is all of a sudden only showing 0 points for everything. Anyone else experiencing this?

    Here's the link to the script I'm using: https://github.com/LeChuck71/MFP_WW_Points/raw/master/MFP_WW_Points.user.js
  • lentzche
    lentzche Posts: 2 Member
    I just installed the script and running into the same issue as mboushey - the column is there but it is only showing 0 points for everything.
  • lentzche
    lentzche Posts: 2 Member
    Zahpod71 wrote: »
    Hey glad it works for you ;)

    If you can check the points calculation and give me some feedback would be great.
    I did it on some foods and recipes and it was fine compared to the original WW tool on an ipad.

    Cheers

    I followed the instructions and the column displays, but everything just calculates to 0. Any idea what I am doing wrong?
  • Themdragons
    Themdragons Posts: 3 Member
    is this link still working for anyone.
  • heathercaldwell75
    heathercaldwell75 Posts: 2 Member
    Nto working for me anymore. It's just calculating the points to zero now. @alloy1028 or @Zahpod71 any suggestions? Thank you in advance!
  • tenreps
    tenreps Posts: 136 Member
    Really not many calories in veggie's but In fruit yes because of the sugar, the only way you could have a lot of calories in veggies is if one loads them with butter and such, and also consuming veggies by the time one digest's them they become water---that's the reason WW makes them free points.
  • debrag12
    debrag12 Posts: 1,071 Member
    Nto working for me anymore. It's just calculating the points to zero now. @alloy1028 or @Zahpod71 any suggestions? Thank you in advance!

    Not just me then
  • atirmae
    atirmae Posts: 2 Member
    Mine are all registering as zero now as well.
  • tineyd00
    tineyd00 Posts: 1 Member
    MFP changed it's column names so the script is a little wonky. I tried to submit a pull request to LeChuck71's script, but it looks like it's a read only repository. So here is the updated script that fixes that.

    All credit obviously goes to LeChuck71 & the original poster

    (function () {
    // ==UserScript==
    // @name MyFitnessPal Weight Watchers Points
    // @version 1.3
    // @description Adds display of Weight Watcher points to any daily food diary page. Also adds "Real Calories" calculation based off 4/4/9 algorithm.
    // @include http://www.myfitnesspal.com/food/diary/*
    // @include https://www.myfitnesspal.com/food/diary/*
    // ==/UserScript==
    // Originally from: http://userscripts-mirror.org/scripts/show/122949

    var usePointCalculation ="SmartPoints"; //Change to true to:
    // original
    // PointsPlus
    // SmartPoints !make sure "Saturated Fat" ist listet in your MFP diary!
    // to change calculation formula
    var precisonWW = false; //Change to true for true fractional point values (instead of just .25, .50, and .75)
    var totalPoints = 0;
    /*
    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);
    }
    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 "PointsPlus":
    points = (protein / 10.94) + (carbs / 9.17) + (fat / 3.89) - (fiber / 12.49);
    break;
    case "SmartPoints":
    points = (calories*0.0303) + (sugar*0.1212) + (fat*0.2727) - (protein*0.0970);
    break;
    }

    //alert(points);

    if (precisonWW)
    {
    points = Math.round(points);
    }
    else
    {
    var intPoints = Math.floor(points);
    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(value);
    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', '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();
    })();
  • dwchin
    dwchin Posts: 1 Member
    tineyd00 wrote: »
    MFP changed it's column names so the script is a little wonky. I tried to submit a pull request to LeChuck71's script, but it looks like it's a read only repository. So here is the updated script that fixes that.

    All credit obviously goes to LeChuck71 & the original poster

    Thank you!! The revised script fixed it. Nerd question, but how did you figure out the new column names?

  • Joleca
    Joleca Posts: 29 Member
    How do I install the script above, and what should I put in MFP for the display (columns and order). Thanks!!!
  • LeanneCutrara
    LeanneCutrara Posts: 31 Member
    awesome that you have been able to update the script however I am still seeing zero's in my smart points column....help
  • LeanneCutrara
    LeanneCutrara Posts: 31 Member
    I have tried everything. I see the box smart points but its still zero
  • wessj03
    wessj03 Posts: 1 Member
    I've got the script working enough to give me the Smart Points column, but nothing registers any points. everything shows up as 0. Any thoughts on that?

    Thanks!
  • pphrog
    pphrog Posts: 4 Member
    Save
  • LeanneCutrara
    LeanneCutrara Posts: 31 Member
    I got it to work tonight sooooo happy.. copied the script above from Tineyd00 and it works!
  • Leemom3
    Leemom3 Posts: 103 Member
    Hi All,
    Trying to do this now, in 2017. When I click on the link for the Greasemonkey install above, I get the message that the install was successful, then...nothing. Literally, the web address says <about:blank> I have the script info, I have Greasemonkey installed, and am using Firefox. But...I am not a computer-knowledgeable person. Any ideas to help me move along?
    Thanks.
  • Finally got to work in Tampermonkey on my Android tablet using Chrome. Copied script above (Tinyd00), pasted into Tampermonkey and used carbs, saturated fat, fiber, protein for column heads
  • Leemom3
    Leemom3 Posts: 103 Member
    Any help for Mac users, please?
  • TopoliT
    TopoliT Posts: 11 Member
    Hello all! I've installed Greasemonkey on Firefox, and tried Tinyd00's script, copied and pasted from above, thank you! At first it showed a SmartPoints column to the right of Calories Carbs Fat Fiber Protein. If I enter an item in my food diary it does indeed show up as Points! :)
    However, I've realized that since I am currently enrolled in Weight Watchers, what I really want is to enter Points in WW online, and have it enter the calories into MFP! :p