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

Yahoo Fantasy Baseball Matchups 2008

Displays hitter matchups on the Yahoo Research > Matchup Ratings page in the "Comments" section. Also makes the "Matchup Ratings" sub-tab the default under "Research" instead of "Overview".

about:config options:

hitter_highlight_color - background color used to highlight hitter matchups
pitcher_highlight_color - background color used to highlight pitcher matchups
good_stat_styles - CSS style for good ERA/BA (default - color: green; font-weight: bold;)
bad_stat_styles - CSS style for bad ERA/BA (default - color: red; font-weight: bold;)

Updates:
24-Jun-2008 - Rewrite for 2008 Yahoo site
25-Jun-2008 - Fixed bug that was showing incorrect hitter data, added current season stats vs L/RHP pitching
8-Jul-2008 - Removed debug textarea
21-Jul-2008 - Fixed placement of 'retrieving...' status text so that rows wouldn't expand/contract as much
21-Jul-2008 - Instead of automatically displaying the matchup status, added 'Show Details' link
1-Aug-2008 - Show which way hitter bats (L,R,S)

Was this script helpful? Buy my lunch today! ;) Make a donation

Screenshots:






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

 
Aug 5, 2008
aaron1325714 User

yea that would be it has it always been that way
i probably haven't noticed it before because since it is summer i am staying up late at night so all my roster changes are being made right when the day changes when there is no preview yet

yeah that would be it

thank you

you are the master dude i love you

 
Aug 4, 2008
Glenn Carr Script's author

It's working for me and others. One thing to note is that it will only work for the current day -- there has to be a game preview link next to each player under the 'Status' column. Could that be the issue, trying to view details for a future date?

 
Aug 2, 2008
aaron1325714 User

if you don't "fix" it

could you please give me a link of the script that shows the details

i do not mind if it is an older version

 
Aug 2, 2008
aaron1325714 User

ummm the details are still not working

i click on show details and nothing different shows

 
Aug 1, 2008
Glenn Carr Script's author

Sure, look in the first screenshot.

 
Jul 22, 2008
aaron1325714 User

"21-Jul-2008 - Instead of automatically displaying the match up status, added 'Show Details' link"

where is this link could you post an image of this

because i don't see it on the image here or on my page

and i would really like to see the rest of the match up details

 
Jun 26, 2008
HN User

yes, you are the KING! Thank you for fixing this.

 
Apr 21, 2008
wrveres User

here you go glenn

http://rotodatabase.com/node/712

 
Apr 18, 2008
LenR Scriptwright

Great, but only works for pitchers now, showing undefined for all batters :(

 
Apr 8, 2008
Tim Harding Scriptwright

This is my absolute favorite script, please fix it so stop starting the wrong guys! ;)

 
Apr 4, 2008
HN User

Yeah...same problem for me. It looks great though...especially once hitters are fixed. Great job with all your stuff!

 
Apr 2, 2008
georgie Scriptwright

Same problem. The pitchers show up, but the batters are showing up as "undefined".

 
Mar 30, 2008
Edwin Ortega User

Hi,

I just installed the script, and is only showing the information on the Pitchers, the hitters is not showing anything...

 
Jun 26, 2007
irishwolf6789 User

I see for batters they have career v LHP/RHP but maybe you could have that pitcher's career numbers v. Right and left-handed <u>batters</u>

I know that would go into my decision making.

 
Jun 25, 2007
Dan Russell Scriptwright

I thought I found a bug in your script, but it appears to be Yahoo's fault.

I have Luis Gonzalez on my team and I saw in his matchup with Micah Owings he had an OPS of .000, with 0 hits and 0 AB. I found it odd that a history would show up at all, so I went to the actual Yahoo batter vs. pitcher page for Micah Owings here: http://sports.yahoo.com/mlb/players/7936/batvspit

You can see that LuGo walked twice against him for an OBP of 1.000. Since OPS is simply OBP plus SLG, his OPS should be 1.000, but it's not!

 
Jun 20, 2007
Glenn Carr Script's author

No problem. Glad you found the button ;)

 
Jun 20, 2007
enginedown User

lol there's a button for it, didn't notice that :)

awesomely done. thanks

 
Jun 19, 2007
enginedown User

anybody else having trouble with this one? the status bar has widened to fit the matchup text in there, but there's no text.

 
May 25, 2007
lbjay User

Dude! Thanks for stealing my idea. :) This is awesome.

 
May 22, 2007
JakeS User

Very cool script.

 
May 22, 2007
Dan Russell Scriptwright

This is one of the coolest GM scripts I've ever seen. Nice job!

 
May 9, 2007
Glenn Carr Script's author

Yeah, that's not a bad idea. For now, the 'Hide Matchups' link is the refresh button ;)

re: the "...", nothing fancy, I just ended making a couple of http requests for the hitter matchups, and on the last one I replace the same HTML with an extra dot.

 
May 9, 2007
rodric User

Suggestion: a hide matchups info feature (change Matchups to Hide Matchups when clicked/and toggle).

 
May 9, 2007
rodric User

Nice one. How do you do the completion meter? (the ... that appear while processing)

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