@@ -120,23 +120,23 @@ module.exports = {
120
120
seasonStats . stat . avg + '/' + seasonStats . stat . obp + '/' + seasonStats . stat . slg +
121
121
', ' + seasonStats . stat . homeRuns + ' HR, ' + seasonStats . stat . rbi + ' RBIs' +
122
122
'\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
+ ) ;
140
140
} ,
141
141
142
142
buildLineScoreTable : async ( game , linescore ) => {
@@ -314,17 +314,17 @@ module.exports = {
314
314
] ;
315
315
const html = `
316
316
<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 ) +
328
328
'</div>' ;
329
329
330
330
return ( await getScreenshotOfSavantTable ( html ) ) ;
@@ -360,7 +360,7 @@ module.exports = {
360
360
buildSavantSection ( value , metricSummaries , true ) +
361
361
'<h3>Pitching</h3>' +
362
362
buildSavantSection ( pitching , metricSummaries , true ) +
363
- '</div>' ;
363
+ '</div>' ;
364
364
365
365
return ( await getScreenshotOfSavantTable ( html ) ) ;
366
366
} ,
@@ -390,13 +390,13 @@ module.exports = {
390
390
' vs. ' +
391
391
( game . teams ?. away ?. team ?. abbreviation || game . teams ?. away ?. abbreviation || game . gameData ?. teams ?. away ?. abbreviation ) +
392
392
', ' + 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
+ } ) ;
400
400
} ,
401
401
402
402
buildPitchingStatsMarkdown : ( pitchingStats , pitchMix , lastThree , seasonAdvanced , sabermetrics , includeExtra = false ) => {
@@ -649,8 +649,8 @@ function getPitchCollections (dom) {
649
649
. querySelectorAll ( 'tbody tr td:nth-child(7)' ) . forEach ( el => MPHs . push ( el . textContent . trim ( ) ) ) ;
650
650
dom . window . document
651
651
. 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
+ ) ) ;
654
654
return [ pitches , percentages , MPHs , battingAvgsAgainst ] ;
655
655
}
656
656
@@ -701,8 +701,8 @@ async function getScreenshotOfHTMLTables (tables) {
701
701
padding: 15px;
702
702
font-size: 20px;
703
703
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>' ) ;
706
706
const element = await page . waitForSelector ( '#boxscore' ) ;
707
707
const buffer = await element . screenshot ( {
708
708
type : 'png' ,
@@ -717,84 +717,84 @@ async function getScreenshotOfSavantTable (savantHTML) {
717
717
await page . setContent (
718
718
`
719
719
<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(
770
770
-45deg,
771
771
transparent,
772
772
transparent 3px,
773
773
rgba(0, 0, 0, 0.95) 3px,
774
774
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>` +
798
798
savantHTML
799
799
) ;
800
800
LOGGER . trace ( ( await page . content ( ) ) ) ;
@@ -875,8 +875,8 @@ async function getScreenshotOfLineScore (tables, inning, half, awayScore, homeSc
875
875
<div id="home-abb">` + homeAbbreviation + `</div>
876
876
</div>
877
877
<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>
880
880
</div>` ) ;
881
881
const element = await page . waitForSelector ( '#line-score-container' ) ;
882
882
const buffer = await element . screenshot ( {
0 commit comments