Skip to content

Instantly share code, notes, and snippets.

@eykanal
Created January 11, 2013 20:31
Show Gist options
  • Save eykanal/4513738 to your computer and use it in GitHub Desktop.
Save eykanal/4513738 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Toodledo Add Goal Count
// @namespace
// @include http://www.toodledo.com/organize/goals.php
// @include https://www.toodledo.com/organize/goals.php
// ==/UserScript==
// for each higher-order goal:
// count how many lower-order goals have that stated as a higher-order goal
// display that number next to the higher-order goal
var AddGoalCount = function()
{
for(var n=0; n<3; n++)
{
$(".goalrow[level='"+n+"']").each(function()
{
goalCount = $("option[value='668656'][selected='selected']").size();
var useCount;
if($(this).find("useCount").size() === 0)
{
useCount = $(this).find("input[name^='goal']").after("<div id='useCount'></div>");
} else {
useCount = $(this).find("#useCount");
}
useCount.text("Referenced by "+goalCount+" goals");
});
}
}
$(AddGoalCount());
$("select[name^='cont']").click(function() {
AddGoalCount();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment