How to Track Weight Watchers Points on MFP!!

Options
1252628303134

Replies

  • mkookies
    mkookies Posts: 67 Member
    Options
    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. :)

  • torrance86
    torrance86 Posts: 12 Member
    Options
    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.
  • ginique
    ginique Posts: 49 Member
    Options
    mkookies 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!
  • spattengillcare
    spattengillcare Posts: 1 Member
    Options
    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?
  • Dlynch50
    Dlynch50 Posts: 2 Member
    Options
    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!
  • Dlynch50
    Dlynch50 Posts: 2 Member
    Options
    Looks like it still gives points for fruit! I edited script to say true for points plus. Any suggestions?
  • lizbartlett1980
    lizbartlett1980 Posts: 1 Member
    Options
    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!!
  • TripMom
    TripMom Posts: 102 Member
    Options
    Bump
  • rayqd2
    rayqd2 Posts: 6 Member
    Options
    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...?
  • rcknrobin30
    rcknrobin30 Posts: 1 Member
    edited March 2015
    Options
    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!
  • fraserkr
    fraserkr Posts: 110 Member
    Options
    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 ...
  • fraserkr
    fraserkr Posts: 110 Member
    edited March 2015
    Options
    dup post, sorry
  • canucksweetie
    canucksweetie Posts: 14 Member
    Options
    mkookies 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. :)
  • canucksweetie
    canucksweetie Posts: 14 Member
    Options
    mkookies 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. :(
  • Spidermurphy116
    Spidermurphy116 Posts: 8 Member
    Options
    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.
  • CorrieLA
    CorrieLA Posts: 51 Member
    Options
    This is so great!! Thanks for all the advice everyone! It works on Chrome for me!
  • clueliss64
    clueliss64 Posts: 1 Member
    Options
    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.
  • camilledaisy
    camilledaisy Posts: 33 Member
    Options
    Bump
  • LillianPag
    LillianPag Posts: 25 Member
    Options
    WOW just came across this today...awesome. It took me about 2 minutes to set up thanks all.
  • kimjschroeder
    kimjschroeder Posts: 35 Member
    Options
    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?