sfc-utils 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/topper.js ADDED
@@ -0,0 +1,825 @@
1
+
2
+ let { getBrands } = require('./brands')
3
+
4
+ let getTopper = function(settings){
5
+
6
+ let storySettings = settings[0];
7
+ let topperLayout = storySettings.Topper_Layout ? storySettings.Topper_Layout : 'sidebyside';
8
+ let topperTextPosition = storySettings.Topper_Text_Position ? storySettings.Topper_Text_Position : "center-bottom";
9
+ let topperTextBackground = storySettings.Topper_Text_Background ? storySettings.Topper_Text_Background : "gradient";
10
+ let topperSettingsArray = [topperLayout, topperTextPosition, topperTextBackground];
11
+ let topperClass = topperLayout + " " + topperTextPosition + " " + topperTextBackground;
12
+ let mediaChoice = ``;
13
+ let topperImages = [];
14
+ let animationDuration;
15
+ let disableCover = (storySettings.Topper_Contain === true || storySettings.Topper_Contain === "true") ? 'contain' : 'cover';
16
+ storySettings.Slide_Duration ? animationDuration = storySettings.Slide_Duration : animationDuration = false;
17
+ let articleAuthorName = storySettings.Byline ? storySettings.Byline : storySettings.Author;
18
+ let articleAuthorLink = storySettings.Byline_Link ? storySettings.Byline_Link : storySettings.AUTHOR_PAGE;
19
+ let noImage = false;
20
+
21
+ if(storySettings.Topper_Mp4){
22
+ mediaChoice = `
23
+ <video id="topper-intro-video-sfc-utils" muted loop autoPlay playsInline poster=${storySettings.Topper_Mp4.trim().replace('.mp4', '.jpg')}>
24
+ <source src=${storySettings.Topper_Mp4.trim().replace('.mp4', '.m3u8')} type="application/vnd.apple.mpegurl" />
25
+ <source src=${storySettings.Topper_Mp4.trim()} type="video/mp4" />
26
+ </video>`
27
+ }
28
+ else if(storySettings.TopperVidURL){
29
+ mediaChoice = `
30
+ <video id="topper-intro-video-sfc-utils" muted loop autoPlay playsInline poster=${storySettings.TopperVidURL.trim().replace('.mp4', '.jpg')}>
31
+ <source src=${storySettings.TopperVidURL.trim().replace('.mp4', '.m3u8')} type="application/vnd.apple.mpegurl" />
32
+ <source src=${storySettings.TopperVidURL.trim()} type="video/mp4" />
33
+ </video>`
34
+ }
35
+ else if(storySettings.Topper_ImageID){
36
+
37
+
38
+ // Make sure it's a string before we do string ops
39
+ storySettings.Topper_ImageID = storySettings.Topper_ImageID.toString().trim();
40
+ topperImages = storySettings.Topper_ImageID.split(", ");
41
+
42
+ if(topperImages.length > 1){
43
+ animationDuration ? animationDuration = topperImages.length * storySettings.Slide_Duration : animationDuration = topperImages.length * 5;
44
+
45
+ for (let i = 0; i < topperImages.length; i++) {
46
+ let imagePrefix = "https://s.hdnux.com/photos/0/0/0/" + topperImages[i] + "/1/"
47
+
48
+ mediaChoice += `<img class="topper-image topper-intro-img-sfc-utils fade${i}"
49
+ src="${imagePrefix}325x0.jpg"
50
+ srcSet="${imagePrefix}400x0.jpg 325w,
51
+ ${imagePrefix}768x0.jpg 768w,
52
+ ${imagePrefix}1366x0.jpg 1366w,
53
+ ${imagePrefix}1920x0.jpg 1920w,
54
+ ${imagePrefix}2560x0.jpg 2560w,
55
+ ${imagePrefix}3840x0.jpg 3840w">`
56
+ }
57
+ }
58
+ else if(topperImages.length == 1) {
59
+ let imagePrefix = "https://s.hdnux.com/photos/0/0/0/" + topperImages[0] + "/1/"
60
+
61
+ mediaChoice += `<img class="topper-image topper-intro-img-sfc-utils"
62
+ src="${imagePrefix}325x0.jpg"
63
+ srcSet="${imagePrefix}400x0.jpg 325w,
64
+ ${imagePrefix}768x0.jpg 768w,
65
+ ${imagePrefix}1366x0.jpg 1366w,
66
+ ${imagePrefix}1920x0.jpg 1920w,
67
+ ${imagePrefix}2560x0.jpg 2560w,
68
+ ${imagePrefix}3840x0.jpg 3840w">`
69
+ }
70
+ }
71
+ else{
72
+ noImage = true;
73
+ }
74
+ //Split topper images
75
+ const convertDatesToAP = (dateString) => {
76
+ // Convert date string to AP style abbreviations
77
+ let newDateString = dateString;
78
+ newDateString = newDateString.replace('January', 'Jan.').replace('February', 'Feb.').replace('August', 'Aug.').replace('September', 'Sept.').replace('October', 'Oct.').replace('November','Nov.').replace('December','Dec.');
79
+ // Return the result
80
+ return newDateString;
81
+ }
82
+ // Convert date to readable time
83
+ let readablePubDate = convertDatesToAP(storySettings.Publish_Date);
84
+ // Check safely for MOD_DATE
85
+ let readableModDate = storySettings.LastModDate_C2P ? convertDatesToAP(storySettings.LastModDate_C2P) : false;
86
+ let getBylineText = (authorName, authorLink, publishDate, modifyDate) =>{
87
+ let newPubDateString = publishDate;
88
+ try {
89
+ newPubDateString = publishDate.match(/.*\d{4}/gm)[0];
90
+ } catch (err){
91
+ // That's fine
92
+ console.log(err);
93
+ }
94
+ let author = authorLink ?
95
+ `<a class="byline-link" href=${authorLink.includes('http') ? `\"${authorLink}\"` : `\"https://${authorLink}\"`}>${authorName.trim()}</a>`
96
+ : authorName.trim();
97
+ let initialText = (`By ${author} | ${newPubDateString}`);
98
+ if(modifyDate){
99
+ return initialText + (" | Updated: " + modifyDate);
100
+ }
101
+ else{
102
+ return initialText;
103
+ }
104
+ }
105
+ let topperCSS = `
106
+ #topper-intro-video-sfc-utils, .topper-intro-img-sfc-utils {
107
+ max-width: 100%;
108
+ left: 0;
109
+ }
110
+ #topper-intro-video-sfc-utils{
111
+ width: 100%;
112
+ object-fit: ${disableCover};
113
+ }
114
+ #topper-intro-container {
115
+ display: flex;
116
+ max-width: 1400px;
117
+ margin: 0 auto;
118
+ }
119
+ #topper-article-title h1{
120
+ letter-spacing: 1px;
121
+ font-size: 2em;
122
+ margin-top: 0;
123
+ font-weight: 400;
124
+ line-height: 1.1;
125
+ margin-bottom: 15px
126
+ }
127
+ #topper-article-title .topper-article-dek{
128
+ margin: 0 auto 10px;
129
+ line-height: 1.2;
130
+ font-size: 1em;
131
+ }
132
+ #topper-article-title .topper-article-byline{
133
+ color: #222;
134
+ line-height: 1.2;
135
+ font-size: 0.8em;
136
+ }
137
+ .topper-intro-img-sfc-utils{
138
+ position: absolute;
139
+ top: 0;
140
+ width: 100%;
141
+ height: 100%;
142
+ }
143
+ `
144
+ if(storySettings.Topper_CustomCSS_Inject){
145
+ topperCSS += storySettings.Topper_CustomCSS_Inject;
146
+ }
147
+ if(topperImages.length > 1){
148
+
149
+ let animationInterval = (100 / topperImages.length);
150
+ for(let i = 0; i < topperImages.length; i++){
151
+ let animationCSS = `@keyframes animfade${i}{`
152
+ for(let interval = 0; interval <= 101; interval+= animationInterval){
153
+ if(Math.round(interval) == 100){
154
+ if(i != (topperImages.length - 1)){
155
+ animationCSS += `}`
156
+ topperCSS += animationCSS;
157
+ topperCSS += `
158
+ .fade${i}{
159
+ opacity: 0;
160
+ position: absolute;
161
+ animation: animfade${i} ${animationDuration}s infinite;
162
+ }
163
+ `
164
+ }
165
+ else{
166
+ // set last image animation
167
+ animationCSS += `
168
+ ${interval - (animationInterval * 1.17)}%{
169
+ opacity: 0;
170
+ position: absolute;
171
+ }
172
+ ${interval - (animationInterval * 1.16)}%{
173
+ opacity: 0;
174
+ position: relative;
175
+ }
176
+ ${interval - (animationInterval * 1.15)}%{
177
+ opacity: 1;
178
+ }
179
+ ${interval - animationInterval}%{
180
+ opacity: 1;
181
+ position: relative;
182
+ ${interval - (animationInterval * 0.82)}%{
183
+ opacity: 0;
184
+ }
185
+ ${interval - (animationInterval * 0.92)}%{
186
+ opacity: 0;
187
+ position: absolute;
188
+ }
189
+ }
190
+ }
191
+ `
192
+ topperCSS += animationCSS;
193
+ topperCSS += `
194
+ .fade${i}{
195
+ opacity: 0;
196
+ animation: animfade${i} ${animationDuration}s infinite;
197
+ }
198
+ `
199
+ }
200
+ }
201
+ else if(Math.round(((i) * animationInterval)) == Math.round(interval)){
202
+ animationCSS += `
203
+ ${interval - (animationInterval * 0.17)}%{
204
+ opacity: 0;
205
+ color: red;
206
+ position: absolute;
207
+ }
208
+ ${interval - (animationInterval * 0.16)}%{
209
+ opacity: 0;
210
+ color: blue;
211
+ position: relative;
212
+ }
213
+ ${interval - (animationInterval * 0.15)}%{
214
+ opacity: 0;
215
+ }
216
+ ${interval}%{
217
+ opacity: 1;
218
+ position: relative;
219
+ }
220
+ ${interval + (animationInterval * .7)}%{
221
+ opacity: 1;
222
+ position: relative;
223
+ }
224
+ ${interval + (animationInterval * 0.81)}%{
225
+ opacity: 0;
226
+ position: relative;
227
+ }
228
+ ${interval + (animationInterval * 0.82)}%{
229
+ opacity: 0;
230
+ position: absolute;
231
+ }
232
+ `
233
+ }
234
+
235
+ else{
236
+ animationCSS += `${interval}%{
237
+ opacity: 0;
238
+ }`
239
+ }
240
+ }
241
+
242
+ }
243
+ }
244
+ if(noImage){
245
+ topperCSS += `
246
+ #topper-mediacontainer{
247
+ display: none !important;
248
+ }
249
+ #topper-intro-container{
250
+ justify-content: center;
251
+ align-items: center;
252
+ }
253
+ #topper-article-title{
254
+ text-align: center;
255
+ max-width: 50%;
256
+ margin: 37px auto;
257
+ }
258
+ @media screen and (max-width: 700px){
259
+ #topper-article-title{
260
+ max-width: 80%;
261
+ }
262
+ }
263
+ `
264
+ }
265
+ else{
266
+ for(let setting of topperSettingsArray){
267
+ if(setting == "full"){
268
+ topperCSS += `
269
+ #topper-intro-container > * {
270
+ flex: 0 0 50%;
271
+ overflow: hidden;
272
+ }
273
+ @keyframes arrow-float{
274
+ from{
275
+ bottom: 0;
276
+ }
277
+ to{
278
+ bottom: 10px;
279
+ }
280
+ }
281
+ #topper-intro-container.full {
282
+ background-color: black;
283
+ position: relative;
284
+ top: 0px;
285
+ left: 0;
286
+ right: 0;
287
+ height: calc(100vh - 37px);
288
+ }
289
+ .topper-intro-img-sfc-utils, #topper-intro-video-sfc-utils{
290
+ object-fit: ${disableCover};
291
+ width: 100%;
292
+ height: 100%;
293
+ position: absolute;
294
+ }
295
+ #topper-mediacontainer{
296
+ position: absolute;
297
+ top: 37px;
298
+ left: 0;
299
+ right: 0;
300
+ height: calc(100vh - 37px);
301
+ width: 100%;
302
+ }
303
+ #topper-intro-container.full > * {
304
+ flex: 0 0 100%;
305
+ }
306
+ #topper-intro-container.full #topper-article-title {
307
+ position: absolute;
308
+ border: 1px;
309
+ max-width: 500px;
310
+ padding: 20px 40px;
311
+ }
312
+ @media {
313
+ #topper-intro-container.full {
314
+ max-width: 100%;
315
+ position: static;
316
+ }
317
+ }
318
+
319
+
320
+ #topper-intro-container.full.center-bottom, #topper-intro-container.full.center-top, #topper-intro-container.full.center {
321
+ justify-content: center;
322
+ }
323
+
324
+ `
325
+ if(storySettings.Topper_Mobile_Fallback == 'stacked'){
326
+ topperCSS += `
327
+ @media screen and (max-width: 700px){
328
+ #topper-intro-container > * {
329
+ max-width: 55%;
330
+ margin: 1em auto .5em auto;
331
+ }
332
+ #topper-intro-container.full {
333
+ background-color: unset;
334
+ flex-direction: column-reverse;
335
+ justify-content: flex-end !important;
336
+ height: unset;
337
+ margin-bottom: 30px;
338
+ }
339
+ #topper-intro-container.full > *, #topper-intro-container.full > * {
340
+ flex: 0 0 100%;
341
+ max-width: unset;
342
+ margin: 1em auto .5em auto;
343
+ }
344
+ .topper-intro-img-sfc-utils, #topper-intro-video-sfc-utils{
345
+ object-fit: ${disableCover};
346
+ width: 100%;
347
+ margin: auto;
348
+ position: static;
349
+ }
350
+ #topper-intro-container > * {
351
+ flex: unset !important;
352
+ }
353
+ #topper-mediacontainer{
354
+ flex: unset !important;
355
+ width: 100%;
356
+ height: 40vh;
357
+ position: static;
358
+ }
359
+ .topper-intro-img-sfc-utils, #topper-intro-video-sfc-utils{
360
+ object-fit: contain !important;
361
+ positon: relative;
362
+ }
363
+ #topper-intro-container.full #topper-article-title{
364
+ text-align: left !important;
365
+ background: none !important;
366
+ color: black !important;
367
+ position: static;
368
+ padding: 0 !important;
369
+ }
370
+ .topper-article-byline{
371
+ color: #222 !important;
372
+ }
373
+ #topper-intro-container.full > #topper-article-title{
374
+ max-width: unset;
375
+ width: 90%;
376
+ }
377
+ #topper-article-title{
378
+ max-width: unset;
379
+ width: 90%;
380
+ }
381
+ }`
382
+ }
383
+ else if(storySettings.Topper_Mobile_Fallback == 'stacked-reverse'){
384
+ topperCSS += `
385
+ @media screen and (max-width: 700px){
386
+ #topper-intro-container > * {
387
+ max-width: 55%;
388
+ margin: 1em auto .5em auto;
389
+ }
390
+ #topper-intro-container.full {
391
+ background-color: unset;
392
+ flex-direction: column;
393
+ justify-content: flex-end !important;
394
+ height: unset;
395
+ margin-bottom: 30px;
396
+ }
397
+ #topper-intro-container.full > *, #topper-intro-container.full > * {
398
+ flex: 0 0 100%;
399
+ max-width: unset;
400
+ margin: 1em auto .5em auto;
401
+ }
402
+ .topper-intro-img-sfc-utils, #topper-intro-video-sfc-utils{
403
+ object-fit: ${disableCover};
404
+ width: 100%;
405
+ margin: auto;
406
+ }
407
+ #topper-intro-container > * {
408
+ flex: unset !important;
409
+ }
410
+ #topper-mediacontainer{
411
+ flex: unset !important;
412
+ width: 100%;
413
+ height: 40vh;
414
+ position: relative;
415
+ top: 0px !important
416
+ }
417
+ .topper-intro-img-sfc-utils, #topper-intro-video-sfc-utils{
418
+ object-fit: contain !important;
419
+ }
420
+ #topper-intro-container.full #topper-article-title{
421
+ text-align: left !important;
422
+ background: none !important;
423
+ color: black !important;
424
+ position: static;
425
+ padding: 0 !important;
426
+ }
427
+ .topper-article-byline{
428
+ color: #222 !important;
429
+ }
430
+ #topper-intro-container.full > #topper-article-title{
431
+ max-width: unset;
432
+ width: 90%;
433
+ }
434
+ #topper-article-title{
435
+ max-width: unset;
436
+ width: 90%;
437
+ }
438
+ }`
439
+ }
440
+ else{
441
+ topperCSS += `
442
+ @media screen and (max-width: 700px){
443
+ #topper-article-title{
444
+ padding: 0 20px 50px 20px;
445
+ }
446
+ }
447
+ `
448
+ }
449
+ }
450
+ else if(setting == "opaque" || setting =="opaque-white"){
451
+ topperCSS += `
452
+ #topper-intro-container.full.opaque #topper-article-title, #topper-intro-container.full.opaque-white #topper-article-title {
453
+ background: #ffffff;
454
+ }
455
+
456
+ `
457
+ }
458
+ else if(setting == "transparent"){
459
+ topperCSS += `
460
+ #topper-intro-container.full.transparent #topper-article-title {
461
+ background: rgba(255,255,255,0.8);
462
+ }
463
+ `
464
+ }
465
+ else if(setting == "opaque-black"){
466
+ topperCSS += `
467
+ #topper-intro-container.full.opaque-black #topper-article-title {
468
+ background: #000000;
469
+ color: white;
470
+ }
471
+ #topper-intro-container.full.opaque-black #topper-article-title time.dateline, #topper-intro-container.full.opaque-black #topper-article-title .topper-article-byline {
472
+ color: lightgray;
473
+ }
474
+
475
+
476
+ `
477
+ }
478
+ else if(setting =="transparent-black"){
479
+ topperCSS += `
480
+ #topper-intro-container.transparent-black #topper-article-title {
481
+ background: rgba(0,0,0,0.8);
482
+ color: white;
483
+ }
484
+ #topper-intro-container.transparent-black #topper-article-title time.dateline, #topper-intro-container.transparent-black #topper-article-title .topper-article-byline {
485
+ color: lightgray;
486
+ }
487
+
488
+ `
489
+ }
490
+ else if (setting == "gradient"){
491
+ topperCSS += `
492
+ #topper-intro-container.full.gradient #topper-article-title {
493
+ max-width: unset !important;
494
+ width: 100%;
495
+ bottom: 0px;
496
+ color: white;
497
+ background: rgb(0,0,0);
498
+ background: linear-gradient(0deg, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 20%, rgba(255,255,255,0) 100%);
499
+ padding-top: 50px;
500
+ }
501
+ #topper-intro-container.full.gradient #topper-article-title time.dateline, #topper-intro-container.full.gradient #topper-article-title .topper-article-byline {
502
+ color: lightgray;
503
+ }
504
+
505
+ `
506
+ }
507
+ else if(setting == "downright"){
508
+ topperCSS += `
509
+ #topper-intro-container.full.downright #topper-article-title {
510
+ bottom: 40px;
511
+ right: 40px;
512
+ }
513
+ @media screen and (max-width: 700px){
514
+ #topper-intro-container.full.downright #topper-article-title {
515
+ right: 0px;
516
+ }
517
+ }
518
+ `
519
+ }
520
+ else if (setting == "upleft"){
521
+ topperCSS += `
522
+ #topper-intro-container.full.upleft #topper-article-title {
523
+ top: 50px;
524
+ left: 40px;
525
+ }
526
+ @media screen and (max-width: 700px){
527
+ #topper-intro-container.full.upleft #topper-article-title {
528
+ left: 0px;
529
+ }
530
+ }
531
+ `
532
+ }
533
+
534
+ else if (setting == "upright"){
535
+ topperCSS += `
536
+ #topper-intro-container.full.upright #topper-article-title {
537
+ top: 50px;
538
+ right: 40px;
539
+ }
540
+ @media screen and (max-width: 700px){
541
+ #topper-intro-container.full.upright #topper-article-title {
542
+ right: 0px;
543
+ }
544
+ }
545
+ `
546
+ }
547
+ else if (setting == "downleft"){
548
+ topperCSS += `
549
+ #topper-intro-container.full.downleft #topper-article-title {
550
+ bottom: 40px;
551
+ left: 40px;
552
+ }
553
+ @media screen and (max-width: 700px){
554
+ #topper-intro-container.full.downleft #topper-article-title {
555
+ left: 0px;
556
+ }
557
+ }
558
+ `
559
+ }
560
+ else if (setting == "center-top"){
561
+ topperCSS += `
562
+
563
+ #topper-intro-container.full.center-top #topper-article-title {
564
+ top: 50px;
565
+ }
566
+
567
+ `
568
+ }
569
+ else if(setting =="center-bottom"){
570
+ topperCSS += `
571
+ #topper-intro-container.full.center-bottom #topper-article-title{
572
+ text-align: center;
573
+ justify-content: center;
574
+ bottom: 0px;
575
+ }
576
+ #topper-intro-container.transparent #topper-arrow, #topper-intro-container.opaque #topper-arrow{
577
+ fill: black;
578
+ }
579
+ `
580
+ }
581
+ else if(setting=="center"){
582
+ topperCSS += `
583
+ #topper-intro-container.full.center{
584
+ align-items: center;
585
+ }
586
+ `
587
+ }
588
+ else if(setting == "bottom-right"){
589
+ topperCSS += `
590
+ #topper-intro-container.full.gradient.bottom-right #topper-article-title {
591
+ text-align: right;
592
+ bottom: 0px !important;
593
+ padding-bottom: 20px !important;
594
+ right: 0 !important;
595
+ }
596
+ #topper-intro-container.full.gradient.bottom-right #topper-article-title > *{
597
+ margin-right: 20px !important;
598
+ }
599
+ #topper-intro-container.full.bottom-right #topper-article-title {
600
+ bottom: 40px;
601
+ right: 40px;
602
+ }
603
+ @media screen and (max-width: 700px){
604
+ #topper-intro-container.full.bottom-right #topper-article-title {
605
+ right: 0px;
606
+ }
607
+ }
608
+ `
609
+ }
610
+ else if(setting == "bottom-left"){
611
+ topperCSS += `
612
+ #topper-intro-container.full.gradient.bottom-left #topper-article-title {
613
+ text-align: left;
614
+ bottom: 0px !important;
615
+ padding-bottom: 20px !important;
616
+ left: 0 !important;
617
+ }
618
+ #topper-intro-container.full.gradient.bottom-left #topper-article-title > *{
619
+ margin-left: 20px !important;
620
+ }
621
+ #topper-intro-container.full.bottom-left #topper-article-title {
622
+ bottom: 40px;
623
+ left: 40px;
624
+ }
625
+ @media screen and (max-width: 700px){
626
+ #topper-intro-container.full.bottom-left #topper-article-title {
627
+ left: 0px;
628
+ }
629
+ #topper-intro-container.full.gradient.bottom-left #topper-article-title {
630
+ padding-bottom: 50px;
631
+ }
632
+ }
633
+ `
634
+ }
635
+ else if(setting == "half-stacked" || setting == "half-stacked-reverse"){
636
+ topperCSS += `#topper-intro-container.half-stacked {
637
+ flex-direction: column-reverse;
638
+ margin-bottom: 30px;
639
+ }
640
+ #topper-intro-container.half-stacked-reverse{
641
+ flex-direction: column;
642
+ margin-bottom: 30px;
643
+ }
644
+ #topper-intro-container.half-stacked > *, #topper-intro-container.half-stacked-reverse > * {
645
+ max-width: 55%;
646
+ margin: 1em auto .5em auto;
647
+ }
648
+ #topper-intro-container.half-stacked .topper-intro-img-sfc-utils, #topper-intro-container.half-stacked-reverse .topper-intro-img-sfc-utils {
649
+ object-fit: ${disableCover};
650
+ height: 100% !important;
651
+ width: 100%;
652
+ margin: auto;
653
+ }
654
+ #topper-mediacontainer{
655
+ position: relative;
656
+ width: 55%;
657
+ height: 60vh;
658
+ }
659
+ @media screen and (max-width: 700px){
660
+ #topper-intro-container.half-stacked > *, #topper-intro-container.half-stacked-reverse > * {
661
+ max-width: unset;
662
+ margin: 1em auto .5em auto;
663
+ }
664
+ #topper-mediacontainer{
665
+ flex: unset !important;
666
+ width: 100%;
667
+ height: 40vh;
668
+ position: relative;
669
+ }
670
+ #topper-article-title{
671
+ width: 90%;
672
+ }
673
+ `
674
+ }
675
+ else if(setting == "wide-stacked" || setting =="wide-stacked-reverse"){
676
+ topperCSS += `#topper-intro-container.wide-stacked, #topper-intro-container.half-stacked {
677
+ flex-direction: column-reverse;
678
+ margin-bottom: 30px;
679
+ }
680
+
681
+ #topper-intro-container.wide-stacked .topper-intro-img-sfc-utils, #topper-intro-container.wide-stacked-reverse .topper-intro-img-sfc-utils {
682
+ object-fit: ${disableCover};
683
+ height: 100% !important;
684
+ width: 100%;
685
+ margin: auto;
686
+ }
687
+ #topper-mediacontainer{
688
+ width: 100%;
689
+ height: 90vh;
690
+ pointer-events: none;
691
+ }
692
+ #topper-intro-container.wide-stacked > *, #topper-intro-container.wide-stacked-reverse > * {
693
+ margin: 1em auto .5em auto;
694
+ }
695
+ #topper-intro-container.wide-stacked-reverse{
696
+ flex-direction: column;
697
+ margin-bottom: 30px;
698
+ }
699
+ @media screen and (max-width: 700px){
700
+ #topper-mediacontainer{
701
+ flex: unset !important;
702
+ width: 100%;
703
+ height: 40vh;
704
+ position: relative;
705
+ }
706
+ #topper-intro-container.wide-stacked .topper-intro-img-sfc-utils, #topper-intro-container.wide-stacked-reverse .topper-intro-img-sfc-utils {
707
+ object-fit: ${disableCover};
708
+ }
709
+ #topper-article-title{
710
+ width: 90%;
711
+ }
712
+ }
713
+ `
714
+ }
715
+
716
+ else if(setting == "sidebyside" || setting == "sidebyside-reverse"){
717
+ topperCSS += `
718
+ #topper-intro-container > * {
719
+ flex: 0 0 50%;
720
+ }
721
+ #topper-intro-container.sidebyside, #topper-intro-container.sidebyside-reverse{
722
+ align-items: center;
723
+ max-width: unset !important;
724
+ margin: 0;
725
+ height: 60vh;
726
+ }
727
+ #topper-mediacontainer{
728
+ flex: 0 0 50%;
729
+ max-width: 50%;
730
+ margin: 1em 0;
731
+ height: 60vh;
732
+ position: relative;
733
+ display: flex;
734
+ align-items: center;
735
+ }
736
+ .topper-intro-img-sfc-utils {
737
+ width: 100%;
738
+ height: 100%;
739
+ left: 0;
740
+ object-fit: ${disableCover};
741
+ }
742
+ #topper-intro-container.sidebyside > #topper-article-title, #topper-intro-container.sidebyside-reverse > #topper-article-title {
743
+ flex: 0 0 50%;
744
+ max-width: 40%;
745
+ margin: 1em 5%;
746
+ text-align: center;
747
+ }
748
+ #topper-intro-container.sidebyside-reverse{
749
+ flex-direction: row-reverse;
750
+ }
751
+ #topper-intro-container.opaque-black{
752
+ background-color: black;
753
+
754
+ color: white
755
+ }
756
+ #topper-intro-container.opaque-black .topper-article-byline{
757
+ color: lightgray;
758
+ }
759
+ @media screen and (max-width: 700px){
760
+ #topper-intro-container.sidebyside, #topper-intro-container.sidebyside-reverse{
761
+ height: unset !important;
762
+ }
763
+ #topper-intro-container.sidebyside {
764
+ flex-direction: column-reverse;
765
+ margin-bottom: 30px;
766
+ }
767
+ #topper-intro-container.sidebyside-reverse{
768
+ flex-direction: column !important;
769
+ margin-bottom: 30px;
770
+ }
771
+ #topper-intro-container.sidebyside > *, #topper-intro-container.sidebyside-reverse > * {
772
+ flex: 0 0 100%;
773
+ max-width: unset;
774
+ margin: 1em auto .5em auto;
775
+ }
776
+ #topper-intro-container.sidebyside .topper-intro-img-sfc-utils, #topper-intro-container.sidebyside-reverse .topper-intro-img-sfc-utils {
777
+ object-fit: ${disableCover};
778
+ height: 100% !important;
779
+ width: 100%;
780
+ margin: auto;
781
+ }
782
+ #topper-intro-container > * {
783
+ flex: unset !important;
784
+ }
785
+ #topper-mediacontainer{
786
+ flex: unset !important;
787
+ width: 100%;
788
+ position: relative
789
+ height: 40vh;
790
+ }
791
+ #topper-intro-container.sidebyside > #topper-article-title, #topper-intro-container.sidebyside-reverse > #topper-article-title{
792
+ max-width: unset;
793
+ width: 90%;
794
+ }
795
+ #topper-article-title{
796
+ max-width: unset;
797
+ width: 90%;
798
+ }
799
+ }
800
+ `
801
+ }
802
+ }
803
+ }
804
+ let topperHTML = `
805
+ <style>
806
+ ${topperCSS}
807
+
808
+
809
+ </style>
810
+ <div id="topper-intro-container" class="${topperClass}" style="">
811
+ <div id="topper-mediacontainer">
812
+ ${mediaChoice}
813
+ </div>
814
+ <div id="topper-article-title">
815
+ <h1 class="topper-article-hed">${storySettings.Title}</h1>
816
+ <h2 class="topper-article-dek">${storySettings.Deck}</h2>
817
+ <h3 class ="topper-article-byline">${getBylineText(articleAuthorName, articleAuthorLink, readablePubDate, readableModDate)}</h3>
818
+ </div>
819
+ </div>
820
+ `
821
+
822
+ return topperHTML
823
+ }
824
+
825
+ module.exports = { getTopper }