Jump to content


Photo

Live Scoring - MFL Scripts


120 replies to this topic

#1 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,325 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 15 December 2020 - 06:05 PM

Please use this thread to post all questions related to the Live Scoring script.

 

ATTENTION - ANY AND ALL SCRIPTS REQUIRE TO HAVE THIS GLOBAL CACHE SCRIPT PLACED AS THE FIRST ITEM IN YOUR HEADER MESSAGE !!! The script builds a cache for local storage and indexedDB storage in your browser to limit the API call to the MFL Server.

You only need a single copy of this  ,do not add multiple times if using multiple scripts.

<script src="https://www.mflscripts.com/mfl-apps/global/cache.js"></script>

 

See troubleshooting section at very bottom of this post before submitting a question.

 

Before installing any scripts - please review this video tutorial on how to prepare your MyFantasyLeague site for customizations.

 

Access ALL of MFLScripts here.

 

example.jpg

 

 

Most if not all of our custom scripts require the addition of a font awesome library to be loaded into a homepage message that is marked as a "Header"  OR you can import the font awesome stylesheet into your main css file , it must be the very first line in your css file. Its likely if your using any of our scripts you already have a copy loaded, so please disregard and move onto the main script installation section.

 

 

Example 1 - inserting font awesome js file into a header message

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css"/>

 

  

Example 2 - inserting font awesome into your main css file as first line in the stylesheet

@import "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css";

 

 

 

 

LIVE SCORING SCRIPT INSTALLATION

Read the installation steps below. Once complete go to the MFL Live Scoring page to see the script in action. When live scoring not active , you can use this query string on end of live scoring url to see that page in test mode - &TEST_WEEK=1

 

 

1. Place this in your header message

<script>
//THIS NEEDS TO BE PLACED IN HEADER AND IS USED TO GO BACK IN HISTORY FOR MFL'S LIVE SCORING
if(document.getElementById("body_ajax_ls")) {
    var ls_liveScoringWeekCheck = parseInt(location.href.substr( location.href.indexOf("W2=")+3 , 2 ));
    if(ls_liveScoringWeekCheck>0&&ls_liveScoringWeekCheck<liveScoringWeek) {
        liveScoringWeek = parseInt(location.href.substr( location.href.indexOf("W2=")+3 , 2 ));
    }
}
</script>

 

 

 

2. Place the following in a footer message , adjust var "is_Allplay" to true if using the scoring script for an All Play or Contest League.

<!-- MFL LIVE SCORING SCRIPT SETTINGS --> 
<script>
var ls_scoreboardName = "LEAGUE SCOREBOARD";	//enter text to name your scoreboard
var ls_commish_id = "0002";			//set the franchise ID of commissioners franchise to show those matchup first when logged in as commissioner
var ls_loader = false;				//use loading screen if scoreboard takes too long to load
var largeLeagueSB = false;			//set to true if scoreboard doesn't load all the time - this if for large leagues
var showTeamName = true;                      	//set to true to display franchise names in scoreboard header
var showTeamIcon = false;                       //set to true to display franchise icons in scoreboard header
var ls_includeProjections = true;              	//set to true to display projections next to player scores
var ls_includeInjuryStatus = true;     		//set to true to display injury status as per the norm
var ls_excludeIR = true;                       	//set to true to remove players on fantasy IR
var ls_excludeTaxi = true;                     	//set to true to remove players on taxi squad
var ls_popup_abbrev_name_icon = 1;             	//-1=disable; 0=abbrev; 1=name; 2=icon
var ls_orig_proj_when_final = true;         	//set true to change pace to projection when games go final
var ls_popup_status = true;                    	//set true to add status of player to popup
var ls_box_abbrev_name_icon = 1;               	//0=abbrev; 1=name; 2=icon; 3=icon+abbrev; 4=icon+name
var ls_hide_bye_teams = true;                 	//set to true to hide boxscore matchup teams on bye weeks
var ls_show_win_probability = true;           	//set to true to show MFL H2H win probability - only used for H2H leagues and MFL setting must be set to "true"

// ALL PLAY ----- PLAYOFFS LEAGUES ------ BEST BALL LEAGUES ONLY !!!!!!
var BreakRows     = true;       // Set to true to make 2 rows of matchups - for larger leagues 14+ teams - can be used for smaller leagues if you want
var fixedWidthBox = true;       // Set to true to make box scores same sizes - set box width in next var
var setBoxWidth   = "150";      // MUST BE AT LEAST 150 WIDE IF USING FULL TEAM NAMES - DO NOT INCLUDE PX-EM-REM IN VALUE - ICONS AND  ABBR YOU CAN SET LESS WIDE
</script>

<!-- MFL LIVE SCORING SCRIPT H2H LEAGUES JS FILE -->
<script src="https://www.mflscripts.com/mfl-apps/scoreboard/replace-mflScoring/script.js"></script>

 

 

3. Here are links to the CSS file used to format and color it , copy and paste the raw css your main css file and edit any style you want or link the css files in a homepage message and mark as header.

 

Head 2 Head Light Version CSS File

<link rel="stylesheet" href="https://www.mflscripts.com/mfl-apps/scoreboard/replace-mflScoring/light.css" type="text/css"/>

 

Head 2 Head Dark Version CSS File

<link rel="stylesheet" href="https://www.mflscripts.com/mfl-apps/scoreboard/replace-mflScoring/dark.css" type="text/css"/> 

 

All Play Light Version CSS File

<link rel="stylesheet" href="https://www.mflscripts.com/mfl-apps/scoreboard/replace-mflScoring/light-allplay.css" type="text/css"/> 

 

All Play Dark Version CSS File

<link rel="stylesheet" href="https://www.mflscripts.com/mfl-apps/scoreboard/replace-mflScoring/dark-allplay.css" type="text/css"/> 

 

 

TROUBLESHOOTING TIPS

 

1. Make sure to review the help video to check your league settings are setup so customized scripts can be used.

 

2. Recopy the code above and try again. Be sure your advanced editor is turned off.

 

3. Right click mouse on your page where script displays and click "Inspect Element" . In the browsers new popup window that displays , click on the "Console" tab. Now click on the "Errors" section. Here you will find a list of any errors that have occurred. Many errors our self explanatory and you can address yourself. If your error is showing cross site  CORS has been blocked , then you need to check every CSS, JS and IMAGE file on your site and be sure they all are using https  url and not http. Another error that appears could be "too many requests" , this happens when you refresh your site many times and MFL blocks your IP for 15 minutes for submitting too many API request. If thats the case , just wait 15-20 minutes and try again.

 

4. Check out the MFL Menu > Help section. We have added a new link here called "Manage Cache". By default we are caching the API files for our script in the browsers local storage. If you script isn't updating , you can force an update by clicking "Clear Local Storage". The next link is called "Enable IndexedDB" , this link is only meant to be used for owner that are getting the "Too Many Requests" error because there are using several scripts on several different MFL leagues that use the same serverID. Click this if needed more storage.

 

5. If the above wasn't any help , then post a question and we will do our best to help when the time allows.

 

6. The Live Scoring page is ONLY visible during the NFL regular and post season. MFL does not provide stats or matchups during the offseason so the scoring page is not active. Week 1 of each season starts 24 hours prior to kickoff of the first game of the season. Until then the scoreboard is inactive.


All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!


#2 BruiserFootball

BruiserFootball

    Veteran

  • Members
  • PipPipPip
  • 40 posts
  • Gender:Male

Posted 02 January 2021 - 06:52 AM

I've cleared one error in my console.  I have two others that I haven't found:

 

"Failed to load resource: net::ERR_BLOCKED_BY_CLIENT   https://sb.scorecard...h.com/beacon.js "

 

"Uncaught ReferenceError:  COMSCORE is not defined     at 15570:1111 "

 

 

 

Fantasy Football: Dynasty Legends Association (myfantasyleague.com)

 

I ran the one-click script on a demo page, looks sharp.  I'd like to try to improve our current layout to avoid 31 complaints of trying to change too much.  Any insight on these errors?



#3 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,325 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 02 January 2021 - 08:22 AM

Ignore those errors
They are both related to a 3rd party tracking script MFL uses
Not related to any of our scripts

All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!


#4 grooves12

grooves12

    Veteran

  • Members
  • PipPipPip
  • 99 posts

Posted 04 January 2021 - 07:53 PM

I'm trying to get this setup for a playoff contest league I run.

 

I'm using your one-click template installation. I've turned off the h2h script, added the allplay script in the footer, and added the all-play CSS linked into a head message.

 

Some things look a little funny:

 

It doesn't show weeks 18-21 (is the script configured for that?)

Week 17 formatting is messed up, but weeks 1-16 look ok.

 

league: https://www76.myfant...ajax_ls?L=66264



#5 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,325 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 04 January 2021 - 08:07 PM

unless you create a playoff league , you can't add weeks on a normal MFL league

 

MFL has playoff leagues setup for that specific reason


All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!


#6 grooves12

grooves12

    Veteran

  • Members
  • PipPipPip
  • 99 posts

Posted 04 January 2021 - 09:04 PM

unless you create a playoff league , you can't add weeks on a normal MFL league

 

MFL has playoff leagues setup for that specific reason

 

Sorry it is a playoff league.

 

The scoreboard script still shows weeks 1-17 though.



#7 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,325 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 06 January 2021 - 07:45 AM

New script URL and var for Live Scoring Script

 

I combined the All Play and H2H scripts into one and have a var to set to enable the All Play

 

Relink your URL for this script

 

New URL

<script src="https://www.mflscripts.com/mfl-apps/scoreboard/replace-mflScoring/script.js"></script>

 

 

New Var to add to the rest of the Live Scoring variables

var is_Allplay = false;                        //set to true if using live scoring on all play or contest league

 

 

 

If using our custom template , just add the new var in the footer message by the rest of the Live Scoring Option var settings , set to true to enable leagues for All Play or Contests Leagues.

 

Those not using our template , just relink the livescoring js file to the new URL mentioned here , add the var to the settings 

 

First post is updated with the new url and var


All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!


#8 grooves12

grooves12

    Veteran

  • Members
  • PipPipPip
  • 99 posts

Posted 06 January 2021 - 12:22 PM

If I am using custom template are there any other changes that need to be made, since there isn't a direct link to the script, just a variable?



#9 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,325 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 06 January 2021 - 12:25 PM

If I am using custom template are there any other changes that need to be made, since there isn't a direct link to the script, just a variable?

 

 

if using our custom template , only change you need to make is add this var , in the footer message where the other live scoring variable reside.

 

That is it

 

var is_Allplay = false;                        //set to true if using live scoring on all play or contest league

 

 

If using your own template then you need to replace the old js file with the new one , and then add the new var

<!-- MFL LIVE SCORING  -->
<script src="https://www.mflscripts.com/mfl-apps/scoreboard/replace-mflScoring/script.js"></script> 

All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!


#10 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,325 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 07 January 2021 - 03:13 PM

if using the live scoring script for all play or contest leagues , you can break the box matchups from a single row to 2 rows , in case you have a lot of teams and a lot of scrolling. This will NOT work for H2H leagues as the HTML is a bit different. But any league using the playoff leagues can use

 

 

count number of franchises , this example shows 12 teams and edit and add this css

<style>
#other_games div.ls_other_game:nth-child(11)+br{display:block}
#other_games div.ls_other_game:nth-child(n+12){margin-top:5px}
</style>

 

example for 16 teams

<style>
#other_games div.ls_other_game:nth-child(15)+br{display:block}
#other_games div.ls_other_game:nth-child(n+16){margin-top:5px}
</style>

 

 

example for 24 teams

<style>
#other_games div.ls_other_game:nth-child(23)+br{display:block}
#other_games div.ls_other_game:nth-child(n+24){margin-top:5px}
</style>

 

 

hope you can see how this is going......number of teams  adjust n+"your number of teams"

number of teams -1 = the +br number


All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!


#11 grooves12

grooves12

    Veteran

  • Members
  • PipPipPip
  • 99 posts

Posted 07 January 2021 - 03:35 PM

Hey TOS,

 

The allplay updates are now displaying the scoreboard for my playoff league, but it still shows weeks 1-17 in the header.

 

Most other league reports show 18-21 (nothing before week 18.) Is this hard coded in the scoreboard script or will it automatically adjust at some point for playoff leagues?



#12 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,325 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 07 January 2021 - 04:26 PM

what leagues are showing weeks 18-21 on live scoring pages?

 

i have 4 playoff leagues using MFL skins and none show those weeks

 

were the leagues formed as a new league or formed based on an existing league

 

 

my playoff leagues , no custom scripts or css not showing any weeks , here are 2

 

https://www63.myfant...ajax_ls?L=66524

 

Fantasy Football: Prime Time Dynasty Playoffs Live Scoring (myfantasyleague.com)

 

MFL not even loading any nav menus on the page

 

 

you can view the page source and see if MFL has the nav menu on the page or not , our menu is created by the script , if MFL has one added to the page it will show when you view page source , search for "nav" and see if any even being delivered by MFL


All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!


#13 grooves12

grooves12

    Veteran

  • Members
  • PipPipPip
  • 99 posts

Posted 07 January 2021 - 04:41 PM

Sorry. You are correct, the default MFL leagues do not show weeks on them. 

 

However, with the custom template and scoring script past (and current) weeks are inserted. Using your code, it is displaying weeks 1-17 on the header and showing Week 17 for "current" scores and not displaying anything for 18-21. I believe in standard leagues with the custom scoring script, weeks yet to be played are greyed out until they happen. 

 

Example: https://www76.myfant...ajax_ls?L=40192



#14 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,325 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 07 January 2021 - 04:45 PM

weeks not yet to be played have never been displayed on live scoring script

 

current week displays on page load , whatever MFL system says is the current week , which right now is set at week 17

 

MFL system is still week 17 , week 18 not yet in the system

 

 

if you want to hide previous weeks and the menu the script is creating , you can remove the nav menu with css

 

#body_ajax_ls #myNavigationHolder{display:none!important}

 

 

i will see how menu looks once MFL starts week 18 scoring before doing anything to adjust the script , right now there is nothing to test it against


All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!


#15 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,325 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 07 January 2021 - 10:38 PM

habman made a read to API to find start week and end week , so creating nav menu will look for that and write the weeks

 

script updated and now for playoff leagues shows 18-21  and not longer shows 1-17 


All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users