Extra caution is recommended when installing recently uploaded/updated scripts (read more)
Be sure you trust any scripts you install

Yahoo! Fantasy Hockey Stat Tracker

A script that provides free stat tracking functionality for Yahoo fantasy hockey.

This script is heavily based on RoboBruin's baseball stat tracker.

To launch the stat tracker, click on the blue button that says Show Stats when viewing a team page.

Current Version: 1.2.1 - Oct. 25, 2007
Recent changes - Fixed bug with Empty player




Aug 9, 2008
aaron1325714 User

hey glenn i know my question has nothing to do with this script but i couldnt find your email anywhere

so i was wondering if you could create this script except for baseball it is a bench all players without a game script

http://userscripts.org/scripts/show/6716

that is the script link

and here is the actual script

// ==UserScript==
// @name Yahoo Fantasy NBA Bench All
// @namespace http://mattandchristy.net/benchall
// @description Provides a button to bench all players without a game
// @include http://basketball.fantasysports.yahoo.com/nba/*...=*
// @include http://basketball.fantasysports.yahoo.com/nba/*...
// ==/UserScript==
//
// Change log:
// 2006-12-10 Initial version of script; used Yahoo Fantasy NBA Game Log Link
// as a base to start developing

var doBench = function(event) {

var allElements;
var thisElement;
var playerLink = "http://sports.yahoo.com/nba/players/"
var gameLogLink;


allElements = document.evaluate(
"//*[contains(@class, 'player')]/..",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);

// burn the first two rows; they are headers, not players
for (var i = 2; i < allElements.snapshotLength; i++) {

thisElement = allElements.snapshotItem(i);

tds = thisElement.getElementsByTagName('td');
nameNode = tds[1];
if(nameNode) {
// td div a textnode value
name = nameNode.firstChild.firstChild.firstChild.nodeValue;

// get the opponent TD's innerHTML; text node won't work because
// the ? for 'no opponent' gets translated to a character =/
opp = tds[3].innerHTML;

if(opp == '?') {

newPosSelectNode = tds[2].firstChild;
// select the 'BN' node for these guys (last option)
newPosSelectNode.selectedIndex = newPosSelectNode.length-1;

GM_log("Benching " + name);
}
}
}

// stop event propagation, if this was a click
if(event) {
event.stopPropagation();
event.preventDefault();
}
}

/* gameLogLink = document.createElement('a'); */
/* gameLogLink.setAttribute("href",thisElement.href + "/gamelog") */
/* //gameLogLink.setAttribute("class","cellindent") */
/* gameLogLink.setAttribute("target","_blank") */
/* gameLogLink.setAttribute("title","game log link") */
/* gameLogLink.innerHTML = "" */
/* thisElement.parentNode.insertBefore(gameLogLink, thisElement.nextSibling.nextSibling); */

var BENCHBUTTON_ID = "bencherButton";
var BENCHBUTTON_TEXT = "[Bench players with no game]";

// create the bench button
var bencher = document.createElement("A");
bencher.addEventListener("click", doBench, true);
bencher.href = "#";
bencher.innerHTML = BENCHBUTTON_TEXT;
bencher.className = 'button';
/* bencher.style.backgroundColor = "#D8D9D5"; */
/* bencher.style.borderTopColor = "#A8A8A8"; */
/* bencher.style.borderBottomColor = "#A8A8A8"; */
/* bencher.style.borderLeftColor = "#A8A8A8"; */
/* bencher.style.borderRightColor = "#A8A8A8"; */
/* bencher.style.borderTopStyle = "outset"; */
/* bencher.style.borderBottomStyle = "outset"; */
/* bencher.style.borderLeftStyle = "outset"; */
/* bencher.style.borderRightStyle = "outset"; */
/* bencher.style.borderTopWidth = "1px"; */
/* bencher.style.borderBottomWidth = "1px"; */
/* bencher.style.borderLeftWidth = "1px"; */
/* bencher.style.borderRightWidth = "1px"; */
bencher.style.paddingTop = "2px";
bencher.style.paddingBottom = "5px";
bencher.style.paddingLeft = "5px";
bencher.style.paddingRight = "5px";
bencher.style.color = "#FFFFFF";
bencher.id = BENCHBUTTON_ID;

// attach the bench button right before the "submit changes" button
// at the bottom of the screen
var buttonBar = document.getElementById('buttonbar');
var inputs = buttonBar.getElementsByTagName('input');
var submitButton = inputs[inputs.length-1]
buttonBar.insertBefore(bencher, submitButton);

i tried to mess around with it a little bit but got no luck

please respond soon

i will post this on a couple other pages to ensure that you get the message

Aaron S

 
Feb 12, 2008
shaeltar User

For H2H leagues, it would need to show both your stats and your opponent's stats for the week. Perhaps this would mean the script would need to be executed from the Matchup page.

As for the GUI, the only major addition would be to have the totals for each of the two teams stat categories at the top in a table. Then the first team with the player stats like you already have; then the other team's players formatted the same way. (This basically describes what StatTracker looks like now.)

Additional features would maybe include a way to switch to total player stats for the week.

 
Feb 5, 2008
bearzly Script's author

I've never been involved in a H2H league before so if someone could post the functionality that you expect, it would help me out a lot.

 
Jan 30, 2008
devohoang User

nm ignore my previous msg...it started working again

 
Jan 25, 2008
devohoang User

oh oh...as of today, is it just me or has Yahoo changed something? the stats no longer load and the status (score) of actual occurring games aren't updated real-time(or at least close to it like before). This is the same case with my NBA league too...I'm hoping it's just my pc...

 
Jan 21, 2008
Fred Marshall User

I 2nd the motion for H2H use, any luck with that? Script looks great, nice work.

Although I am having trouble with the width. I tried changing the width to 500px, and it didn't look like it did anything.

Also, my points column is coming up with a -. Do I need to add something to the script? I also have two GA categories when there should be a GA and GAA. Any ideas on that?

Thanks a ton!

 
Dec 5, 2007
georgie Scriptwright

It works, there's a button that says "show stats".

 
Dec 5, 2007
bobielawlintine Scriptwright

StatTracker ad is now gone, and the script no longer works.

 
Nov 11, 2007
the_expat User

In my fantasy world...
I see integration
I see easily definable stats
I see simultaneous H2H stats
I see a black moon a risin'....

nice job bearzly so far

 
Nov 11, 2007
kr580 User

This is awesome bearzly. Thanks much!

I don't think it's possible but I might as well ask... Would it be possible to get a real-time Matchup page for us H2H users? Something similar to this to make the Matchup page show current values.

Either way I'll still use this script. Thanks again!

 
Nov 8, 2007
pantera1988 User

Is there a way we can get GAA(goals against average) and not just goals against. I was just wondering because yahoo has GAA and i was just wondering if we could get that. Great code by the way. It works amazing.

 
Nov 7, 2007
khtm User

Integration would be cool, but if it's a lot of effort I wouldn't bother. It's definitely functional the way it is now.

 
Nov 3, 2007
bearzly Script's author

I'm planning to use the ESPN box scores instead of yahoo soon, which will let me do faceoffs and also GAA/SO. GWG is trickier to do but I plan to do it.

Also, I'm interested to know if people would like it better if the stats were integrated into the page like with the original, or if you like the overlay. It probably wouldn't be too hard to integrate it if that is what most people want.

 
Oct 29, 2007
FatalMatt User

Try and make it look exactly like the original StatTracker. =P

No I don't want to go to far. This script really helps. Does this track Game Winning Goals to?

 
Oct 28, 2007
the_expat User

Really more of an info than stats issue but my GAME column is not refreshing with the stats. If I load the script and COL is winning 3-1, 1st period, it will read that way the entire night even tho the score is now 5-4 DET, 3rd period.
Hitting refresh with the script does nothing; I have to refresh the yahoo page, and then click the stats button to load again.

 
Oct 26, 2007
bobielawlintine Scriptwright

I'm not sure if it's a problem universally, but line 276 has an error. Instead of "stattracker", it must match "get stattracker". Otherwise, you'll get the promo ad.

 
Oct 26, 2007
blaurg User

Yup that fixed the goalie problem. Thanks!

 
Oct 26, 2007
grapey User

Yes, I think it was definitely the empty player slot problem. Golaie stats are working perfectly now.

 
Oct 25, 2007
bearzly Script's author

I just fixed a problem with player slots that were Empty, so that might be the problem with goalies. Make sure to get the latest version.

 
Oct 25, 2007
bearzly Script's author

I really have no idea what is going on with the goalies as I have yet to witness the problem myself. You can help me by checking your javascript console for any errors, or if you are in a public league you could link me to where you can't see your goalies.

 
Oct 25, 2007
swuster User

Thanks! Works great now!

 
Oct 25, 2007
FatalMatt User

Thanks for letting me know how to change the width. I made it look almost like the old StatTracker and everything!

 
Oct 25, 2007
JSee User

Last night clicking on "Show Stats" worked for me perfectly, all but one thing. My goalies didn't show up. I had 2 goalies playing, but they just were not listed. The other 3 guys in my pool's goalies showed up when I clicked on their profiles then clicked on "Show Stats". It was kind of frustrating to be able to see their goalies, but not mine. Do you know what's going on? PS - The script rules!

 
Oct 25, 2007
bearzly Script's author

It's because while the stat tracker ad is there, the headers that show your stats aren't. To get around this you can either wait for the ad to go away, or click one of the links such as Last Week and then hit the Show Stats button.

 
Oct 25, 2007
swuster User

awesome script!

Just installed it and it seems that for today not all of the stats are shown. When I look at previous days or upcoming ones, then all of my stats are working. Any reason for this or is it just a glitch today?

You could comment on this script if you were logged in.