Jump to content


Photo

Weekly MVP Update


6 replies to this topic

#1 GMD2047

GMD2047

    Veteran

  • Members
  • PipPipPip
  • 31 posts

Posted 20 September 2018 - 09:40 AM

Hey guys,

 

Wondering if somebody could help me have the Rookie of the week display the 2018 rookie class, please? Rather than 2017 rookies:

 

<div id="players_of_the_week">
<script type="text/javascript" src="//www03.myfantasyleague.com/fflnet%YEAR%/mfl_player_database.js"></script> 
<script>
var html='<div id="myfantasyleague_tabs"><table class="report"><caption><span>Weekly Awards</span></caption><tbody></tbody></table>';html+='<div class="toggle_tabs"><table class="report"><tbody><td><div class="myfantasyleague_tabmenu">',html+="<span id='tab_title_8000'>8000</span>",html+='<input id="sub8000" type="checkbox"><label for="sub8000"><span></span></label><ul id="homepagetabs">';for(var count=300,tabcount=8e3,useYear=year,i=0;i<completedWeek;i++)html+='<li id="tab'+tabcount+'" onclick="javascript:show_custom_tab(\''+tabcount+'\');"><a class="no-sub">Week '+(useWeek=i+1)+'<input id="sub'+tabcount+'" type="checkbox"><label for="sub'+tabcount+'"></label></a></li>',tabcount++;tabcount=8e3,html+='</ul></div></td></tr></tbody></table><div class="tabs_scroll">';for(var j=0;j<completedWeek;j++){var useWeek=j+1;html+='<div id="tabcontent'+tabcount+'" class="homepagetabcontent">',html+='<table align="center" cellpadding="0" cellspacing="0" id="homepagecolumns"><tbody><tr>';var htmlOne='<td class="pow" width="50%" class="homepagecolumn" id="homepagecolumn1">';htmlOne+='<div style="position: relative;">';var htmldiv='<div class="mobile-wrap">',htmlTwo='<td class="pow" width="50%" class="homepagecolumn" id="homepagecolumn2">';htmlTwo+='<div style="position: relative;">';var htmlopow='<table align="center" cellspacing="1" class="homepagemodule report" id="off_pow"><caption><span>Offensive Player of the Week</span><tbody>',htmldpow='<table align="center" cellspacing="1" class="homepagemodule report" id="def_pow"><caption><span>Defensive Player of the Week</span><tbody>',htmlorow='<table align="center" cellspacing="1" class="homepagemodule report" id="off_row"><caption><span>Offensive Rookie of the Week</span><tbody>',htmldrow='<table align="center" cellspacing="1" class="homepagemodule report" id="def_row"><caption><span>Defensive Rookie of the Week</span><tbody>';htmlopow+='<tr><th class="rank">#</th><th class="player">Player</th><th class="points">Pts</th></tr>',htmldpow+='<tr><th class="rank">#</th><th class="player">Player</th><th class="points">Pts</th></tr>',htmlorow+='<tr><th class="rank">#</th><th class="player">Player</th><th class="points">Pts</th></tr>',htmldrow+='<tr><th class="rank">#</th><th class="player">Player</th><th class="points">Pts</th></tr>';var url=baseURLDynamic+"/"+useYear+"/export?TYPE=playerScores&L="+league_id+"&W="+useWeek+"&COUNT="+count+"&JSON=1";$.ajax({type:"GET",url:url,async:!1}).done(function(a){for(var e=[],t=[],l=[],s=[],o=[],r=[],p=[],d=[],i=0,c=0,n=0,h=0,m=0;m<a.playerScores.playerScore.length;m++){var b=a.playerScores.playerScore[m].id,y=playerDatabase["pid_"+b].position;"DE"==y||"DT"==y||"LB"==y||"CB"==y||"S"==y?(t[c]=b,r[c]=a.playerScores.playerScore[m].score,c++,parseInt(B)>13112&&(s[h]=b,d[h]=a.playerScores.playerScore[m].score,h++)):(e[i]=b,o[i]=a.playerScores.playerScore[m].score,i++,parseInt(B)>13112&&(l[n]=b,p[n]=a.playerScores.playerScore[m].score,n++))}for(var u,w,v,_=0;_<5;_++){if(_%2==1)g="odd";else var g="even";v=_+1,b=e[_],u=playerDatabase["pid_"+b].name,w=playerDatabase["pid_"+b].team,y=playerDatabase["pid_"+b].position,htmlopow+='<tr class="'+g+"tablerow",0==_&&(htmlopow+=" toprank"),htmlopow+='"><td class = "rank">'+v+'.</td><td class = "player"><a href = "'+baseURLDynamic+"/"+useYear+"/player?L="+league_id+"&P="+b+'">'+u+" "+w+" "+y+'</td><td class = "points">'+o[_]+"</td></tr>",b=t[_],u=playerDatabase["pid_"+b].name,w=playerDatabase["pid_"+b].team,y=playerDatabase["pid_"+b].position,htmldpow+='<tr class="'+g+"tablerow",0==_&&(htmldpow+=" toprank"),htmldpow+='"><td class = "rank">'+v+'.</td><td class = "player"><a href = "'+baseURLDynamic+"/"+useYear+"/player?L="+league_id+"&P="+b+'">'+u+" "+w+" "+y+'</td><td class = "points">'+r[_]+"</td></tr>",b=l[_],u=playerDatabase["pid_"+b].name,w=playerDatabase["pid_"+b].team,y=playerDatabase["pid_"+b].position,htmlorow+='<tr class="'+g+"tablerow",0==_&&(htmlorow+=" toprank"),htmlorow+='"><td class = "rank">'+v+'.</td><td class = "player"><a href = "'+baseURLDynamic+"/"+useYear+"/player?L="+league_id+"&P="+b+'">'+u+" "+w+" "+y+'</td><td class = "points">'+p[_]+"</td></tr>",b=s[_],u=playerDatabase["pid_"+b].name,w=playerDatabase["pid_"+b].team,y=playerDatabase["pid_"+b].position,htmldrow+='<tr class="'+g+"tablerow",0==_&&(htmldrow+=" toprank"),htmldrow+='"><td class = "rank">'+v+'.</td><td class = "player"><a href = "'+baseURLDynamic+"/"+useYear+"/player?L="+league_id+"&P="+b+'">'+u+" "+w+" "+y+'</td><td class = "points">'+d[_]+"</td></tr>"}var f="</tbody></table></div>";html+=htmlOne+htmldiv+htmlopow+f+htmldiv+htmlorow+f+"</div></td>"+htmlTwo+htmldiv+htmldpow+f+htmldiv+htmldrow+f+"</div></td></tr></tbody></table></div>"}),tabcount++}html+="</div></div></div>",$("#players_of_the_week").append(html);    
</script>
<script>
var a = 7999 + completedWeek;
show_custom_tab(a);
</script>
</div>
<style>
#off_pow caption, #off_row caption, #def_pow caption, #def_row caption {display:table-caption!important;}
table#off_pow, table#off_row {padding-right:0.313rem;}
table#def_pow, table#def_row {padding-left:0.313rem;}
table#off_pow, table#def_pow, table#off_row, table#def_row{margin-bottom:0.313rem;}
.toprank {font-style:bold; font-size:135%;}
td.rank,th.rank,td.points,th.points {text-align:center;}
#def_pow caption, #def_row caption {padding-left:0.313rem;}
</style>
 
 
 
Its located under the league office tab under "weekly awards"
 
Some help would be greatly appreciated
 
SFG
 

 

 



#2 dejesusofnazareth

dejesusofnazareth

    Veteran

  • Members
  • PipPipPip
  • 177 posts
  • Gender:Male
  • Location:DynastyOGs

Posted 24 September 2018 - 05:48 PM

Change 13112 to 13588 in both instances in your code and it'll work for 2018 rookies.



#3 GMD2047

GMD2047

    Veteran

  • Members
  • PipPipPip
  • 31 posts

Posted 29 September 2018 - 08:31 PM

Thank you



#4 GMD2047

GMD2047

    Veteran

  • Members
  • PipPipPip
  • 31 posts

Posted 03 September 2019 - 11:03 PM

@dejesusofnazareth 

Hey there could you help me?

What is the code that I use to have only 2019 rookies on this script? Also could you show me where to find it for future reference? 

 

Thanks



#5 dejesusofnazareth

dejesusofnazareth

    Veteran

  • Members
  • PipPipPip
  • 177 posts
  • Gender:Male
  • Location:DynastyOGs

Posted 04 September 2019 - 03:57 PM

Change 13112 from the above code to 14055 in both instances and it'll work for 2019 rookies.  Player ID 14056 (Kyler Murray) is the starting point for 2019 drafted players IDs in MFL's system. 

 

<div id="players_of_the_week">
<script type="text/javascript" src="//www03.myfantasyleague.com/fflnet%YEAR%/mfl_player_database.js"></script> 
<script>
var html='<div id="myfantasyleague_tabs"><table class="report"><caption><span>Weekly Awards</span></caption><tbody></tbody></table>';html+='<div class="toggle_tabs"><table class="report"><tbody><td><div class="myfantasyleague_tabmenu">',html+="<span id='tab_title_8000'>8000</span>",html+='<input id="sub8000" type="checkbox"><label for="sub8000"><span></span></label><ul id="homepagetabs">';for(var count=300,tabcount=8e3,useYear=year,i=0;i<completedWeek;i++)html+='<li id="tab'+tabcount+'" onclick="javascript:show_custom_tab(\''+tabcount+'\');"><a class="no-sub">Week '+(useWeek=i+1)+'<input id="sub'+tabcount+'" type="checkbox"><label for="sub'+tabcount+'"></label></a></li>',tabcount++;tabcount=8e3,html+='</ul></div></td></tr></tbody></table><div class="tabs_scroll">';for(var j=0;j<completedWeek;j++){var useWeek=j+1;html+='<div id="tabcontent'+tabcount+'" class="homepagetabcontent">',html+='<table align="center" cellpadding="0" cellspacing="0" id="homepagecolumns"><tbody><tr>';var htmlOne='<td class="pow" width="50%" class="homepagecolumn" id="homepagecolumn1">';htmlOne+='<div style="position: relative;">';var htmldiv='<div class="mobile-wrap">',htmlTwo='<td class="pow" width="50%" class="homepagecolumn" id="homepagecolumn2">';htmlTwo+='<div style="position: relative;">';var htmlopow='<table align="center" cellspacing="1" class="homepagemodule report" id="off_pow"><caption><span>Offensive Player of the Week</span><tbody>',htmldpow='<table align="center" cellspacing="1" class="homepagemodule report" id="def_pow"><caption><span>Defensive Player of the Week</span><tbody>',htmlorow='<table align="center" cellspacing="1" class="homepagemodule report" id="off_row"><caption><span>Offensive Rookie of the Week</span><tbody>',htmldrow='<table align="center" cellspacing="1" class="homepagemodule report" id="def_pow"><caption><span>Defensive Rookie of the Week</span><tbody>';htmlopow+='<tr><th class="rank">#</th><th class="player">Player</th><th class="points">Pts</th></tr>',htmldpow+='<tr><th class="rank">#</th><th class="player">Player</th><th class="points">Pts</th></tr>',htmlorow+='<tr><th class="rank">#</th><th class="player">Player</th><th class="points">Pts</th></tr>',htmldrow+='<tr><th class="rank">#</th><th class="player">Player</th><th class="points">Pts</th></tr>';var url=baseURLDynamic+"/"+useYear+"/export?TYPE=playerScores&L="+league_id+"&W="+useWeek+"&COUNT="+count+"&JSON=1";$.ajax({type:"GET",url:url,async:!1}).done(function(a){for(var e=[],t=[],l=[],s=[],o=[],r=[],p=[],d=[],i=0,c=0,n=0,h=0,m=0;m<a.playerScores.playerScore.length;m++){var b=a.playerScores.playerScore[m].id,y=playerDatabase["pid_"+b].position;"DE"==y||"DT"==y||"LB"==y||"CB"==y||"S"==y?(t[c]=b,r[c]=a.playerScores.playerScore[m].score,c++,parseInt(b)>14055&&(s[h]=b,d[h]=a.playerScores.playerScore[m].score,h++)):(e[i]=b,o[i]=a.playerScores.playerScore[m].score,i++,parseInt(b)>14055&&(l[n]=b,p[n]=a.playerScores.playerScore[m].score,n++))}for(var u,w,v,_=0;_<5;_++){if(_%2==1)g="odd";else var g="even";v=_+1,b=e[_],u=playerDatabase["pid_"+b].name,w=playerDatabase["pid_"+b].team,y=playerDatabase["pid_"+b].position,htmlopow+='<tr class="'+g+"tablerow",0==_&&(htmlopow+=" toprank"),htmlopow+='"><td class = "rank">'+v+'.</td><td class = "player"><a href = "'+baseURLDynamic+"/"+useYear+"/player?L="+league_id+"&P="+b+'">'+u+" "+w+" "+y+'</td><td class = "points">'+o[_]+"</td></tr>",b=t[_],u=playerDatabase["pid_"+b].name,w=playerDatabase["pid_"+b].team,y=playerDatabase["pid_"+b].position,htmldpow+='<tr class="'+g+"tablerow",0==_&&(htmldpow+=" toprank"),htmldpow+='"><td class = "rank">'+v+'.</td><td class = "player"><a href = "'+baseURLDynamic+"/"+useYear+"/player?L="+league_id+"&P="+b+'">'+u+" "+w+" "+y+'</td><td class = "points">'+r[_]+"</td></tr>",b=l[_],u=playerDatabase["pid_"+b].name,w=playerDatabase["pid_"+b].team,y=playerDatabase["pid_"+b].position,htmlorow+='<tr class="'+g+"tablerow",0==_&&(htmlorow+=" toprank"),htmlorow+='"><td class = "rank">'+v+'.</td><td class = "player"><a href = "'+baseURLDynamic+"/"+useYear+"/player?L="+league_id+"&P="+b+'">'+u+" "+w+" "+y+'</td><td class = "points">'+p[_]+"</td></tr>",b=s[_],u=playerDatabase["pid_"+b].name,w=playerDatabase["pid_"+b].team,y=playerDatabase["pid_"+b].position,htmldrow+='<tr class="'+g+"tablerow",0==_&&(htmldrow+=" toprank"),htmldrow+='"><td class = "rank">'+v+'.</td><td class = "player"><a href = "'+baseURLDynamic+"/"+useYear+"/player?L="+league_id+"&P="+b+'">'+u+" "+w+" "+y+'</td><td class = "points">'+d[_]+"</td></tr>"}var f="</tbody></table></div>";html+=htmlOne+htmldiv+htmlopow+f+htmldiv+htmlorow+f+"</div></td>"+htmlTwo+htmldiv+htmldpow+f+htmldiv+htmldrow+f+"</div></td></tr></tbody></table></div>"}),tabcount++}html+="</div></div></div>",$("#players_of_the_week").append(html);	
</script>
<script>
var a = 8000 - 1 + completedWeek;
show_custom_tab(a);
</script>


#6 dejesusofnazareth

dejesusofnazareth

    Veteran

  • Members
  • PipPipPip
  • 177 posts
  • Gender:Male
  • Location:DynastyOGs

Posted 04 September 2019 - 04:04 PM

If you want to edit this yourself for future years, enter the API call https://www64.myfant...ETAILS=1&JSON=1 - where baseURLDynamic (the www64.myfantasyleague.com part) is specific to your league site and the year is whatever year it is. 

 

Then search the page for "draft_year":"2019" or "draft_year":"2020" or whatever, find the first instance in the database, subtract 1 (the script is looking for a greater than value) and put that in the two spots in the code.



#7 GMD2047

GMD2047

    Veteran

  • Members
  • PipPipPip
  • 31 posts

Posted 04 September 2019 - 07:44 PM

Ok great, thank you for the information.





Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users