Skip to content

Commit 8761436

Browse files
committed
tweak styling again
1 parent 7ae9449 commit 8761436

File tree

1 file changed

+115
-115
lines changed

1 file changed

+115
-115
lines changed

modules/command-util.js

+115-115
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,23 @@ module.exports = {
120120
seasonStats.stat.avg + '/' + seasonStats.stat.obp + '/' + seasonStats.stat.slg +
121121
', ' + seasonStats.stat.homeRuns + ' HR, ' + seasonStats.stat.rbi + ' RBIs' +
122122
'\n\nSplits:\n\n' +
123-
'**Last 7 Games**' + (lastXGames ? ' (' + lastXGames.stat.plateAppearances + ' ABs)\n' : '\n') + (
124-
lastXGames
125-
? lastXGames.stat.avg + '/' + lastXGames.stat.obp + '/' + lastXGames.stat.slg
126-
: 'No at-bats!'
127-
) + '\n\n**vs. Righties**' + (vsRight ? ' (' + vsRight.stat.plateAppearances + ' ABs)\n' : '\n') + (
128-
vsRight
129-
? vsRight.stat.avg + '/' + vsRight.stat.obp + '/' + vsRight.stat.slg
130-
: 'No at-bats!'
131-
) + '\n\n**vs. Lefties**' + (vsLeft ? ' (' + vsLeft.stat.plateAppearances + ' ABs)\n' : '\n') + (
132-
vsLeft
133-
? vsLeft.stat.avg + '/' + vsLeft.stat.obp + '/' + vsLeft.stat.slg
134-
: 'No at-bats!'
135-
) + '\n\n**with RISP**' + (risp ? ' (' + risp.stat.plateAppearances + ' ABs)\n' : '\n') + (
136-
risp
137-
? risp.stat.avg + '/' + risp.stat.obp + '/' + risp.stat.slg
138-
: 'No at-bats!'
139-
);
123+
'**Last 7 Games**' + (lastXGames ? ' (' + lastXGames.stat.plateAppearances + ' ABs)\n' : '\n') + (
124+
lastXGames
125+
? lastXGames.stat.avg + '/' + lastXGames.stat.obp + '/' + lastXGames.stat.slg
126+
: 'No at-bats!'
127+
) + '\n\n**vs. Righties**' + (vsRight ? ' (' + vsRight.stat.plateAppearances + ' ABs)\n' : '\n') + (
128+
vsRight
129+
? vsRight.stat.avg + '/' + vsRight.stat.obp + '/' + vsRight.stat.slg
130+
: 'No at-bats!'
131+
) + '\n\n**vs. Lefties**' + (vsLeft ? ' (' + vsLeft.stat.plateAppearances + ' ABs)\n' : '\n') + (
132+
vsLeft
133+
? vsLeft.stat.avg + '/' + vsLeft.stat.obp + '/' + vsLeft.stat.slg
134+
: 'No at-bats!'
135+
) + '\n\n**with RISP**' + (risp ? ' (' + risp.stat.plateAppearances + ' ABs)\n' : '\n') + (
136+
risp
137+
? risp.stat.avg + '/' + risp.stat.obp + '/' + risp.stat.slg
138+
: 'No at-bats!'
139+
);
140140
},
141141

142142
buildLineScoreTable: async (game, linescore) => {
@@ -314,17 +314,17 @@ module.exports = {
314314
];
315315
const html = `
316316
<div id='savant-table'>` +
317-
`<img src="data:image/jpeg;base64, ${
318-
Buffer.from(spot).toString('base64')
319-
}" alt="alt text" />` +
320-
'<h3>Value</h3>' +
321-
buildSavantSection(value, metricSummaries) +
322-
'<h3>Hitting</h3>' +
323-
buildSavantSection(hitting, metricSummaries) +
324-
(fielding.find(stat => stat.value !== null) ? '<h3>Fielding</h3>' + buildSavantSection(fielding, metricSummaries) : '') +
325-
(catching.find(stat => stat.value !== null) ? '<h3>Catching</h3>' + buildSavantSection(catching, metricSummaries) : '') +
326-
'<h3>Running</h3>' +
327-
buildSavantSection(running, metricSummaries) +
317+
`<img src="data:image/jpeg;base64, ${
318+
Buffer.from(spot).toString('base64')
319+
}" alt="alt text" />` +
320+
'<h3>Value</h3>' +
321+
buildSavantSection(value, metricSummaries) +
322+
'<h3>Hitting</h3>' +
323+
buildSavantSection(hitting, metricSummaries) +
324+
(fielding.find(stat => stat.value !== null) ? '<h3>Fielding</h3>' + buildSavantSection(fielding, metricSummaries) : '') +
325+
(catching.find(stat => stat.value !== null) ? '<h3>Catching</h3>' + buildSavantSection(catching, metricSummaries) : '') +
326+
'<h3>Running</h3>' +
327+
buildSavantSection(running, metricSummaries) +
328328
'</div>';
329329

330330
return (await getScreenshotOfSavantTable(html));
@@ -360,7 +360,7 @@ module.exports = {
360360
buildSavantSection(value, metricSummaries, true) +
361361
'<h3>Pitching</h3>' +
362362
buildSavantSection(pitching, metricSummaries, true) +
363-
'</div>';
363+
'</div>';
364364

365365
return (await getScreenshotOfSavantTable(html));
366366
},
@@ -390,13 +390,13 @@ module.exports = {
390390
' vs. ' +
391391
(game.teams?.away?.team?.abbreviation || game.teams?.away?.abbreviation || game.gameData?.teams?.away?.abbreviation) +
392392
', ' + new Date((game.gameDate || game.datetime?.dateTime || game.gameData?.datetime?.dateTime)).toLocaleString('default', {
393-
month: 'short',
394-
day: 'numeric',
395-
timeZone: 'America/New_York',
396-
hour: 'numeric',
397-
minute: '2-digit',
398-
timeZoneName: 'short'
399-
});
393+
month: 'short',
394+
day: 'numeric',
395+
timeZone: 'America/New_York',
396+
hour: 'numeric',
397+
minute: '2-digit',
398+
timeZoneName: 'short'
399+
});
400400
},
401401

402402
buildPitchingStatsMarkdown: (pitchingStats, pitchMix, lastThree, seasonAdvanced, sabermetrics, includeExtra = false) => {
@@ -649,8 +649,8 @@ function getPitchCollections (dom) {
649649
.querySelectorAll('tbody tr td:nth-child(7)').forEach(el => MPHs.push(el.textContent.trim()));
650650
dom.window.document
651651
.querySelectorAll('tbody tr td:nth-child(18)').forEach(el => battingAvgsAgainst.push(
652-
(el.textContent.trim().length > 0 ? el.textContent.trim() : 'N/A')
653-
));
652+
(el.textContent.trim().length > 0 ? el.textContent.trim() : 'N/A')
653+
));
654654
return [pitches, percentages, MPHs, battingAvgsAgainst];
655655
}
656656

@@ -701,8 +701,8 @@ async function getScreenshotOfHTMLTables (tables) {
701701
padding: 15px;
702702
font-size: 20px;
703703
width: fit-content;">` +
704-
tables.reduce((acc, value) => acc + value.toString() + '\n\n', '') +
705-
'</pre>');
704+
tables.reduce((acc, value) => acc + value.toString() + '\n\n', '') +
705+
'</pre>');
706706
const element = await page.waitForSelector('#boxscore');
707707
const buffer = await element.screenshot({
708708
type: 'png',
@@ -717,84 +717,84 @@ async function getScreenshotOfSavantTable (savantHTML) {
717717
await page.setContent(
718718
`
719719
<style>
720-
#savant-table {
721-
background-color: #151820;
722-
color: whitesmoke;
723-
font-size: 25px;
724-
font-family: 'Segoe UI', sans-serif;
725-
width: 65%;
726-
display: flex;
727-
padding: 17px 77.5px 17px 60px;
728-
flex-direction: column;
729-
align-items: center;
730-
}
731-
.savant-stat {
732-
display: flex;
733-
width: 100%;
734-
justify-content: space-between;
735-
margin: 5px 0;
736-
align-items: center;
737-
}
738-
.value {
739-
margin-right: 22.5px;
740-
}
741-
.savant-stat-pitcher {
742-
margin: 12px 0;
743-
}
744-
h3 {
745-
font-size: 30px;
746-
font-weight: bold;
747-
width: 100%;
748-
text-align: center;
749-
margin: 0 0 10px 0;
750-
}
751-
/*#savant-table h3:not(:first-child) {*/
752-
/* margin: 10px 0;*/
753-
/*}*/
754-
.percentile {
755-
width: 35px;
756-
height: 35px;
757-
font-size: 0.7em;
758-
display: flex;
759-
align-items: center;
760-
justify-content: center;
761-
font-weight: bold;
762-
border-radius: 50%;
763-
position: absolute;
764-
top: 50%;
765-
left: -20px;
766-
transform: translateY(-50%);
767-
}
768-
.percentile-slider-not-qualified {
769-
background-image: repeating-linear-gradient(
720+
#savant-table {
721+
background-color: #151820;
722+
color: whitesmoke;
723+
font-size: 25px;
724+
font-family: 'Segoe UI', sans-serif;
725+
width: 70%;
726+
display: flex;
727+
padding: 17px 57.5px 17px 40px;
728+
flex-direction: column;
729+
align-items: center;
730+
}
731+
.savant-stat {
732+
display: flex;
733+
width: 100%;
734+
justify-content: space-between;
735+
margin: 5px 0;
736+
align-items: center;
737+
}
738+
.value {
739+
margin-right: 22.5px;
740+
}
741+
.savant-stat-pitcher {
742+
margin: 12px 0;
743+
}
744+
h3 {
745+
font-size: 25px;
746+
font-weight: bold;
747+
width: 100%;
748+
text-align: center;
749+
margin: 5px 0;
750+
}
751+
#savant-table h3:not(:first-child) {
752+
margin: 5px 0;
753+
}
754+
.percentile {
755+
width: 35px;
756+
height: 35px;
757+
font-size: 0.7em;
758+
display: flex;
759+
align-items: center;
760+
justify-content: center;
761+
font-weight: bold;
762+
border-radius: 50%;
763+
position: absolute;
764+
top: 50%;
765+
left: -20px;
766+
transform: translateY(-50%);
767+
}
768+
.percentile-slider-not-qualified {
769+
background-image: repeating-linear-gradient(
770770
-45deg,
771771
transparent,
772772
transparent 3px,
773773
rgba(0, 0, 0, 0.95) 3px,
774774
rgba(0, 0, 0, 0.95) 6px
775-
);
776-
}
777-
.percentile-not-qualified {
778-
display: none;
779-
}
780-
.stat-values {
781-
display: flex;
782-
width: 9.5em;
783-
justify-content: space-between;
784-
align-items: center;
785-
}
786-
.percentile-slider {
787-
position: relative;
788-
width: 150px;
789-
height: 0.75em;
790-
background: #80808045;
791-
}
792-
.percentile-slider-portion {
793-
position: absolute;
794-
width: 100%;
795-
height: 100%;
796-
}
797-
</style>` +
775+
);
776+
}
777+
.percentile-not-qualified {
778+
display: none;
779+
}
780+
.stat-values {
781+
display: flex;
782+
width: 9.5em;
783+
justify-content: space-between;
784+
align-items: center;
785+
}
786+
.percentile-slider {
787+
position: relative;
788+
width: 150px;
789+
height: 0.75em;
790+
background: #80808045;
791+
}
792+
.percentile-slider-portion {
793+
position: absolute;
794+
width: 100%;
795+
height: 100%;
796+
}
797+
</style>` +
798798
savantHTML
799799
);
800800
LOGGER.trace((await page.content()));
@@ -875,8 +875,8 @@ async function getScreenshotOfLineScore (tables, inning, half, awayScore, homeSc
875875
<div id="home-abb">` + homeAbbreviation + `</div>
876876
</div>
877877
<pre id="boxscore">` +
878-
tables.reduce((acc, value) => acc + value.toString() + '\n\n', '') +
879-
`</pre>
878+
tables.reduce((acc, value) => acc + value.toString() + '\n\n', '') +
879+
`</pre>
880880
</div>`);
881881
const element = await page.waitForSelector('#line-score-container');
882882
const buffer = await element.screenshot({

0 commit comments

Comments
 (0)