Jump to content


Photo

Contracts Report - MFL Scripts


2 replies to this topic

#1 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 3,796 posts
  • Gender:Male
  • Location:O-H-I-O

  • 2020 MFL: 10065
  • , 43570

Posted 12 December 2020 - 07:13 PM

Please use this thread to post all questions related to the Contracts Report 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";

 

 

 

 

CONTRACTS REPORT SCRIPT INSTALLATION

Pace the following into any homepage message (Do not mark as a header or footer). You can place this within the tab content of your homepage or create a link and link directly to the message. We recommend linking to all scripts so they don't slow down the load time for your league mates accessing the homepage. There are many different settings to adjust to fit the need of your leagues.

<div id="contractReportButtonContainer" class="form_buttons"></div>
<div id="contractReportWrapper" style="display:none">
	<div id="contractReportContainer" style="width: 100%;">
		<div id="contractReportDropdown"></div>
		<div id="contractReportTable" class="mobile-wrap"></div>
		<!-- YOU CAN EDIT LEGEND BELOW AS NEEDED; REMOVE style="display:none" TO DISPLAY LEGEND -->
		<div id="contractReportLegend" style="display:none">
			<ul style="text-align:left">LEGEND
				<li class="optionYear">Option Year</li>
				<li class="optionYearExercised">Option Exercised</li>
				<li class="optionYearNotExercised">Option Not Exercised</li>
				<li class="tagYear">Tagged</li>
			</ul>
		</div>
	</div>
</div>

<script>
//////////////////////////////////////////////

//   CUSTOM SETTINGS FOR CONTRACT REPORT    //

//////////////////////////////////////////////

/////////////////////////////////////////

//          GENERAL SETTINGS           //

/////////////////////////////////////////

	var contractReport_useTriggerButton = true;
	var contractReport_hideMinimizeButton = false;
	var showContractStatus = false;
	var showContractStatusTitle = false;
	var contractYearsToShow = 6;
	var maxContractLength = 5;
	var salaryWithCommas = true;
	var summaryHeader = "LEAGUE SUMMARY";
	var includeOmitCurrentYearOption = false;
	var includeCutTradeOption = false;
	var includeAssignContractOption = false;
	var includeRolloverOption = false; 	

//////////////////////////////////////////

//        SALARY DISPLAY SETTING        //

//////////////////////////////////////////

	//0: 1,100,000=>1.10m; 100,000=>0.10m; 1,100=>1.10k; 100=>0.10k   10=>10.00
	//1: 1,100,000=>1.1m;   100,000=>0.1m;  1,100=>1.1k;  100=>0.1k    10=>10.0
	//2: 1,100,000=>1000k;  100,000=>100k;  1,000=>1k;    100=>100     10=>10
	//3: 1,100,000=>1m;     100,000=>0m;    1,100=>1k;    100=>0k      10=>10     ROUND OFF
	//4: 1,000=>1,000.00;   100=>100.00;    10=>10.00;    1=>1.00
	//5: 1,000=>1,000.0;    100=>100.0;     10=>10.0;     1=>1.0
	//6: 1,000=>1,000;      100=>100;       10=>10;       1=>1
	//7: 1,175,000=>1.175m; 100,000=>100k;  1,000=>1k;    100=>100     10=>10
	//8: 1,175,000=>1.18m;  100,000=>100k;  1,000=>1k;    100=>100     10=>10
	//9: 1,175,000=>1.2m;   100,000=>100k;  1,000=>1k;    100=>100     10=>10
	var salaryDisplaySetting = 1;
	var salaryAdjustmentsDisplaySetting = 7;
	var salaryTotalsDisplaySetting = 0;
	var summaryTableDisplaySettings = 0;	

///////////////////////////////////////////////////

//       CONTRACT VALUE FROM ONE YEAR TO NEXT    //	

///////////////////////////////////////////////////

	// 0 = Salary is same from one year to next
	// 1 = Salary increases by specific percentage from one year to next
	// 2 = Salary increases by variable percentage from one year to next (also use yearlyContractPercentIncrease Array)
	// 3 = Salary increases by specific dollar amount from one year to next 
	// 4 = Salary increases by variable dollar amount from one year to next (also use yearlyContractDollarIncrease Array)
	// 5 = GM Dynasty Rule salary in contract info field; contract seasons separate by slash guaranteed salary bracketed; 

	var yearlyContractSalaryRule = 0;

	//For Salary Rule 1
	var yearlyContractSalaryPercent = 0.1; // Format use 0.1 for 10%; 0.2 for 20% etc.

	//For Salary Rule 2
	var yearlyContractPercentIncrease = new Array(0.0,0.1,0.15,0.15);
	var percentIncreaseIsCumulative = true;

	//For Salary Rule 3
	var yearlyContractSalaryDollar = 1; 

	//For Salary Rule 4
	var yearlyContractDollarIncrease = new Array(0,100000,200000,300000);
	var dollarIncreaseIsCumulative = true;

	//For Salary Rule 5
	var contractSalaryMultiplier = 1.00;

	// ROUNDING RULES IF SALARY IS INCREASED FROM ONE SEASON TO NEXT ON A PERCENT BASIS
	// 0 = no round
	// 1 = round off
	// 2 = round up
	// 3 = round down
	var salaryRoundingRule = 1;
	var salaryRoundingDecimal = 0;
	//FOR VARIABLE INCREASE IN SALARY FROM ONE YEAR TO NEXT
	// Use "[x,x,x]" in ContractInfo field to define variable contracts
	// If format found then it will override above rules	

//////////////////////////////////////////

//            SIGNING BONUS             //

//////////////////////////////////////////

	//SIGNING BONUS USING CONTRACT STATUS FIELD
	var contractSigningBonus = 0; // 0=>n/a, 1=>bonus to year 1 only, 2=>bonus divided evenly amongst all seasons
	var includeRemainingSigningBonusColumn = false;
	var remainingSigningBonusHeader = "Signing<br>Bonus";
	var remainingSigningBonusTitle = "Remaining Signing Bonus";	

//////////////////////////////////////////

//   TRADE / SALARY ADJUSTMENT RULES    //

//////////////////////////////////////////

	// 0 = NO RETAINED SALARY
	// 1 = RETAIN ALL REMAINING SIGNING BONUS IN CURRENT SEASON
	// 2 = RETAIN ALL REMAINING SIGNING BONUS IN APPLICABLE SEASON
	// 3 = RETAIN ALL REMAINING SIGNING BONUS USING TRADE ROLLOVER 
	var tradeRule = 0;
	var tradePercent = 1.00;

	//TRADE ROLLOVER; IF SET TO TRUE THEN TRADING A PLAYER PRIOR TO ROLLOVER DATE WILL APPLY ALL CAP PENALTIES TO CURRENT SEASON AND AFTER TRADE DATE THEN CURRENT SEASON APPLIED TO CURRENT SEASON AND REMAINING APPLIED TO NEXT SEASON

	var useTradeRolloverDate = false;
	var tradeRolloverDate = new Date("June 1, 2017").getTime()/1000;	

//////////////////////////////////////////

//   BUYOUT / SALARY ADJUSTMENT RULES   //

//////////////////////////////////////////

	//SHOW BUYOUT TOTAL AS A SEPARATE LINE ITEM
	var showBuyoutTotal = false;

	//BUYOUT RULES
	// 0 = APPLY BUYOUT TO CURRENT SEASON ONLY (AND/OR NEXT SEASON USING buyoutCutoffDate OR buyoutRolloverDate)
	// 1 = APPLY BUYOUT TO ALL SEASONS REMAINING ON CONTRACT
	// 2 = APPLY BUYOUT USING buyoutBaseMultiplier & buyoutSumSalaryRemainingYears ARRAYS
	// 3 = APPLY BUYOUT USING buyoutBaseMultiplier & buyoutYearsRemainingMultiplier WHERE "years" IS USED AS TRIGGER

	// NOTE: RULES 1 TO 3 USE yearsBuyoutIdentifier WHICH IS "TEXT" FOUND IN THE SALARY ADJUSTMENTS API THAT PRECEDES CONTRACT LENGTH
	var buyoutRule = 0;
	var buyoutPercent = 1.00;	

	//IF buyoutRule = 0 THEN BELOW SETTINGS ARE IGNORED

		var yearsBuyoutIdentifier = "Years: ";
		var buyoutBaseMultiplier = new Array(0.5,"years",0,0,0,0);
		var buyoutSumSalaryRemainingYears = new Array(false,true);
		var buyoutYearsRemainingMultiplier = new Array(0,0.15,0.25,0.35,0.45);

	//BUYOUT CUTOFF; IF SET TO TRUE THEN ALL BUYOUTS OCCURRING AFTER DATE WILL BE APPLIED TO NEXT SEASON

	var useBuyoutCutoffDate = false;
	var buyoutCutoffDate = new Date("June 1, 2020").getTime()/1000;

	//BUYOUT ROLLOVER; IF SET TO TRUE THEN BUYING OUT A PLAYER PRIOR TO ROLLOVER DATE WILL APPLY ALL CAP PENALTIES TO CURRENT SEASON AND AFTER BUYOUT DATE THEN CURRENT SEASON APPLIED TO CURRENT SEASON AND REMAINING APPLIED TO NEXT SEASON

	var useBuyoutRolloverDate = false;
	var buyoutRolloverDate = new Date("June 1, 2017").getTime()/1000;

	//BUYOUT OTHER SETTINGS

	var buyoutIgnore = new Array("Carryover");
	var buyoutCustomRule = new Array();
	buyoutCustomRule[0] = ({"keyword":"Carryover","arrayStart":"[","arrayEnd":"]"});
	var showCompleteBuyoutDescription = true;

///////////////////////////////////////////////////////

//          RFA / UFA / CONTRACT EXTENSION RULES     //

///////////////////////////////////////////////////////

	//RFA / UFA RULES APPLICALBLE WHEN CONTRACT EXPIRES
	// 0 = NO UFAS; EVERYONE CAN BE EXTENDED TO MAX CONTRACT LENGTH
	// 1 = NO RFAS; NO ONE CAN BE EXTENDED WHEN CONTRACT EXPIRES
	// 2 = LENGTH IS ONE YEAR LESS THAN ORIGINAL CONTRACT (BY DEFAULT 1 YR CONTRACTS BECOME UFA).  CAN USE VARIOUS CONTRACT EXCEPTION ARRAYS TO FORCE UFA STATUS.
	// 3 = ONLY PLAYERS WITH CERTAIN CONTRACT STATUS CAN BE EXTENDED (ALSO USES contractStatusExtension array())
	// 4 = ONLY PLAYERS WITH CERTAIN CONTRACT INFO CAN BE EXTENDED (ALSO USES contractInfoExtension array())
	// 5 = ONLY PLAYERS WITH CASE SENSITIVE STRING FOUND IN CONTRACT STATUS CAN BE EXTENDED (ALSO USES contractStatusExtension array())
	// 6 = ONLY PLAYERS WITH CASE SENSITIVE STRING FOUND IN CONTRACT INFO CAN BE EXTENDED (ALSO USES contractInfoExtension array())

	var contractExtensionRule = 0;
	var contractStatusExtension = new Array();
	var contractInfoExtension = new Array();
	var contractYearException = new Array();
	var contractInfoException = new Array();
	var contractStatusException = new Array();
	var contractDraftedException = new Array();
	var contractHideRfaUfaStatus = false;	

	//SPECIAL RULES

	var auditionLength = 0; //# weeks to audition BBID player before offering contract. 
	var contractStatusOptionYear = new Array(); //case sensitive string found in contract status add class "optionYear"
	var contractInfoOptionYear = new Array(); //case sensitive string found in contract info add class "optionYear"
	var contractStatusTagYear = new Array(); //case sensitive string found in contract status add class "tagYear"
	var contractInfoTagYear = new Array(); //case sensitive string found in contract info add class "tagYear"
	var contractStatusOptionYearExercised = new Array(); //case sensitive string found in contract status add class "optionYearExercised"
	var contractInfoOptionYearExercised = new Array(); //case sensitive string found in contract info add class "optionYearExercised"
	var contractInfoOptionYearNotExercised = new Array(); //case sensitive string found in contract info add class "optionYearNotExercised"	

	//SETTING BELOW TO TRUE WILL SHOW POTENTIAL SALARY EXTENSIONS

	//  AND SETTING TO FALSE WILL SHOW "RFA"
	var showPotentialRFASalaries = false;

		//IF ABOVE IS SET TO TRUE ENTER MULTIPLIER TO ASSIGN NEW CONTRACT SALARY MULTIPLIER BY SEASON
		var contractExtensionMultiplier = new Array(1.25,1.45,1.60,1.70,1.75);
	

////////////////////////////////////////	

//     INJURED RESERVE SETTINGS       //

////////////////////////////////////////

	var separateInjuredReservePlayers = false;
	var includeIRSalaryForFutureSeasons = true;	

////////////////////////////////////////	

//          TAXI SQUAD SETTINGS       //

////////////////////////////////////////

	var separateTaxiSquadPlayers = true;
	var includeTaxiSquadSalaryForFutureSeasons = true;
	var useRostersDraftedColumnHistory = false;

	//IF ABOVE IS SET TO FALSE THEN BELOW SETTINGS WILL BE IGNORED
	var showTaxiDraftRound = false;
	var showTaxiSalary = false;
	var taxiYearsToShow = 5;

	//if salary is determined by draft round fill in the following array
	var taxiSquadRoundSalary = new Array(800000,700000,600000,500000,400000,300000,200000,100000);
	var taxiSquadContractMultiplier = new Array(1,2,3,4,5,0,0,0,0);

	//to override above for some taxi salaries (based on round AND pick) use below array
	var taxiSquadRoundPickSalary = new Array();

	//EXAMPLE: var taxiSquadRoundPickSalary = ({ "1.1":1000000 , "1.2":1000000 , "1.3":1000000 , "1.4":1000000 , "1.5":900000 , "1.6":900000 , "1.7":900000 , "1.8":900000 });
	//TAXI SALARY RULE
	// 0 = Use salary
	// 1 = Use round and multiplier to calculate salary
	var taxiSalaryRule = 0;
	var applyRFARulesToTaxiSquad = true;	

//////////////////////////////////////////

//        OTHER SETTINGS                //

//////////////////////////////////////////

	//ENTER SALARY CAP ADJUSTMENTS BY SEASON
	var contractMinimumSalary = 0;
	var salaryCapAdjustments = new Array(0,0,0,0,0,0);
	var isSalaryCapAdjustmentMultiplier = false;	

	var useDecimalFormatContractYears = false; // example 1.4 is year 1 of a 4 year contract
	var useSlashFormatContractYears = false; // example 1/4 is year 1 of a 4 year contract

	var useContractStatusAsContractLength = false;
	var useContractInfoAsContractLength = false;	

	var useContractStatusAsOriginalContractLength = false;
	var useContractInfoAsOriginalContractLength = false;

	var useContractInfoAsCapHit = false;	

	var contractReportSeparateTeamPositionColumn = false;

	var contractReportIncludeByeWeekColumn = false;

	var contractReportIncludeContractStatusColumn = false;

	var contractReportContractStatusTitle = "";

	var contractReportIncludeContractYearColumn = false;

	var contractReportContractYearTitle = "";	

	var includeRemainingSalaryColumn = false;

	var includeRemainingBaseSalaryColumn = false;

	var includeRemainingGuaranteedSalaryColumn = false;

	var remainingSalaryHeader = "Remaining<br>Salary";

	var remainingSalaryTitle = "Remaining Salary";

	var remainingBaseSalaryHeader = "Base<br>Salary";

	var remainingBaseSalaryTitle = "Remaining Base Salary";

	var remainingGuaranteedSalaryHeader = "Guaranteed<br>Salary";

	var remainingGuaranteedSalaryTitle = "Remaining Guaranteed Salary";	

	var contractSalaryForOpenRosterSpot = ({"salary":0,"applyToFutureYears":false,"includeIRCurrentYear":false,"includeIRFutureYear":false,"includeCurrentYearInContractTotal":false});

</script>

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

 

 

 

 

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.


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 ShotgunCommish

ShotgunCommish

    Veteran

  • Members
  • PipPipPip
  • 100 posts
  • Gender:Male
  • Location:Rineyville, KY

Posted 13 January 2021 - 07:31 PM

Hab,

Are there settings in this script that can be used in a contract only league?

 

Anything to change in my contract info and/or contract status fields so that the script will reflect cap totals in it.

 

 

test site that I am using to test out.

 

https://www68.myfant...&O=247&SEQNO=17


Founder and Commish of Buckeye Nation since 1995
Promised Land -Buckeye Nation franchise since 1995| 8 time champion
 


#3 HedgeHog

HedgeHog

    Veteran

  • Members
  • PipPipPip
  • 656 posts
  • Gender:Male
  • Location:Central Ohio
  • Interests:Theater, Las Vegas, Blackjack, Poker

Posted 15 January 2021 - 07:43 AM

Added this to my test site to check differences from the old script before '21.  Some really nice options added.  Nothing WE use, but the development is nice.  So, two requests:

1.  In the RFA/UFA extension section under section which allows display of potential salary extensions .... how difficult would it be to make that round UP instead of down (as can be done in the Contract value section?)

2.  Unrelated kind of but included here because this is the script in which I SAW it:  Draft salary.  Our league initial salary is set by draft pick used.  Currently in the draft this cannot be modified so at our draft after every round I input the salary manually before preceding to the next round.  Not a huge problem, but if this data could be set up before the draft to happen automatically that'd be nice!  Or am I missing something?


There IS no "Off Season"



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users