BraydenMoore commited on
Commit
2634ee3
β€’
1 Parent(s): 632a626

Styling updates

Browse files
Files changed (1) hide show
  1. Templates/index.html +47 -26
Templates/index.html CHANGED
@@ -96,12 +96,14 @@
96
  cursor: pointer;
97
  }
98
  .winner-wrapper {
 
99
  position: relative;
100
  width: 100%;
101
  text-align: center;
102
  display: flex;
103
  justify-content: center;
104
  align-items: center;
 
105
  }
106
  .winner-image {
107
  height: auto;
@@ -109,31 +111,15 @@
109
  transition: 0.3s ease;
110
  }
111
 
112
- .overlay {
113
- position: absolute;
114
- top: 0;
115
- left: 0;
116
- width: 100%;
117
- height: 100%;
118
- background-color: rgba(0, 0, 0, 0.8);
119
- color: white;
120
- display: flex;
121
- justify-content: center;
122
- align-items: center;
123
- opacity: 0;
124
- transition: opacity 0.3s ease;
125
- }
126
- .winner-wrapper:hover .overlay {
127
- opacity: 1;
128
- }
129
  .over-under-wrapper {
 
130
  position: relative;
131
  width: 100%;
132
  height: 50px;
133
  display: flex;
134
  align-items: center;
135
  justify-content: center;
136
- transition: opacity 0.3s ease;
137
  }
138
  .over-under-text {
139
  display: inline-block;
@@ -240,11 +226,6 @@
240
  .emoji {
241
  margin-left: 5px;
242
  color: rgb(255, 255, 255);
243
- }
244
-
245
- .emoji:hover{
246
- color:#ffffff;
247
- font-weight: bold;
248
  transition: 0.3s ease;
249
  }
250
 
@@ -513,13 +494,14 @@
513
  const winnerEmojiDiv = document.createElement('div');
514
  winnerEmojiDiv.className = 'emoji';
515
 
 
516
  if (moneyline.Winner[0] === moneyline.Result) {
517
  winnerEmojiDiv.textContent = 'βœ…';
518
  } else {
519
  winnerEmojiDiv.textContent = '❌';
520
  }
521
  if (moneyline.Result === 'N/A') {
522
- winnerEmojiDiv.textContent = `(${(moneyline.Probabilities[0] * 100).toFixed(0)}%)`;
523
  }
524
  wrapperDiv.appendChild(winnerEmojiDiv);
525
 
@@ -558,13 +540,14 @@
558
  const overEmojiDiv = document.createElement('div');
559
  overEmojiDiv.className = 'emoji';
560
 
 
561
  if (data.over_unders[index]['Over/Under'][0] === data.over_unders[index]['Result']) {
562
  overEmojiDiv.textContent = 'βœ…';
563
  } else {
564
  overEmojiDiv.textContent = '❌';
565
  }
566
  if (data.over_unders[index]['Result'] === 'N/A') {
567
- overEmojiDiv.textContent = `(${(data.over_unders[index]['Probability'][0] * 100).toFixed(0)}%)`;
568
  }
569
  overUnderDiv.appendChild(overEmojiDiv);
570
 
@@ -573,13 +556,51 @@
573
  }, 10);
574
 
575
  overUnderCell.appendChild(overUnderDiv);
576
-
 
 
 
577
  });
578
  }
579
  });
580
 
581
  }
582
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
583
 
584
  // Populate dropdown
585
  let selectedWeek;
 
96
  cursor: pointer;
97
  }
98
  .winner-wrapper {
99
+ cursor: default;
100
  position: relative;
101
  width: 100%;
102
  text-align: center;
103
  display: flex;
104
  justify-content: center;
105
  align-items: center;
106
+ transition: 0.3s ease;
107
  }
108
  .winner-image {
109
  height: auto;
 
111
  transition: 0.3s ease;
112
  }
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  .over-under-wrapper {
115
+ cursor: default;
116
  position: relative;
117
  width: 100%;
118
  height: 50px;
119
  display: flex;
120
  align-items: center;
121
  justify-content: center;
122
+ transition: 0.3s ease;
123
  }
124
  .over-under-text {
125
  display: inline-block;
 
226
  .emoji {
227
  margin-left: 5px;
228
  color: rgb(255, 255, 255);
 
 
 
 
 
229
  transition: 0.3s ease;
230
  }
231
 
 
494
  const winnerEmojiDiv = document.createElement('div');
495
  winnerEmojiDiv.className = 'emoji';
496
 
497
+ wrapperDiv.dataset.proba = (moneyline.Probabilities[0] * 100).toFixed(0);
498
  if (moneyline.Winner[0] === moneyline.Result) {
499
  winnerEmojiDiv.textContent = 'βœ…';
500
  } else {
501
  winnerEmojiDiv.textContent = '❌';
502
  }
503
  if (moneyline.Result === 'N/A') {
504
+ winnerEmojiDiv.textContent = `(${wrapperDiv.dataset.proba}%)`;
505
  }
506
  wrapperDiv.appendChild(winnerEmojiDiv);
507
 
 
540
  const overEmojiDiv = document.createElement('div');
541
  overEmojiDiv.className = 'emoji';
542
 
543
+ overUnderDiv.dataset.proba = (data.over_unders[index]['Probability'][0] * 100).toFixed(0);
544
  if (data.over_unders[index]['Over/Under'][0] === data.over_unders[index]['Result']) {
545
  overEmojiDiv.textContent = 'βœ…';
546
  } else {
547
  overEmojiDiv.textContent = '❌';
548
  }
549
  if (data.over_unders[index]['Result'] === 'N/A') {
550
+ overEmojiDiv.textContent = `(${overUnderDiv.dataset.proba}%)`;
551
  }
552
  overUnderDiv.appendChild(overEmojiDiv);
553
 
 
556
  }, 10);
557
 
558
  overUnderCell.appendChild(overUnderDiv);
559
+
560
+ showProbabilityOnHover(wrapperDiv);
561
+ showProbabilityOnHover(overUnderDiv);
562
+
563
  });
564
  }
565
  });
566
 
567
  }
568
 
569
+ //Hover listener
570
+ function showProbabilityOnHover(div) {
571
+ let previousValue;
572
+ let divText = div.children[1];
573
+
574
+ function handleEnter() {
575
+ if (divText.textContent !== `(${div.dataset.proba}%)`){
576
+ divText.style.opacity = 0;
577
+ setTimeout(() => {
578
+ previousValue = divText.textContent;
579
+ divText.textContent = `(${div.dataset.proba}%)`;
580
+ divText.style.opacity = 1;
581
+ }, 300);
582
+ }
583
+
584
+ }
585
+
586
+ function handleLeave() {
587
+ if (previousValue !== undefined) {
588
+ divText.style.opacity = 0;
589
+ setTimeout(() => {
590
+ divText.textContent = previousValue;
591
+ divText.style.opacity = 1;
592
+ }, 300);
593
+ }
594
+ }
595
+
596
+ // For desktop
597
+ div.addEventListener('mouseenter', handleEnter);
598
+ div.addEventListener('mouseleave', handleLeave);
599
+
600
+ // For mobile
601
+ div.addEventListener('touchstart', handleEnter);
602
+ div.addEventListener('touchend', handleLeave);
603
+ }
604
 
605
  // Populate dropdown
606
  let selectedWeek;