Jump to content

The Official MVPSavReader Thread


Trues

Recommended Posts

hey anyone have the say 1800+ MLB playerpics for a download??

I've been working on some. have about 10 teams completed. 330 photos. Right now I'm just working on the NL. but if you want them let me know.

Link to comment
Share on other sites

  • Replies 703
  • Created
  • Last Reply

Code box? Sorry to sound so stupid, but are the sortables only available if uploading to a web page?

I don't think so. Try downloading this file and place it in your "MVPSavReader" directory (or where ever you have your pages). I think it should work ok. Not sure if its the exact file Rich is using, but it's working :)

sorttable.js (right click save target as)

Link to comment
Share on other sites

you can use sorting so long as you have the jre (java runtime environment) installed on your computer. if you use XP, you have to download it from sun.

edit: actually maybe you just need the plugin for your browser. dunno too much about java.

Link to comment
Share on other sites

Sorry about the sorttable.js not being included guys. The one edm posted works fine, but I did tweak a few things in it. Here's my version:

// This code originally comes from:

// http://www.kryogenix.org/code/browser/sorttable/

// 2004-12-03: Modifications by mcramer@pbs.org: http://blog.webkist.com/archives/000043.html

// 2005-01-07: Modifications by Anthony.Garrett@aods.org (tested IE 6.0.28, Opera 7.54, Firefox 1.0)

// [Problem: Firefox 1.0 won't display the span style for the up and down arrows.]

// 2005-01-11: Anthony.Garrett@aods.org Fixed small bug:

// Error occurred when clicking on column header link just to the right of the text.

// 2005-01-11: mcramer@pbs.org integrated AG's fixes and added support for <select> sorting.

// 2005-01-13: mcramer@pbs.org: Caching optimizations. Should be faster on big tables.

// 2005-04-29: mcramer@pbs.org: Style fix, "nosort" stuff, and don't link empty headers.

addEvent(window, "load", sortables_init);

var SORT_COLUMN_INDEX;

// Set this array up for any language you choose.

// You can use any strings you like for the months as long as the array matches the data.

var monthName = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',

'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');

function sortables_init() {

// Find all tables with class sortable and make them sortable

if (!document.getElementsByTagName)

return;

tbls = document.getElementsByTagName("table");

for (ti = 0; ti < tbls.length; ti++) {

thisTbl = tbls[ti];

if (((' ' + thisTbl.className + ' ').indexOf(" sortable ") != -1) && (thisTbl.id)) {

ts_makeSortable(thisTbl);

}

}

}

function ts_makeSortable(table) {

var firstRow;

for (var i = 0; i < table.rows.length; i++) {

firstRow = table.rows;

if ((firstRow.cells) && (firstRow.cells[0].nodeName == "TD") && (i>0)) {

firstRow = table.rows[i - 1];

break;

}

}

if (!firstRow)

return;

// IE 6.0.28 Resets checkbox values to their initial state on sort.

// BUG (see http://www.quirksmode.org/bugreports/archi..._checkbox.html)

// solution 1: Don't use a crappy browser like IE.

// solution 2: Store the checkbox state and restore after move.

// --> solution 3: Set defaultChecked to the value of checked each time the checkbox is changed.

// AG Avoid IE bug that uses "defaultChecked" when it should use "checked" on move of element

var inputs = document.getElementsByTagName("input");

for (var i = 0; i < inputs.length; i++) {

if (inputs.type.toLowerCase() == 'checkbox')

addEvent(inputs, "change", ts_persistCheckbox);

}

// We have a first row: assume it's the header, and make its contents clickable links

for (var i = 0; i < firstRow.cells.length; i++) {

var cell = firstRow.cells;

if(cell.childNodes.length > 0 && cell.className.indexOf("nosort") == -1) {

var link = document.createElement("a");

link.href = "#";

link.style.textDecoration = "none";

link.className = "sortheader"; // AG Added (makes the styling work)

addEvent(link, "click", ts_resortTable);

var l = cell.childNodes.length;

while (cell.childNodes.length > 0) {

link.appendChild(cell.childNodes[0]);

}

var span = document.createElement("span");

span.className = "sortarrow";

span.innerHTML = '&nbsp;&nbsp;';

link.appendChild(span);

cell.appendChild(link);

}

}

}

function ts_getInnerText(el) {

if (typeof el == "string" || typeof el == "undefined")

return el;

if(el.ts_allText)

return el.ts_allText;

var str = new Array();

var cs = el.childNodes;

for (var i = 0; i < cs.length; i++) {

switch (cs.nodeType) {

case 1: // ELEMENT_NODE

if(cs.tagName.toLowerCase() == 'input') {

if(cs.type.toLowerCase() == 'text')

str.push(cs.value)

else if(cs.type.toLowerCase() == 'checkbox')

str.push(cs.checked)

else

str.push(ts_getInnerText(cs));

}

else if(cs.tagName.toLowerCase() == 'select') {

str.push(cs.options[cs.selectedIndex].value);

} else {

str.push(ts_getInnerText(cs));

}

break;

case 3: // TEXT_NODE

str.push(cs.nodeValue);

break;

}

}

// Save the extracted text for later. This costs the client RAM,

// but saves major CPU when the cell contents are particularly

// complex.

return el.ts_allText = str.join(" ");

}

function ts_expireCache(el) {

var cs = el.childNodes;

if(typeof el.ts_allText == "undefined")

return false

for (var i = 0; i < cs.length; i++) {

if(cs.nodeType == 1) { // ELEMENT_NODE

// We need to expire the cache if the element

// contains any form-type nodes, just in case

// the user changes their value.

if(cs.tagName.toLowerCase() == 'input')

return delete el.ts_allText

else if(cs.tagName.toLowerCase() == 'select')

return delete el.ts_allText

else if(ts_expireCache(cs))

return delete el.ts_allText

}

}

return false

}

function ts_persistCheckbox(event) {

// AG - Avoids IE bug

var chkbox = event.currentTarget ? event.currentTarget : event.srcElement;

chkbox.defaultChecked = chkbox.checked;

return true;

}

function ts_resortTable(event) {

var lnk = event.currentTarget ? event.currentTarget : event.srcElement;

// AG - IE doesn't support "currentTarget", must use "srcElement" instead.

// get the span

var span;

if(lnk.tagName && lnk.tagName.toLowerCase() == 'span')

span = lnk;

else {

for (var ci=0; ci<lnk.childNodes.length; ci++) {

if(lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span')

span = lnk.childNodes[ci];

}

}

var td = lnk.parentNode;

while(td.tagName != 'TD' && td.tagName != 'TH')

td = td.parentNode;

var column = td.cellIndex;

var table = getParent(td, 'TABLE');

var nonHeaderIndex;

for (nonHeaderIndex = 0; nonHeaderIndex < table.rows.length; nonHeaderIndex++) {

if(table.rows[nonHeaderIndex].cells &&

table.rows[nonHeaderIndex].cells[0].nodeName == "TD") {

break;

}

}

// If 0, the table has no rows. If >= table.rows.length, it has no data.

if(nonHeaderIndex == 0 || nonHeaderIndex >= table.rows.length)

return;

// Work out a type for the column

var itm = ts_getInnerText(table.rows[nonHeaderIndex].cells[column]);

var dateregex = new RegExp("^dd[/-](dd|" +

monthName.join("|") +

')[/-]dd(dd)?$', "i")

// A date in dd/mm/yy format.

if (itm.match(dateregex))

sortfn = ts_sort_date

// Currency, like $10.34

else if (itm.match(/^[£€$]/))

sortfn = ts_sort_currency // AG Added Euro

// 234.123

else if (itm.match(/^[d.]+$/))

sortfn = ts_sort_numeric

// Everything else.

else

sortfn = ts_sort_caseinsensitive

SORT_COLUMN_INDEX = column;

var newRows = new Array();

for (var j=nonHeaderIndex; j<table.rows.length; j++) {

newRows[j - nonHeaderIndex] = table.rows[j];

}

newRows.sort(sortfn);

if (span.getAttribute("sortdir") == 'up') {

ARROW = '&nbsp;&darr;';

span.setAttribute('sortdir', 'down');

} else {

ARROW = '&nbsp;&uarr;';

newRows.reverse();

span.setAttribute('sortdir', 'up');

}

// We appendChild rows that already exist to the tbody, so it moves them rather

// than creating new ones don't do sortbottom rows

for (var i=0; i<newRows.length; i++) {

if (!newRows.className ||

(newRows.className &&

(newRows.className.indexOf('sortbottom') == -1)))

table.tBodies[0].appendChild(newRows);

// We've sorted the list already, so we need to make

// sure any cells with changable values are expired.

ts_expireCache(newRows.cells[sORT_COLUMN_INDEX]);

}

// do sortbottom rows only

for (i = 0; i < newRows.length; i++) {

if (newRows.className &&

(newRows.className.indexOf('sortbottom') != -1))

table.tBodies[0].appendChild(newRows);

}

// Delete any other arrows there may be showing

var allspans = document.getElementsByTagName("span");

for (var ci = 0; ci < allspans.length; ci++) {

if (allspans[ci].className == 'sortarrow') {

if (getParent(allspans[ci], "table") == getParent(lnk, "table")) { // in the same table as us?

allspans[ci].innerHTML = '&nbsp;&nbsp;';

}

}

}

span.innerHTML = ARROW;

if (event.preventDefault) { event.preventDefault(); }

else {event.returnValue = false;}

}

function getParent(el, pTagName) {

if (el == null)

return null;

else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase()) // Gecko bug, supposed to be uppercase

return el;

else

return getParent(el.parentNode, pTagName);

}

function ts_sort_date(a, B) {

// y2k notes: Two digit years less than 50 are treated as 20XX,

// greater than 50 are treated as 19XX.

aa = ts_getInnerText(a.cells[sORT_COLUMN_INDEX]);

bb = ts_getInnerText(b.cells[sORT_COLUMN_INDEX]);

aaBits = aa.split(//|-/);

for (i = 0; i < monthName.length; i++) { // AG Convert Alpha month to two digit month

if (monthName.toLowerCase() == aaBits[1].toLowerCase()) {

aa = aaBits[0] + '/' + (i < 9 ? '0' : '') + (i + 1) + '/' + aaBits[2];

break;

}

}

if (aa.length == 10) {

dt1 = aa.substr(6, 4) + aa.substr(3, 2) + aa.substr(0, 2);

} else {

yr = aa.substr(6, 2);

dt1 = (parseInt(yr) < 50 ? '20' : '19') + yr + aa.substr(3, 2) + aa.substr(0, 2);

}

bbBits = bb.split(//|-/);

for (i = 0; i < monthName.length; i++) { // AG: Convert Alpha month to two digit month

if (monthName.toLowerCase() == bbBits[1].toLowerCase()) {

bb = bbBits[0] + '/' + (i < 9 ? '0' : '') + (i + 1) + '/' + bbBits[2];

break;

}

}

if (bb.length == 10) {

dt2 = bb.substr(6, 4) + bb.substr(3, 2) + bb.substr(0, 2);

} else {

yr = bb.substr(6, 2);

dt2 = (parseInt(yr) < 50 ? '20' : '19') + yr + bb.substr(3, 2) + bb.substr(0, 2);

}

if (dt1 == dt2)

return 0;

if (dt1 < dt2)

return -1;

return 1;

}

function ts_sort_currency(a, B) {

aa = ts_getInnerText(a.cells[sORT_COLUMN_INDEX]).replace(/[^0-9.]/g, '');

bb = ts_getInnerText(b.cells[sORT_COLUMN_INDEX]).replace(/[^0-9.]/g, '');

return parseFloat(aa) - parseFloat(bb);

}

function ts_sort_numeric(a, B) {

aa = parseFloat(ts_getInnerText(a.cells[sORT_COLUMN_INDEX]));

if (isNaN(aa))

aa = 0;

bb = parseFloat(ts_getInnerText(b.cells[sORT_COLUMN_INDEX]));

if (isNaN(bb))

bb = 0;

return aa - bb;

}

function ts_sort_caseinsensitive(a, B) {

aa = ts_getInnerText(a.cells[sORT_COLUMN_INDEX]).toLowerCase();

bb = ts_getInnerText(b.cells[sORT_COLUMN_INDEX]).toLowerCase();

if (aa == bb)

return 0;

if (aa < bb)

return -1;

return 1;

}

function ts_sort_default(a, B) {

aa = ts_getInnerText(a.cells[sORT_COLUMN_INDEX]);

bb = ts_getInnerText(b.cells[sORT_COLUMN_INDEX]);

if (aa == bb)

return 0;

if (aa < bb)

return -1;

return 1;

}

function addEvent(elm, evType, fn, useCapture) {

// addEvent cross-browser event handling for IE5+, NS6 and Mozilla

// By Scott Andrew

if (elm.addEventListener) {

elm.addEventListener(evType, fn, useCapture);

return true;

} else if (elm.attachEvent) {

var r = elm.attachEvent("on" + evType, fn);

return r;

} else {

alert("Handler could not be added");

}

}

// Suggested by MT Jordan:

// Posted by liorean at http://codingforums.com

// IE5 triggers runtime error w/o push function

// Shortened by mcramer@pbs.org

if (typeof Array.prototype.push == 'undefined') {

Array.prototype.push = function() {

var b = this.length;

for(var i=0; i<arguments.length; i++ ) {

this[b + i] = arguments;

}

return this.length

}

}

Link to comment
Share on other sites

Thanks for the help guys, everything's running great now.

I've got 16 teams (almost full 40 man rosters) 530 photos if you need them.

Teams:

Oakland

Cincinatti

Texas

Anaheim

Cleveland

Tampa Bay

Seattle

Boston

Atlanta

Houston

Toronto

St. Louis

CHC

Arizona

LA

SF

Link to comment
Share on other sites

Looking great Rich...

One suggestion (not that you don't already have a pile of them ;)). I love that you added "Create All Player Pages", but would it be possible to have it create the pages for only the selected league? IE create player pages for all current MLB players only?

Link to comment
Share on other sites

RichK Your formula for determing those who qualify for batting titles is off

according to your math only 5 qualify when all 9 of my regulars actually qualify.

Total plate appearances

AB + BB + HBP + SF + SH + times reached on defensive interference

Then divide that by games played.

Link to comment
Share on other sites

As an amateur programmer, although I did write a semi-popular program for FS2004, I can appreciate the work that went into this. Now, as a MVP fan and avid player, I thank you for creating and working hard on something so useful.

Great Job Rich! :wink:

Link to comment
Share on other sites

I hate to ask so many questions in here, but RichK is there anyway you could upload a complete version of the savreader which would include the sortable features? If not then can you explain to me how to install all that code that you listed above? Im not a computer wiz, I can do the standard things but in terms of code and whatnot I am clueless. Someone earlier mentioned placing it in your install directory, and I dont even know where that is located at. So if anyone can give me a hand I would be forever grateful, thanks in advance.

Link to comment
Share on other sites

I hate to ask so many questions in here, but RichK is there anyway you could upload a complete version of the savreader which would include the sortable features? If not then can you explain to me how to install all that code that you listed above? Im not a computer wiz, I can do the standard things but in terms of code and whatnot I am clueless. Someone earlier mentioned placing it in your install directory, and I dont even know where that is located at. So if anyone can give me a hand I would be forever grateful, thanks in advance.

download this file and place it in your "MVPSavReader" directory. I updated it with Rich's code above.

sorttable.js (right click save target as)

Link to comment
Share on other sites

I did that and then when trying to run it I get an error that comes up, since Im not sure how to post the pic of the error I just wrote it down and will copy it myself, here is what I am getting...

Script: C:Program FilesMVPSavReadersorttable.js

Line: 13

Char: 1

Error: ' window ' is undefined

Code: 800A1391

Source: Microsoft JScript runtime error

Link to comment
Share on other sites

i've keep getting this when creating player pages:



<a href='http://www.alitdom.com/MVP/dynasty/Rosters/0B881532.html'>Pittsburgh Pirates</a>

when clicking on roster link in career stats, Pitts Pirates in this case, it links me to what looks like (hex).html instead of PIT.html

edit: actually, i'm just noticing that it's just the pitchers that this happens to.

Link to comment
Share on other sites

My last question for you edm is this, I was looking at you Phillies Dynasty and I noticed in your team stats page that you didnt have the NL and AL All-Star teams listed and I was curious how you got rid of them? Everytime I try and create league pages it auto loads the All-Star teams into the stats, this isnt a huge deal but it is kinda annoying. If there was any trick to getting them off the league stats pages then let me know if you can, thanks again for your help earlier.

Link to comment
Share on other sites

he probably removed both AL and NL from MLB_stats.html

edit: yup, i just searched MLB_stats.html for anyhting relating to AL and NL All-stars and deleted it. here are the three sections:

batting



<tr class=oddrow><td align=left><a href='http://www.alitdom.com/MVP/dynasty/Rosters/AL.html'>American AL All-Stars</a></td>


<td align=right>3868</td><td align=right>582</td><td align=right>1144</td><td align=right>165</td>


<td align=right>23</td><td align=right>160</td><td align=right>571</td>


<td align=right>452</td><td align=right>22</td><td align=right>725</td><td align=right>73</td><td align=right>19</td>


<td align=right>23</td><td align=right>6</td><td align=right>45</td>


<td align=right>.296</td>


<td align=right>.374</td>


<td align=right>.474</td>


<td align=right>.848</td></tr>


<tr class=evenrow><td align=left><a href='http://www.alitdom.com/MVP/dynasty/Rosters/NL.html'>National NL All-Stars</a></td>


<td align=right>4185</td><td align=right>627</td><td align=right>1256</td><td align=right>204</td>


<td align=right>20</td><td align=right>204</td><td align=right>639</td>


<td align=right>522</td><td align=right>18</td><td align=right>838</td><td align=right>77</td><td align=right>25</td>


<td align=right>21</td><td align=right>10</td><td align=right>46</td>


<td align=right>.300</td>


<td align=right>.382</td>


<td align=right>.505</td>


<td align=right>.887</td></tr>
pitching


<tr class=oddrow><td align=left><a href='http://www.alitdom.com/MVP/dynasty/Rosters/AL.html'>American AL All-Stars</a></td>


<td align=right>63</td><td align=right>63</td><td align=right>2</td>


<td align=right>1</td><td align=right>423.0</td><td align=right>443</td>


<td align=right>227</td><td align=right>214</td><td align=right>52</td><td align=right>176</td>


<td align=right>7</td><td align=right>6</td><td align=right>10</td><td align=right>17</td>


<td align=right>306</td><td align=right>14</td><td align=right>35</td><td align=right>53</td>


<td align=right>3</td><td align=right>.275</td>


<td align=right>4.55</td></tr>


<tr class=evenrow><td align=left><a href='http://www.alitdom.com/MVP/dynasty/Rosters/NL.html'>National NL All-Stars</a></td>


<td align=right>65</td><td align=right>65</td><td align=right>8</td>


<td align=right>3</td><td align=right>496.2</td><td align=right>454</td>


<td align=right>205</td><td align=right>194</td><td align=right>49</td><td align=right>177</td>


<td align=right>3</td><td align=right>11</td><td align=right>6</td><td align=right>16</td>


<td align=right>449</td><td align=right>27</td><td align=right>26</td><td align=right>65</td>


<td align=right>3</td><td align=right>.250</td>


<td align=right>3.52</td></tr>
fielding


<tr class=oddrow><td align=left><a href='http://www.alitdom.com/MVP/dynasty/Rosters/AL.html'>American AL All-Stars</a></td>


<td align=right>2077</td>


<td align=right>1244</td>


<td align=right>45</td>


<td align=right>3366</td>


<td align=right>.987</td></tr>


<tr class=evenrow><td align=left><a href='http://www.alitdom.com/MVP/dynasty/Rosters/NL.html'>National NL All-Stars</a></td>


<td align=right>4053</td>


<td align=right>1131</td>


<td align=right>39</td>


<td align=right>5223</td>


<td align=right>.993</td></tr>

Link to comment
Share on other sites

he probably removed both AL and NL from MLB_stats.html

schitonk is correct. I manually removed them. This is something I keep forgetting to ask Rich about. Removing the all-star teams from the teams stats page. Especially now that there are sortable stats, the all-star teams seem to get in the way a bit.

Link to comment
Share on other sites

Thanks for helping, I think I will be waiting for either RichK to update the savreader and add other features and then release that or I will put up with the All-Star teams being in the way, Im not good with editing things and Im not even sure where that MLB_Stats.html is located at anyways. Thanks again, I was just hoping there was something easy that I had missed.

Link to comment
Share on other sites

I've been working on some. have about 10 teams completed. 330 photos. Right now I'm just working on the NL. but if you want them let me know.

Someone mentioned this before, but Draft Dodger's PureSim face pack is the right size for this (65pix wide), but the only drawback is they are named firstname_lastname.jpg and not the otherway around. All you need is a batch renamer that can rename "A_B.jpg" to "B_A.jpg".

http://www.driscoll-carignan.com/ootp/

Link to comment
Share on other sites

hey why does your team stats page look different from mine? (mine is on top) thats what mine looked like without the javascript.

ahhh you must be messing with stylesheets...

No, I haven't changed anything. Not sure why it looks like that. They both look the same on my end. Like the one on top

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...