PLEASE GO TO THIS POST FOR THE LATEST UPDATE TO THIS SCRIPT
http://forums.myfantasyleague.com/forums/index.php?showtopic=38096&p=200564
The script is stand-alone meaning it is only one file and does not need to be used in conjunction with other files.
However it has been coded so you can use the same vars that you had been using before.
You should get rid of all references to habmanJSON_common.js and habmanJSON_reports.js as those scripts were bloated and difficult to edit and troubleshoot.
===========================================================================================
I have a module working for my league that will automatically determine the division winners and wild-card teams according to my leagues rules.
You can check it out here: http://football24.my...2006/home/19610 (under the 'Playoffs' tab)
If you would like something similar then just copy the below code to where you would like the module to appear on your home page.
<script language="JavaScript" type="text/javascript" src="http://www.habman.com/mfl/apps/js/habman_apps_ver2.js"></script> <script language="JavaScript" type="text/javascript"> <!-- // Tie-Breaker Legend: // 1 - Winning Percentage // 2 - Divisional Winning Percentage // 3 - Divisional Points For // 4 - Points For // 5 - Victory Points // 6 - Power Rank // 7 - Play-All Winning Percentage // 8 - Head to Head // 9 - Coin Flip (ie random) // 10 - Non-Divisional Winning Percentage // 11 - Non-Divisional Points For // 12 - Reverse Points Allowed // 13 - Conference Winning Percentage // 14 - Conference Points For // 15 - Non-Conference Winning Percentage // 16 - Non-Conference Points For // 17 - Common Games (default 4 game minimum; see var below) // 18 - Head to head points scored // 19 - Strength of Schedule // 20 - Strength of Victory // 0 - Default (must be included at the end of the arrays below) // Assign tie-breakers into the respective arrays using the legend above. var divisionTieBreaker = [1,8,2,3,4,9,0]; var wildCardTieBreaker = [1,8,4,9,0]; var numWildCardTeams = 4; // OPTIONAL VAR SECTION change variables below to suit your league var useStartOverRule = false; //MFL default is false; most leagues are true var useDivisionBestRule = false; var useSweepRule = false; var conferenceLikeDivision = false; var numDivisionTeams = 1; var commonGameMinGP = 4; //Works in conjunction with common games tiebreaker var scoringDecimals = 2; //Sets the decimal display for all scoring in the tables var useDivisionIcon = false; //Place a coloured icon in the tables distinguishing divisions // NO NEED TO EDIT BELOW THIS LINE synchronousXMLRequest(leagueFile, 'getLeagueData', 'league') synchronousXMLRequest(standingsFile,'doStandingsArray','standings') doHeadToHeadArray(); doPlayoffTable(); //--> </script>
Currently there are 16 tiebreakers to choose from. Just set up the Divisional and WildCard tiebreaker arrays in the code above to meet your leagues needs. You must leave the 0 as the last entry.
For instance if my divisional tiebreaker was: 1)Divisional Points Scored 2)Divisional Winning %
Then my divisional tiebreaker array would be var divisionTieBreaker = [3,2,0];
Also enter the number of wild card teams for your league.
OTHER NOTES & SETTINGS
Special Seed
- Set the last playoff spot based on a specific category
- Use tiebreaker legend above to set the specialSeed array
- Add the following var to the VAR SECTION in the code above to enable
var specialSeed = [7,6,5,4,0];
If you add the var specialSeed as shown above it will search the teams that are out of the playoffs and add the teams with the best playall win%. If tied then power rank all the way down the line until the seed is assigned.
================================================================
Table Captions
- Use alternative text in the table captions
- Change the quoted text to whatever you want
- You can use html here but use single quotes if quotes are required
- Listed below are the default settings
- Add the following var(s) to the VAR SECTION in the code above to enable
var titleHeader = "<h4>If the playoffs were to start today</h4>"; var titleDivisionWinner = "Division Winners"; var titleWildCardWinner = "Wild Card Winners"; var titleNonPlayoffTeam = "Out of the Playoffs"; var titlePlayoffTeam = "Playoff Teams";
================================================================
Columns to Display
- Set the stats columns that are to be displayed in the table(s)
- Default columns are shown in the code below i.e. Overall Record and Points Scored
- Set the array using the legend below
- You can display as many columns as you want
- Add the following var to the VAR SECTION in the code above to enable
var displayColumns = [6,8];
Here is the Column to Display legend:
1&2 are unused
3 = Wins
4 = Losses
5 = Ties
6 = Record
7 = Win %
8 = Points Scored
9 = Points Allowed
10 = Divisional Wins
11 = Divisional Losses
12 = Divisional Ties
13 = Divisional Record
14 = Divisional Win %
15 = Divisional Points Scored
16 = Power Ranking
17 = Victory Points
18 = Play-All Wins
19 = Play-All Losses
20 = Play-All Ties
21 = Play-All Record
22 = Play-All Win %
23 = Non-divisional Wins
24 = Non-divisional Losses
25 = Non-divisional Ties
26 = Non-divisional Record
27 = Non-divisional Win %
28 = Non-divisional Points Scored
29 = Conference Wins
30 = Conference Losses
31 = Conference Ties
32 = Conference Record
33 = Conference Win %
34 = Conference Points Scored
35 = Non-Conference Wins
36 = Non-Conference Losses
37 = Non-Conference Ties
38 = Non-Conference Record
39 = Non-Conference Win %
40 = Non-Conference Points Scored
42 = Strength of Schedule Record
43 = Strength of Schedule Win %
================================================================
Division Best Wildcard Seeding
- For leagues that only compare the best unseeded team in a division for each wildcard playoff seed.
- This is similar to how the NFL seeds wildcard teams
- Add the following var to the VAR SECTION in the code above to enable
var useDivisionBestRule = true;
================================================================
Conference-like Divisions
- For leagues without conferences (only divisions) but would like to have their own seperate playoffs for each division
- see Damage Ink's post for more details
- Add the following var to the VAR SECTION in the code above to enable
var conferenceLikeDivision = true;
================================================================
Division Winners/Leaders
- For leagues that would like to automatically advance more than one team from one division before getting to the wildcard tiebreakers.
- Add the following var to the VAR SECTION in the code above and set it to the number of divisional teams that will automatically advance.
var numDivisionTeams = 2;
The code above will automatically advance two teams from one division before doing the wildcards.
================================================================
Info on Head to Head tiebreakers
For Two-Teams: this tiebreaker works as everyone would expect. If the two teams played each other then the team with the better win% wins the tiebreaker.
For Three or More Teams (default rule): this app, by default, uses MFL's rule of "Head to head Winning Percentage" for both divisional and wildcard tiebreakers. How this works is you take all the teams tied and look at the games between them. You would then calculate a winning percentage for each team based on the wins/losses/ties each team has accumulated in these games and the team with the highest winning percentage would advance. If a team hasn't played any of the other tied teams then they will be given a 0.000 winning percentage for sorting purposes (MFL's rule not mine)
You can set the way this app enforces Head to Head Winning Percentage to suit your leagues needs:
There are four different settings:
0: Use head to head winning percentage for two teams tied only. If more than two teams then skip to the next tiebreaker.
1: Use MFL's default rule as described above. This is also the default setting for this var.
2: All the tied teams must have played at least one of the other tied teams.
3: All the tied teams must have played all of the other tied teams at least once.
To set the Winning Percent Rule use the following var
var useWinPctRule = 1;
For Three or More Teams (optional sweep rule): This works like the NFL "Sweep Rule" for head to head tiebreakers when three or more teams are tied. This applies for wild-card tiebreakers only. How this works is that one team must have swept or been swept by all the other tied teams before advancing or being eliminated from the tiebreaking process.
To activate the sweep rule for wildcard tiebreakers add the following var
var useSweepRule = true;
Note: if activated this will be used instead of the default rule for wildcard tiebreakers only. Divisional tiebreakers will still use the default rule explained above. This rule when activated will also set the useStartOverRule (see other notes below) to true because it doesn't make sense otherwise.
================================================================
Optional CSS Settings
- Each table has an ID associated with it
- You can use these ID's in your custom CSS file to set attributes for the tables
- The ID names for each table can be attained by hovering over the table caption and a tooltip will display the name
Notes:
- If a table is empty it will automatically be hidden
- There is an outer table nesting all the tables that may appear invisible if your league has only one conference. You can not get the table ID for this outer table using the tooltip method because no caption will be displayed. To get this table ID do the following. If the nested tables ID's last digit is "1" then the table ID for this table is "outerplayoff_table0-1". If "2" then the ID is "outerplayoff_table0-2" etc.
Sample CSS code to hide Division Winners Caption assuming id is divisionwinner_table0-0.
#divisionwinner_table0-0 { display: none; }
================================================================
Other Notes
This app, by default, uses MFL sorting rules which do not start over from the first tiebreaker after a team is assigned a seed.
Most leagues (IMO) use the NFL rule that only one club advances to the playoffs or is eliminated from the playoffs in any tie-breaking step. Remaining tied clubs revert to the first step of the applicable Division or Wild-Card tie breakers
To activate this rule use the following var
var useStartOverRule = true;
================================================================
My ultimate goal is to make a module that will work for most MFL leagues. That being said I am looking for input on how to improve the module by adding more tie-breakers that I am overlooking that you would like to see included.