From 086470485d0224f552d9d01214a1771a093885f1 Mon Sep 17 00:00:00 2001 From: David Date: Sat, 15 Jun 2024 14:34:45 -0400 Subject: [PATCH] Release Candidate v0.13.1 (#86) - Display player headshots when available for individual sports Note: Must clear cache and refresh after upgrade. --- dist/const.js | 8 +++++++- dist/render_in.js | 8 ++++---- dist/render_post.js | 8 ++++---- dist/render_pre.js | 8 ++++---- dist/set_defaults.js | 5 +++++ dist/set_sports.js | 35 ++++++++++++++++++++++++----------- 6 files changed, 48 insertions(+), 24 deletions(-) diff --git a/dist/const.js b/dist/const.js index fad89f8..acbda00 100644 --- a/dist/const.js +++ b/dist/const.js @@ -1 +1,7 @@ -export let VERSION = "v0.13.0" \ No newline at end of file +export let VERSION = "v0.13.1"; + +export let GOLF_HEADSHOT_URL = "https://a.espncdn.com/i/headshots/golf/players/full/"; +export let MMA_HEADSHOT_URL = "https://a.espncdn.com/i/headshots/mma/players/full/"; +export let RACING_HEADSHOT_URL = "https://a.espncdn.com/i/headshots/rpm/players/full/"; +export let TENNIS_HEADSHOT_URL = "https://a.espncdn.com/i/headshots/tennis/players/full/"; +export let ERROR_HEADSHOT_URL = "https://cdn-icons-png.freepik.com/512/9706/9706583.png"; \ No newline at end of file diff --git a/dist/render_in.js b/dist/render_in.js index b12077f..eadf4c4 100644 --- a/dist/render_in.js +++ b/dist/render_in.js @@ -35,7 +35,7 @@ export function renderIn(c) { .on-second { opacity: ${c.onSecondOp}; display: inline-block; } .on-third { opacity: ${c.onThirdOp}; display: inline-block; } .pitcher { opacity: 0.0; display: inline-block; } - .in-row0 { display:${c.seriesSummaryDisplay}; font-size: 1.2em; text-align: center; margin: 4px; } + .in-series-info { display:${c.seriesSummaryDisplay}; font-size: 1.2em; text-align: center; margin: 4px; } .in-row1 { font-size: 1em; height: 1em; margin: 6px 0 2px; } .in-row2 { ; font-size: 1em; height: 1em; margin: 6px 0 2px; } .in-row1, .in-row2 { display: flex; justify-content: space-between; align-items: center; margin: 2px 0; } @@ -56,12 +56,11 @@ export function renderIn(c) {
${c.title}
-
${c.seriesSummary}
- +
${c.initials[1]}
${c.rank[1]} ${c.name[1]}
${c.record[1]}
@@ -77,7 +76,7 @@ export function renderIn(c) {
${c.score[2]}
- +
${c.initials[2]}
${c.rank[2]} ${c.name[2]}
${c.record[2]}
@@ -98,6 +97,7 @@ export function renderIn(c) {
${c.in0}
+
${c.seriesSummary}
${c.venue}
diff --git a/dist/render_post.js b/dist/render_post.js index 594b730..2c8b43f 100644 --- a/dist/render_post.js +++ b/dist/render_post.js @@ -21,18 +21,17 @@ export function renderPost(c) { .divider { font-size: 2.5em; text-align: center; opacity: 0; } .name { font-size: 1.4em; margin-bottom: 4px; } .rank { font-size:0.8em; display: ${c.rankDisplay}; } - .post-row0 { display:${c.seriesSummaryDisplay}; font-size: 1.2em; text-align: center; margin: 4px; } + .post-series-info { display:${c.seriesSummaryDisplay}; font-size: 1.2em; text-align: center; margin: 4px; } .post-row1 { font-size: 1.2em; text-align: center; }
${c.title}
-
${c.seriesSummary}
- +
${c.initials[1]}
${c.rank[1]} ${c.name[1]}
${c.record[1]}
@@ -41,13 +40,14 @@ export function renderPost(c) {
   
${c.score[2]}
- +
${c.initials[2]}
${c.rank[2]} ${c.name[2]}
${c.record[2]}
${c.finalTerm}
+
${c.seriesSummary}
`; // Return the HTML template diff --git a/dist/render_pre.js b/dist/render_pre.js index 1d1197b..31862ca 100644 --- a/dist/render_pre.js +++ b/dist/render_pre.js @@ -21,19 +21,18 @@ export function renderPre(c) { .gameday { font-size: 1.4em; height: 1.4em; } .gamedate { font-size: 1.1em; height: 1.1em; } .gametime { font-size: 1.1em; height: 1.1em; } - .pre-row0 { display:${c.seriesSummaryDisplay}; font-size: 1.2em; text-align: center; margin: 4px; } + .pre-series-info { display:${c.seriesSummaryDisplay}; font-size: 1.2em; text-align: center; margin: 4px; } .pre-row1 { font-weight: 500; font-size: 1.2em; height: 1.2em; margin: 6px 0 2px; } .pre-row1, .pre-row2, .pre-row3 { display: flex; justify-content: space-between; align-items: center; margin: 2px 0; }
${c.title}
-
${c.seriesSummary}
- +
${c.initials[1]}
${c.rank[1]} ${c.name[1]}
${c.record[1]}
@@ -44,12 +43,13 @@ export function renderPre(c) {
${c.gameTime}
- +
${c.initials[2]}
${c.rank[2]} ${c.name[2]}
${c.record[2]}
+
${c.seriesSummary}
${c.startTerm} ${c.startTime}
diff --git a/dist/set_defaults.js b/dist/set_defaults.js index 5d6d570..dd7ff6c 100644 --- a/dist/set_defaults.js +++ b/dist/set_defaults.js @@ -1,9 +1,12 @@ +import { ERROR_HEADSHOT_URL } from "./const.js"; + // // Initialize card data // export function initCardData(c) { c.logoBG = []; c.logo = []; + c.logoError = []; c.name = []; c.initials = []; c.rank = []; @@ -64,12 +67,14 @@ export function setDefaults(t, lang, stateObj, c, o, sport, team, oppo) { // Set Scoreboard data c.logo[team] = stateObj.attributes.team_logo; + c.logoError[team] = ERROR_HEADSHOT_URL; c.logoBG[team] = stateObj.attributes.team_logo; c.name[team] = stateObj.attributes.team_name; c.rank[team] = stateObj.attributes.team_rank; c.record[team] = stateObj.attributes.team_record; c.winner[team] = stateObj.attributes.team_winner || false; c.logo[oppo] = stateObj.attributes.opponent_logo; + c.logoError[oppo] = ERROR_HEADSHOT_URL; c.logoBG[oppo] = stateObj.attributes.opponent_logo; c.name[oppo] = stateObj.attributes.opponent_name; c.rank[oppo] = stateObj.attributes.opponent_rank; diff --git a/dist/set_sports.js b/dist/set_sports.js index 802ee26..727ac37 100644 --- a/dist/set_sports.js +++ b/dist/set_sports.js @@ -1,3 +1,5 @@ +import { GOLF_HEADSHOT_URL, MMA_HEADSHOT_URL, RACING_HEADSHOT_URL, TENNIS_HEADSHOT_URL } from "./const.js"; + // // Call function to set the data for the sport // @@ -119,6 +121,8 @@ export function setGolf(t, stateObj, c, team, oppo) { c.finalTerm = stateObj.attributes.clock; c.timeoutsDisplay = 'none'; + c.logo[team] = GOLF_HEADSHOT_URL + stateObj.attributes.team_id + ".png"; + c.logo[oppo] = GOLF_HEADSHOT_URL + stateObj.attributes.opponent_id + ".png"; } // @@ -149,6 +153,9 @@ export function setMMA(t, stateObj, c, team, oppo) { c.timeoutsDisplay = 'none'; c.barDisplay = "none"; c.barWrapDisplay = "none"; + + c.logo[team] = MMA_HEADSHOT_URL + stateObj.attributes.team_id + ".png"; + c.logo[oppo] = MMA_HEADSHOT_URL + stateObj.attributes.opponent_id + ".png"; } @@ -177,17 +184,19 @@ export function setRacing(t, stateObj, c, team, oppo) { c.barLabel[team] = t.translate("racing.teamBarLabel", "%s", String(stateObj.attributes.team_total_shots)); c.barLabel[oppo] = t.translate("racing.teamBarLabel", "%s", String(stateObj.attributes.team_total_shots)); - if (stateObj.attributes.league.includes("NASCAR")) { - c.logo[team] = null; - c.logo[oppo] = null; - c.initials[team] = ""; - c.initials[oppo] = ""; - if (c.name[team] && c.name[oppo]) { - c.initials[team] = c.name[team].split(" ").map((n)=>n[0]).join(""); - c.initials[oppo] = c.name[oppo].split(" ").map((n)=>n[0]).join(""); - c.initialsDisplay = 'inline'; - } - } +// if (stateObj.attributes.league.includes("NASCAR")) { +// c.logo[team] = null; +// c.logo[oppo] = null; +// c.initials[team] = ""; +// c.initials[oppo] = ""; +// if (c.name[team] && c.name[oppo]) { +// c.initials[team] = c.name[team].split(" ").map((n)=>n[0]).join(""); +// c.initials[oppo] = c.name[oppo].split(" ").map((n)=>n[0]).join(""); +// c.initialsDisplay = 'inline'; +// } +// } + c.logo[team] = RACING_HEADSHOT_URL + stateObj.attributes.team_id + ".png"; + c.logo[oppo] = RACING_HEADSHOT_URL + stateObj.attributes.opponent_id + ".png"; } // @@ -248,6 +257,10 @@ export function setTennis(t, stateObj, c, team, oppo) { } c.timeouts[team] = stateObj.attributes.team_sets_won; c.timeouts[oppo] = stateObj.attributes.opponent_sets_won; + + c.logo[team] = TENNIS_HEADSHOT_URL + stateObj.attributes.team_id + ".png"; + c.logo[oppo] = TENNIS_HEADSHOT_URL + stateObj.attributes.opponent_id + ".png"; + c.title = c.title || stateObj.attributes.event_name c.timeoutsDisplay = 'inline';