How to Track Weight Watchers Points on MFP!!

Options
1212224262734

Replies

  • aprilcherie
    aprilcherie Posts: 6 Member
    Options
    I'm with you. I cannot get this thing to work.
  • lbransford
    lbransford Posts: 9 Member
    Options
    bump
  • Siobhan_83
    Options
    I just get "Web application could not be started" when I copy and paste the script address. What am I doing wrong?

    When I open the link today, it says the same thing as you. Very strange. This worked for me the other day when I did it, now the script isn't opening. My MFP diary still has my points though.

    Can someone better with computers help?
  • md523083
    md523083 Posts: 37 Member
    Options
    Can someone help me do this in Chrome, or point me in the directions of instructions?
  • PurplePixieWings
    Options
    I found a mirror site: http://userscripts-mirror.org/scripts/show/122949 and it seems to be working. Good Luck!
  • WalkingAlong
    WalkingAlong Posts: 4,926 Member
    Options
    I got it to work in Chrome. Thanks to all! I installed TamperMonkey, pasted in the script from the tampermonkey forum link on the previous page here and added the ( to the beginning that was missing. And changed both lines to 'true'. I did reorder my MFP macros in settings here first.

    I checked the code for the PP calc and it's pretty close to a spreadsheet I've been using that calcs points plus but this one doesn't have any handling for alcohol grams, so it won't do anything alcoholic well at all.
  • md523083
    md523083 Posts: 37 Member
    Options
    it still doesn't work for me... did you install the script at the script's address, then add it to TamperMonkey? When I go to TamperMonkey on my sidebar it says No Scripts Running. I do have it enabled.
  • WalkingAlong
    WalkingAlong Posts: 4,926 Member
    Options
    I fiddled a bunch and can't recall exactly which made it work but I think I did this, from the prior page here on this thread:

    "http://forum.tampermonkey.net/viewtopic.php?f=17&t=623&p=2518#p2518 I was able to open the TamperMonkey extension, select to add a new script and copy the script displayed on the page I just listed and save it with the required edits suggested on that page and within this thread (to enable PointsPlus "

    Someone pasted the whole script in that TamperMonkey forum thread but she had missed the opening (, which someone mentioned in reply. So I copied that script out and added the (. I just don't recall if I added it as a new script in TamperMonkey or what, from there. I must have. I don't know what else I would've pasted it to to make it work. (Looking again at TamperMonkey, I'm pretty sure that's what I did. Under where it says 'no scripts running' there is 'add a new script'. You can edit the script in TamperMonkey after you paste it in. Going into TM now it tells me there are no scripts running but the PP column is here and works and I can go to Dashboard in TM and edit the script.)

    Good luck!
  • WalkingAlong
    WalkingAlong Posts: 4,926 Member
    Options
    Is there any reason I can't paste the script here to simplify things?

    (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();
    })();
  • md523083
    md523083 Posts: 37 Member
    Options
    THAT worked!!!! Thank you for posting the whole thing. When I did the script it only had 10 lines... I didn't know all that info was missing! Awesome!
  • WalkingAlong
    WalkingAlong Posts: 4,926 Member
    Options
    Do you feel like you climbed a mountain? I did! I think I've tried to get this thing to run several times and always gave up in frustration. It's so nice now to have the huge MFP database to search on.
  • md523083
    md523083 Posts: 37 Member
    Options
    yes! lol. I've been tracking WW points in the notes section of MFP. This is way better though! I also figured out how to track calories but not points- just make a custom food and call it something like WW- zero points and only enter the calorie count of the food. So I did "WW-zero points Strawberries" and tracked 50 calories, but no points.
  • WalkingAlong
    WalkingAlong Posts: 4,926 Member
    Options
    Good idea. I think I will need to make a custom food that is "one WW point" so I can use it to Quick Add in points.
  • skrlec70
    skrlec70 Posts: 302 Member
    Options
    I tracked both for 4 days and each time WW told me I was done my points, and MFP showed I had 400 calories left, enough said, I dumped weighwatchers.
  • runner115
    runner115 Posts: 321 Member
    Options
    OMG I did it!

    Thanks to Releasingitforgood's May 9 instructions plus the full script provided by WalkingAlong...I was able to get the column to appear on my food diary but it still wouldn't populate...thanks to Siobhan's screen shot I realized I had an extra column. Once I deleted it the pp values appeared~it takes a village!!!

    Sadly - that was the easy part...hard part is being disciplined to journal all my meals...what I really need is a group to stay accountable where we post points consumed daily. If anyone starts one please let me know.

    Thanks again everyone - I'm really excited to have the wwpp calculations on my mfp food log!
  • md523083
    md523083 Posts: 37 Member
    Options
    sklrc70 - if you had 400 calories left and WW said you were done with your points, then you're supposed to eat 400 calories of zero point food. Actually, if you look at my diary you will see I eat a ton of food that's zero points (fruits, vegetables, some condiments) but that still contain calories. So for example, if you're supposed to eat 26 points per day (the lowest number allowed), you're supposed to fill in the rest of the day with zero-point food and enough servings they tell you to eat. That's 2-3 cups of fruit and like 8-10 cups of veggies. You'll be full after that, promise!
  • WalkingAlong
    WalkingAlong Posts: 4,926 Member
    Options
    Yes, WW doesn't tell you "you're done" at 26. It's up to you when you're done. You can go on eating zero point foods or eat from your WPs or your APs or stop. It's a lot more flexible than MFP's 1200 calorie hard target.
  • lizzielou179
    lizzielou179 Posts: 5 Member
    Options
    Thanks so much for this. :smile:
  • KayLynn702
    KayLynn702 Posts: 11 Member
    Options
    This took me a couple tries, but I was able to successfully do it on Firefox.
    Thank you for this!
  • pj4jj48
    pj4jj48 Posts: 2
    Options
    That worked! Thanks!