Skip to content

Commit

Permalink
Added support for NCAAM March Madness tournament
Browse files Browse the repository at this point in the history
  • Loading branch information
jclarke0000 committed Mar 19, 2018
1 parent 5318c8e commit 3a338da
Show file tree
Hide file tree
Showing 4 changed files with 475 additions and 7 deletions.
26 changes: 23 additions & 3 deletions MMM-MyScoreboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ Module.register("MMM-MyScoreboard",{
"NCAAM" : {
provider: "ESPN",
logoFormat: "png"
},
"NCAAM_MM" : {
provider: "ESPN",
logoFormat: "png"
}
},

Expand Down Expand Up @@ -185,14 +189,21 @@ Module.register("MMM-MyScoreboard",{
});
}

//redirect path to logos to NCAAM
//for March Madness
var leagueForLogoPath = league;
if (league == "NCAAM_MM") {
leagueForLogoPath = "NCAAM";
}

//add team logos if applicable
if (this.viewStyleHasLogos(viewStyle)) {

var hTeamLogo = document.createElement("span");
hTeamLogo.classList.add("logo", "home");

var hTeamLogoImg = document.createElement("img");
hTeamLogoImg.src = this.file("logos/" + league + "/" + gameObj.hTeam + "." + this.supportedLeagues[league].logoFormat );
hTeamLogoImg.src = this.file("logos/" + leagueForLogoPath + "/" + gameObj.hTeam + "." + this.supportedLeagues[league].logoFormat );
hTeamLogoImg.setAttribute("data-abbr", gameObj.hTeam);

hTeamLogo.appendChild(hTeamLogoImg);
Expand All @@ -211,7 +222,7 @@ Module.register("MMM-MyScoreboard",{
vTeamLogo.classList.add("logo", "visitor");

var vTeamLogoImg = document.createElement("img");
vTeamLogoImg.src = this.file("logos/" + league + "/" + gameObj.vTeam + "." + this.supportedLeagues[league].logoFormat );
vTeamLogoImg.src = this.file("logos/" + leagueForLogoPath + "/" + gameObj.vTeam + "." + this.supportedLeagues[league].logoFormat );
vTeamLogoImg.setAttribute("data-abbr", gameObj.vTeam);

vTeamLogo.appendChild(vTeamLogoImg);
Expand Down Expand Up @@ -348,7 +359,11 @@ Module.register("MMM-MyScoreboard",{
if (self.config.showLeagueSeparators) {
var leagueSeparator = document.createElement("div");
leagueSeparator.classList.add("league-separator");
leagueSeparator.innerHTML = "<span>" + sport.league + "</span>";
if (sport.label) {
leagueSeparator.innerHTML = "<span>" + sport.label + "</span>";
} else {
leagueSeparator.innerHTML = "<span>" + sport.league + "</span>";
}
wrapper.appendChild(leagueSeparator);
}
self.sportsData[index].forEach(function(game, gidx) {
Expand Down Expand Up @@ -474,6 +489,7 @@ Module.register("MMM-MyScoreboard",{
gameDate.subtract(1, "day");
}


var self = this;
this.config.sports.forEach( function(sport, index) {

Expand Down Expand Up @@ -639,6 +655,10 @@ Module.register("MMM-MyScoreboard",{
"WAC" : ["CHS", "CSB", "GCU", "NMSU", "SEA", "TRGV", "UMKC", "UVU"],
"Top 25" : ["@T25"] //special indicator for Top 25 ranked teams

},

NCAAM_MM : {

}

}
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ https://magicmirror.builders/<br>
https://github.com/MichMich/MagicMirror

This module display's today's scores for your favourite teams across a number of different
leagues, including NHL, NBA, NFL, MLB, MLS, CFL, NCAAF (FBS Division) and NCAAM (Division I).
leagues, including NHL, NBA, NFL, MLB, MLS, CFL, NCAAF (FBS Division) and NCAAM (Division I and March Madness).

![Screen Shot](/../screenshots/MMM-MyScoreboard-screenshot.png?raw=true "Screen Shot")

Expand Down Expand Up @@ -84,6 +84,7 @@ Currently this module supports the following leagues:
* **CFL** - Canadian Football League
* **NCAAF** - NCAA College Football (FBS Division only)
* **NCAAM** - NCAA College Basketball (Division I)
* **NCAAM_MM** - NCAA College Basketball (March Madness Tournament)

Each entry in your `sports` array is an object with two properties:

Expand All @@ -99,6 +100,10 @@ Each entry in your `sports` array is an object with two properties:
<td><code>league</code></td>
<td><strong>REQUIRED</strong> e.g.: <code>"NHL"</code>.<br><br><strong>Type</strong> <code>String</code></td>
</tr>
<tr>
<td><code>label</code></td>
<td>If <code>showLeagueSeparators</code> is set to <code>true</code>, you can optionally set a custom label for the separator. Useful in particular to show something other than <code>"NCAAM_MM"</code> for the March Madness tournament.<br><br><strong>Type</strong> <code>String</code><br />Defaults to the value for <code>league</code>.</td>
</tr>
<tr>
<td><code>teams</code></td>
<td>An array of teams for which you want to see scores. Specify teams using their shortcodes (e.g.: <code>"TOR"</code> for Toronto Maple Leafs.<br><br><strong>Type</strong> <code>Array</code><br>See below for a full listing of teams and their short codes<br><br><strong>UPDATE v2.0:</strong> This is no longer required.</td>
Expand Down Expand Up @@ -146,6 +151,10 @@ It should be noted that if you specify arrays for both <code>teams</code> and <c
{
league: "CFL",
teams: ["TOR", "MTL", "OTT"]
},
{
league: "NCAAM_MM",
label: "March Madness"
}
]
Expand Down Expand Up @@ -576,7 +585,7 @@ SEC
Sun Belt
```

### NCAAM (Division I)
### NCAAM (Division I and March Madness)
```
Teams:
---------------
Expand Down Expand Up @@ -933,7 +942,7 @@ XAV Xavier Musketeers
YALE Yale Bulldogs
YSU Youngstown State Penguins
Groups:
Groups (Division I only. No groups for March Madness):
---------------
Top 25
America East
Expand Down
Loading

0 comments on commit 3a338da

Please sign in to comment.