Spaces:
Running
Running
Commit
·
db2eccf
1
Parent(s):
bae9d53
Fix git bug
Browse files- Templates/index.html +45 -188
Templates/index.html
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
4 |
<head>
|
5 |
<link rel="shortcut icon" type="image/x-icon" href="https://images.squarespace-cdn.com/content/v1/64790f5777b5d772678cce83/6d71eaee-f825-4324-be9b-2def32469eac/favicon.ico?format=100w">
|
6 |
-
<title>MARCI
|
7 |
</head>
|
8 |
<style>
|
9 |
body {
|
@@ -33,6 +33,7 @@
|
|
33 |
color: #f2f2f2;
|
34 |
margin: 0px;
|
35 |
}
|
|
|
36 |
table {
|
37 |
transition: 0.3s ease;
|
38 |
margin-top: 20px;
|
@@ -109,13 +110,7 @@
|
|
109 |
margin: 0;
|
110 |
transition: 0.3s ease;
|
111 |
}
|
112 |
-
<<<<<<< HEAD
|
113 |
-
=======
|
114 |
|
115 |
-
<<<<<<< HEAD
|
116 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
117 |
-
=======
|
118 |
-
>>>>>>> origin/main
|
119 |
.over-under-wrapper {
|
120 |
cursor: default;
|
121 |
position: relative;
|
@@ -141,19 +136,24 @@
|
|
141 |
.na {
|
142 |
color: white;
|
143 |
}
|
|
|
144 |
.highlight {
|
145 |
background: rgb(30, 30, 30) !important;
|
146 |
border: 2px solid rgb(30, 30, 30) !important;
|
147 |
border-radius: 10px !important;
|
148 |
}
|
|
|
149 |
.force-repaint { transform: translateZ(0); }
|
|
|
150 |
.hidden {
|
151 |
opacity: 0;
|
152 |
}
|
|
|
153 |
.section-container {
|
154 |
display: flex;
|
155 |
justify-content: space-between;
|
156 |
}
|
|
|
157 |
.section {
|
158 |
padding: 30px;
|
159 |
text-align: left;
|
@@ -162,15 +162,18 @@
|
|
162 |
border-color: rgb(61, 61, 61);
|
163 |
width: 48%;
|
164 |
}
|
|
|
165 |
.content {
|
166 |
width: 100%;
|
167 |
}
|
|
|
168 |
.content img {
|
169 |
width: 100%;
|
170 |
height: auto;
|
171 |
margin-top: 20px;
|
172 |
margin-bottom: 20px;
|
173 |
}
|
|
|
174 |
.divider {
|
175 |
border: 0;
|
176 |
height: 1px;
|
@@ -179,15 +182,19 @@
|
|
179 |
margin-bottom: 50px;
|
180 |
width: 80%;
|
181 |
}
|
|
|
182 |
.label {
|
183 |
color: rgb(114, 114, 114);
|
184 |
}
|
|
|
185 |
.info {
|
186 |
color: white;
|
187 |
}
|
|
|
188 |
a {
|
189 |
color: white;
|
190 |
}
|
|
|
191 |
.scroll-banner {
|
192 |
position: fixed;
|
193 |
top: 0;
|
@@ -202,6 +209,7 @@
|
|
202 |
overflow: hidden;
|
203 |
visibility: hidden;
|
204 |
}
|
|
|
205 |
.scroll-text {
|
206 |
font-family: 'Helvetica';
|
207 |
color: white;
|
@@ -209,15 +217,18 @@
|
|
209 |
animation: scrolling 10s linear infinite;
|
210 |
white-space: nowrap;
|
211 |
}
|
|
|
212 |
@keyframes scrolling {
|
213 |
0% { transform: translateX(100vw); }
|
214 |
100% { transform: translateX(-100%); }
|
215 |
}
|
|
|
216 |
.emoji {
|
217 |
margin-left: 5px;
|
218 |
color: rgb(255, 255, 255);
|
219 |
transition: 0.3s ease;
|
220 |
}
|
|
|
221 |
.spinner {
|
222 |
margin: auto;
|
223 |
display: block;
|
@@ -240,17 +251,12 @@
|
|
240 |
-webkit-text-fill-color: transparent;
|
241 |
font-weight: bold;
|
242 |
}
|
|
|
243 |
#modelDetails {
|
244 |
width: 80%;
|
245 |
display: inline-block;
|
246 |
}
|
247 |
-
<<<<<<< HEAD
|
248 |
-
=======
|
249 |
|
250 |
-
<<<<<<< HEAD
|
251 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
252 |
-
=======
|
253 |
-
>>>>>>> origin/main
|
254 |
#weekSelector {
|
255 |
transition: 0.3s ease;
|
256 |
border-radius: 10px;
|
@@ -262,14 +268,7 @@
|
|
262 |
#weekSelector:hover {
|
263 |
opacity: 0.5;
|
264 |
}
|
265 |
-
<<<<<<< HEAD
|
266 |
-
<<<<<<< HEAD
|
267 |
-
=======
|
268 |
-
|
269 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
270 |
-
=======
|
271 |
|
272 |
-
>>>>>>> origin/main
|
273 |
@keyframes spin {
|
274 |
0% {
|
275 |
transform: rotate(0deg);
|
@@ -278,6 +277,7 @@
|
|
278 |
transform: rotate(360deg);
|
279 |
}
|
280 |
}
|
|
|
281 |
@media screen and (max-width: 768px) {
|
282 |
.table-div {
|
283 |
display: block;
|
@@ -302,6 +302,7 @@
|
|
302 |
width: 90%;
|
303 |
}
|
304 |
}
|
|
|
305 |
</style>
|
306 |
|
307 |
<div class="scroll-banner">
|
@@ -391,17 +392,11 @@
|
|
391 |
for(let i = table.rows.length - 1; i > 0; i--) {
|
392 |
table.deleteRow(i);
|
393 |
}
|
394 |
-
<<<<<<< HEAD
|
395 |
-
<<<<<<< HEAD
|
396 |
-
=======
|
397 |
-
|
398 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
399 |
-
=======
|
400 |
|
401 |
-
>>>>>>> origin/main
|
402 |
const columns = ['Date','Away Team', 'Home Team'];
|
403 |
const lines_response = await fetch('/get_lines');
|
404 |
const lines = await lines_response.json()
|
|
|
405 |
pulled_games.forEach((game, index) => {
|
406 |
const row = table.insertRow(-1);
|
407 |
|
@@ -430,11 +425,15 @@
|
|
430 |
}
|
431 |
});
|
432 |
}
|
|
|
|
|
433 |
function submitData() {
|
434 |
const predictButton = document.getElementById('submitButton');
|
|
|
435 |
const table = document.getElementById('gameTable');
|
436 |
const rows = table.querySelectorAll('tr');
|
437 |
const games = [];
|
|
|
438 |
rows.forEach((row, index) => {
|
439 |
if (index === 0) return;
|
440 |
|
@@ -446,8 +445,10 @@
|
|
446 |
overUnderCell.innerHTML = '';
|
447 |
winnerCell.appendChild(spinnerDiv);
|
448 |
overUnderCell.appendChild(spinnerDiv.cloneNode(true));
|
|
|
449 |
const cells = row.querySelectorAll('td');
|
450 |
const game = {};
|
|
|
451 |
game.Date = cells[0].textContent;
|
452 |
game.AwayTeam = cells[1].querySelector('img').alt;
|
453 |
game.HomeTeam = cells[2].querySelector('img').alt;
|
@@ -455,6 +456,8 @@
|
|
455 |
game.rowIndex = index - 1;
|
456 |
games.push(game);
|
457 |
});
|
|
|
|
|
458 |
fetch('/submit_games', {
|
459 |
method: 'POST',
|
460 |
headers: {
|
@@ -467,11 +470,14 @@
|
|
467 |
if (data.moneylines && data.over_unders) {
|
468 |
const table = document.getElementById('gameTable');
|
469 |
const rows = table.querySelectorAll('tr');
|
|
|
470 |
data.moneylines.forEach((moneyline, index) => {
|
471 |
const row = rows[parseInt(moneyline.rowIndex) + 1];
|
|
|
472 |
const winnerCell = row.cells[row.cells.length - 2];
|
473 |
winnerCell.removeChild(winnerCell.querySelector('.spinner'));
|
474 |
winnerCell.innerHTML = '';
|
|
|
475 |
const wrapperDiv = document.createElement('div');
|
476 |
wrapperDiv.className = 'winner-wrapper';
|
477 |
if (moneyline.Probabilities[0] > 0.6){
|
@@ -480,21 +486,17 @@
|
|
480 |
else {
|
481 |
wrapperDiv.style.opacity = "0.5";
|
482 |
}
|
|
|
483 |
const winnerImg = document.createElement('img');
|
484 |
winnerImg.src = `/Static/${moneyline.Winner}.webp`;
|
485 |
winnerImg.alt = moneyline.Winner;
|
486 |
winnerImg.width = 50;
|
487 |
winnerImg.className = 'winner-image hidden';
|
488 |
wrapperDiv.appendChild(winnerImg);
|
|
|
489 |
const winnerEmojiDiv = document.createElement('div');
|
490 |
winnerEmojiDiv.className = 'emoji';
|
491 |
-
<<<<<<< HEAD
|
492 |
-
=======
|
493 |
|
494 |
-
<<<<<<< HEAD
|
495 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
496 |
-
=======
|
497 |
-
>>>>>>> origin/main
|
498 |
wrapperDiv.dataset.proba = (moneyline.Probabilities[0] * 100).toFixed(0);
|
499 |
if (moneyline.Winner[0] === moneyline.Result) {
|
500 |
winnerEmojiDiv.textContent = '✅';
|
@@ -505,13 +507,17 @@
|
|
505 |
winnerEmojiDiv.textContent = `(${wrapperDiv.dataset.proba}%)`;
|
506 |
}
|
507 |
wrapperDiv.appendChild(winnerEmojiDiv);
|
|
|
508 |
setTimeout(() => {
|
509 |
winnerImg.classList.remove('hidden');
|
510 |
}, 10);
|
|
|
511 |
winnerCell.appendChild(wrapperDiv);
|
|
|
512 |
const overUnderCell = row.cells[row.cells.length - 1];
|
513 |
overUnderCell.removeChild(overUnderCell.querySelector('.spinner'));
|
514 |
overUnderCell.innerHTML = '';
|
|
|
515 |
const overUnderDiv = document.createElement('div');
|
516 |
overUnderDiv.className = 'over-under-wrapper hidden';
|
517 |
if (data.over_unders[index]['Probability'][0] > 0.6){
|
@@ -520,6 +526,7 @@
|
|
520 |
else {
|
521 |
overUnderDiv.style.opacity = "0.5";
|
522 |
}
|
|
|
523 |
const textDiv = document.createElement('div');
|
524 |
textDiv.className = 'over-under-text';
|
525 |
textDiv.textContent = data.over_unders[index]['Over/Under'];
|
@@ -530,16 +537,12 @@
|
|
530 |
} else {
|
531 |
overUnderDiv.className += ' na';
|
532 |
}
|
|
|
533 |
overUnderDiv.appendChild(textDiv);
|
|
|
534 |
const overEmojiDiv = document.createElement('div');
|
535 |
overEmojiDiv.className = 'emoji';
|
536 |
-
<<<<<<< HEAD
|
537 |
-
=======
|
538 |
|
539 |
-
<<<<<<< HEAD
|
540 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
541 |
-
=======
|
542 |
-
>>>>>>> origin/main
|
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 = '✅';
|
@@ -550,157 +553,21 @@
|
|
550 |
overEmojiDiv.textContent = `(${overUnderDiv.dataset.proba}%)`;
|
551 |
}
|
552 |
overUnderDiv.appendChild(overEmojiDiv);
|
|
|
553 |
setTimeout(() => {
|
554 |
overUnderDiv.classList.remove('hidden');
|
555 |
}, 10);
|
556 |
-
overUnderCell.appendChild(overUnderDiv);
|
557 |
-
<<<<<<< HEAD
|
558 |
-
<<<<<<< HEAD
|
559 |
-
=======
|
560 |
|
561 |
-
|
562 |
-
=======
|
563 |
|
564 |
-
>>>>>>> origin/main
|
565 |
showProbabilityOnHover(wrapperDiv);
|
566 |
showProbabilityOnHover(overUnderDiv);
|
567 |
|
568 |
});
|
569 |
}
|
570 |
});
|
571 |
-
}
|
572 |
-
<<<<<<< HEAD
|
573 |
-
=======
|
574 |
-
|
575 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
576 |
-
//Hover listener
|
577 |
-
function showProbabilityOnHover(div) {
|
578 |
-
let previousValue;
|
579 |
-
let divText = div.children[1];
|
580 |
-
let eventProcessed = false;
|
581 |
-
<<<<<<< HEAD
|
582 |
-
function handleEnter() {
|
583 |
-
if (eventProcessed) return; // Skip if an event has already been processed
|
584 |
-
eventProcessed = true;
|
585 |
-
if (divText.textContent !== `(${div.dataset.proba}%)`) {
|
586 |
-
divText.style.opacity = 0;
|
587 |
-
=======
|
588 |
-
|
589 |
-
function handleEnter() {
|
590 |
-
if (eventProcessed) return; // Skip if an event has already been processed
|
591 |
-
|
592 |
-
eventProcessed = true;
|
593 |
-
|
594 |
-
if (divText.textContent !== `(${div.dataset.proba}%)`) {
|
595 |
-
divText.style.opacity = 0;
|
596 |
|
597 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
598 |
-
setTimeout(() => {
|
599 |
-
previousValue = divText.textContent;
|
600 |
-
divText.textContent = `(${div.dataset.proba}%)`;
|
601 |
-
divText.style.opacity = 1;
|
602 |
-
}, 300);
|
603 |
-
<<<<<<< HEAD
|
604 |
-
=======
|
605 |
-
|
606 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
607 |
-
setTimeout(() => {
|
608 |
-
divText.style.opacity = 0;
|
609 |
-
setTimeout(() => {
|
610 |
-
divText.textContent = previousValue;
|
611 |
-
divText.style.opacity = 1;
|
612 |
-
eventProcessed = false; // Reset the flag
|
613 |
-
}, 300);
|
614 |
-
}, 1000);
|
615 |
-
}
|
616 |
-
}
|
617 |
-
<<<<<<< HEAD
|
618 |
-
=======
|
619 |
-
|
620 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
621 |
-
// For desktop
|
622 |
-
div.addEventListener('mouseenter', handleEnter);
|
623 |
-
// For mobile
|
624 |
-
div.addEventListener('touchstart', handleEnter);
|
625 |
-
}
|
626 |
-
<<<<<<< HEAD
|
627 |
-
=======
|
628 |
-
|
629 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
630 |
-
// Populate dropdown
|
631 |
-
let selectedWeek;
|
632 |
-
async function populateDropdown() {
|
633 |
-
const weekSelector = document.getElementById('weekSelector');
|
634 |
-
weekSelector.innerHTML = "";
|
635 |
-
<<<<<<< HEAD
|
636 |
-
=======
|
637 |
-
|
638 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
639 |
-
const response = await fetch('/get_weeks');
|
640 |
-
const data = await response.json();
|
641 |
-
|
642 |
-
data.forEach((week, index) => {
|
643 |
-
const option = document.createElement('option');
|
644 |
-
option.value = week;
|
645 |
-
option.text = `Week ${week}`;
|
646 |
-
weekSelector.appendChild(option);
|
647 |
-
<<<<<<< HEAD
|
648 |
-
=======
|
649 |
-
|
650 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
651 |
-
if (index === 0) {
|
652 |
-
selectedWeek = week;
|
653 |
-
}
|
654 |
-
});
|
655 |
-
}
|
656 |
-
|
657 |
-
|
658 |
-
// Get new games when new week selected
|
659 |
-
document.getElementById('weekSelector').addEventListener('change', function(event) {
|
660 |
-
selectedWeek = event.target.value;
|
661 |
-
getNew();
|
662 |
-
});
|
663 |
-
<<<<<<< HEAD
|
664 |
-
=======
|
665 |
-
|
666 |
-
|
667 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
668 |
-
// Initial load
|
669 |
-
function loadThings() {
|
670 |
-
populateDropdown()
|
671 |
-
.then(() => fetchGames(selectedWeek))
|
672 |
-
.then(() => submitData())
|
673 |
-
.catch(error => console.error(error));
|
674 |
-
}
|
675 |
-
<<<<<<< HEAD
|
676 |
-
=======
|
677 |
-
|
678 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
679 |
-
// Get new
|
680 |
-
async function getNew() {
|
681 |
-
const table = document.getElementById('gameTable');
|
682 |
-
table.style.opacity = "0.5";
|
683 |
-
<<<<<<< HEAD
|
684 |
-
=======
|
685 |
-
|
686 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
687 |
-
try {
|
688 |
-
await fetchGames(selectedWeek);
|
689 |
-
await submitData();
|
690 |
-
table.style.opacity = "1";
|
691 |
-
} catch (error) {
|
692 |
-
console.error(error);
|
693 |
-
}
|
694 |
}
|
695 |
-
<<<<<<< HEAD
|
696 |
-
// Submit on click, enter, and pageload
|
697 |
-
loadThings();
|
698 |
-
document.getElementById('submitButton').addEventListener('click', submitData);
|
699 |
-
=======
|
700 |
-
|
701 |
-
|
702 |
-
// Submit on click, enter, and pageload
|
703 |
-
loadThings();
|
704 |
|
705 |
//Hover listener
|
706 |
function showProbabilityOnHover(div) {
|
@@ -708,9 +575,6 @@
|
|
708 |
let divText = div.children[1];
|
709 |
let eventProcessed = false;
|
710 |
|
711 |
-
<<<<<<< HEAD
|
712 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
713 |
-
=======
|
714 |
function handleEnter() {
|
715 |
if (eventProcessed) return; // Skip if an event has already been processed
|
716 |
|
@@ -799,21 +663,14 @@
|
|
799 |
|
800 |
document.getElementById('submitButton').addEventListener('click', submitData);
|
801 |
|
802 |
-
>>>>>>> origin/main
|
803 |
document.addEventListener('keydown', function(event) {
|
804 |
if (event.keyCode === 13) {
|
805 |
submitData();
|
806 |
}
|
807 |
});
|
808 |
-
<<<<<<< HEAD
|
809 |
-
<<<<<<< HEAD
|
810 |
-
=======
|
811 |
-
=======
|
812 |
-
>>>>>>> origin/main
|
813 |
|
814 |
|
815 |
-
>>>>>>> a1fa974af6e4e1de31cb2ee976c254c2cc5b3c64
|
816 |
</script>
|
817 |
|
818 |
</body>
|
819 |
-
</html>
|
|
|
3 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
4 |
<head>
|
5 |
<link rel="shortcut icon" type="image/x-icon" href="https://images.squarespace-cdn.com/content/v1/64790f5777b5d772678cce83/6d71eaee-f825-4324-be9b-2def32469eac/favicon.ico?format=100w">
|
6 |
+
<title>MARCI</title>
|
7 |
</head>
|
8 |
<style>
|
9 |
body {
|
|
|
33 |
color: #f2f2f2;
|
34 |
margin: 0px;
|
35 |
}
|
36 |
+
|
37 |
table {
|
38 |
transition: 0.3s ease;
|
39 |
margin-top: 20px;
|
|
|
110 |
margin: 0;
|
111 |
transition: 0.3s ease;
|
112 |
}
|
|
|
|
|
113 |
|
|
|
|
|
|
|
|
|
114 |
.over-under-wrapper {
|
115 |
cursor: default;
|
116 |
position: relative;
|
|
|
136 |
.na {
|
137 |
color: white;
|
138 |
}
|
139 |
+
|
140 |
.highlight {
|
141 |
background: rgb(30, 30, 30) !important;
|
142 |
border: 2px solid rgb(30, 30, 30) !important;
|
143 |
border-radius: 10px !important;
|
144 |
}
|
145 |
+
|
146 |
.force-repaint { transform: translateZ(0); }
|
147 |
+
|
148 |
.hidden {
|
149 |
opacity: 0;
|
150 |
}
|
151 |
+
|
152 |
.section-container {
|
153 |
display: flex;
|
154 |
justify-content: space-between;
|
155 |
}
|
156 |
+
|
157 |
.section {
|
158 |
padding: 30px;
|
159 |
text-align: left;
|
|
|
162 |
border-color: rgb(61, 61, 61);
|
163 |
width: 48%;
|
164 |
}
|
165 |
+
|
166 |
.content {
|
167 |
width: 100%;
|
168 |
}
|
169 |
+
|
170 |
.content img {
|
171 |
width: 100%;
|
172 |
height: auto;
|
173 |
margin-top: 20px;
|
174 |
margin-bottom: 20px;
|
175 |
}
|
176 |
+
|
177 |
.divider {
|
178 |
border: 0;
|
179 |
height: 1px;
|
|
|
182 |
margin-bottom: 50px;
|
183 |
width: 80%;
|
184 |
}
|
185 |
+
|
186 |
.label {
|
187 |
color: rgb(114, 114, 114);
|
188 |
}
|
189 |
+
|
190 |
.info {
|
191 |
color: white;
|
192 |
}
|
193 |
+
|
194 |
a {
|
195 |
color: white;
|
196 |
}
|
197 |
+
|
198 |
.scroll-banner {
|
199 |
position: fixed;
|
200 |
top: 0;
|
|
|
209 |
overflow: hidden;
|
210 |
visibility: hidden;
|
211 |
}
|
212 |
+
|
213 |
.scroll-text {
|
214 |
font-family: 'Helvetica';
|
215 |
color: white;
|
|
|
217 |
animation: scrolling 10s linear infinite;
|
218 |
white-space: nowrap;
|
219 |
}
|
220 |
+
|
221 |
@keyframes scrolling {
|
222 |
0% { transform: translateX(100vw); }
|
223 |
100% { transform: translateX(-100%); }
|
224 |
}
|
225 |
+
|
226 |
.emoji {
|
227 |
margin-left: 5px;
|
228 |
color: rgb(255, 255, 255);
|
229 |
transition: 0.3s ease;
|
230 |
}
|
231 |
+
|
232 |
.spinner {
|
233 |
margin: auto;
|
234 |
display: block;
|
|
|
251 |
-webkit-text-fill-color: transparent;
|
252 |
font-weight: bold;
|
253 |
}
|
254 |
+
|
255 |
#modelDetails {
|
256 |
width: 80%;
|
257 |
display: inline-block;
|
258 |
}
|
|
|
|
|
259 |
|
|
|
|
|
|
|
|
|
260 |
#weekSelector {
|
261 |
transition: 0.3s ease;
|
262 |
border-radius: 10px;
|
|
|
268 |
#weekSelector:hover {
|
269 |
opacity: 0.5;
|
270 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
|
|
|
272 |
@keyframes spin {
|
273 |
0% {
|
274 |
transform: rotate(0deg);
|
|
|
277 |
transform: rotate(360deg);
|
278 |
}
|
279 |
}
|
280 |
+
|
281 |
@media screen and (max-width: 768px) {
|
282 |
.table-div {
|
283 |
display: block;
|
|
|
302 |
width: 90%;
|
303 |
}
|
304 |
}
|
305 |
+
|
306 |
</style>
|
307 |
|
308 |
<div class="scroll-banner">
|
|
|
392 |
for(let i = table.rows.length - 1; i > 0; i--) {
|
393 |
table.deleteRow(i);
|
394 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
|
|
|
396 |
const columns = ['Date','Away Team', 'Home Team'];
|
397 |
const lines_response = await fetch('/get_lines');
|
398 |
const lines = await lines_response.json()
|
399 |
+
|
400 |
pulled_games.forEach((game, index) => {
|
401 |
const row = table.insertRow(-1);
|
402 |
|
|
|
425 |
}
|
426 |
});
|
427 |
}
|
428 |
+
|
429 |
+
|
430 |
function submitData() {
|
431 |
const predictButton = document.getElementById('submitButton');
|
432 |
+
|
433 |
const table = document.getElementById('gameTable');
|
434 |
const rows = table.querySelectorAll('tr');
|
435 |
const games = [];
|
436 |
+
|
437 |
rows.forEach((row, index) => {
|
438 |
if (index === 0) return;
|
439 |
|
|
|
445 |
overUnderCell.innerHTML = '';
|
446 |
winnerCell.appendChild(spinnerDiv);
|
447 |
overUnderCell.appendChild(spinnerDiv.cloneNode(true));
|
448 |
+
|
449 |
const cells = row.querySelectorAll('td');
|
450 |
const game = {};
|
451 |
+
|
452 |
game.Date = cells[0].textContent;
|
453 |
game.AwayTeam = cells[1].querySelector('img').alt;
|
454 |
game.HomeTeam = cells[2].querySelector('img').alt;
|
|
|
456 |
game.rowIndex = index - 1;
|
457 |
games.push(game);
|
458 |
});
|
459 |
+
|
460 |
+
|
461 |
fetch('/submit_games', {
|
462 |
method: 'POST',
|
463 |
headers: {
|
|
|
470 |
if (data.moneylines && data.over_unders) {
|
471 |
const table = document.getElementById('gameTable');
|
472 |
const rows = table.querySelectorAll('tr');
|
473 |
+
|
474 |
data.moneylines.forEach((moneyline, index) => {
|
475 |
const row = rows[parseInt(moneyline.rowIndex) + 1];
|
476 |
+
|
477 |
const winnerCell = row.cells[row.cells.length - 2];
|
478 |
winnerCell.removeChild(winnerCell.querySelector('.spinner'));
|
479 |
winnerCell.innerHTML = '';
|
480 |
+
|
481 |
const wrapperDiv = document.createElement('div');
|
482 |
wrapperDiv.className = 'winner-wrapper';
|
483 |
if (moneyline.Probabilities[0] > 0.6){
|
|
|
486 |
else {
|
487 |
wrapperDiv.style.opacity = "0.5";
|
488 |
}
|
489 |
+
|
490 |
const winnerImg = document.createElement('img');
|
491 |
winnerImg.src = `/Static/${moneyline.Winner}.webp`;
|
492 |
winnerImg.alt = moneyline.Winner;
|
493 |
winnerImg.width = 50;
|
494 |
winnerImg.className = 'winner-image hidden';
|
495 |
wrapperDiv.appendChild(winnerImg);
|
496 |
+
|
497 |
const winnerEmojiDiv = document.createElement('div');
|
498 |
winnerEmojiDiv.className = 'emoji';
|
|
|
|
|
499 |
|
|
|
|
|
|
|
|
|
500 |
wrapperDiv.dataset.proba = (moneyline.Probabilities[0] * 100).toFixed(0);
|
501 |
if (moneyline.Winner[0] === moneyline.Result) {
|
502 |
winnerEmojiDiv.textContent = '✅';
|
|
|
507 |
winnerEmojiDiv.textContent = `(${wrapperDiv.dataset.proba}%)`;
|
508 |
}
|
509 |
wrapperDiv.appendChild(winnerEmojiDiv);
|
510 |
+
|
511 |
setTimeout(() => {
|
512 |
winnerImg.classList.remove('hidden');
|
513 |
}, 10);
|
514 |
+
|
515 |
winnerCell.appendChild(wrapperDiv);
|
516 |
+
|
517 |
const overUnderCell = row.cells[row.cells.length - 1];
|
518 |
overUnderCell.removeChild(overUnderCell.querySelector('.spinner'));
|
519 |
overUnderCell.innerHTML = '';
|
520 |
+
|
521 |
const overUnderDiv = document.createElement('div');
|
522 |
overUnderDiv.className = 'over-under-wrapper hidden';
|
523 |
if (data.over_unders[index]['Probability'][0] > 0.6){
|
|
|
526 |
else {
|
527 |
overUnderDiv.style.opacity = "0.5";
|
528 |
}
|
529 |
+
|
530 |
const textDiv = document.createElement('div');
|
531 |
textDiv.className = 'over-under-text';
|
532 |
textDiv.textContent = data.over_unders[index]['Over/Under'];
|
|
|
537 |
} else {
|
538 |
overUnderDiv.className += ' na';
|
539 |
}
|
540 |
+
|
541 |
overUnderDiv.appendChild(textDiv);
|
542 |
+
|
543 |
const overEmojiDiv = document.createElement('div');
|
544 |
overEmojiDiv.className = 'emoji';
|
|
|
|
|
545 |
|
|
|
|
|
|
|
|
|
546 |
overUnderDiv.dataset.proba = (data.over_unders[index]['Probability'][0] * 100).toFixed(0);
|
547 |
if (data.over_unders[index]['Over/Under'][0] === data.over_unders[index]['Result']) {
|
548 |
overEmojiDiv.textContent = '✅';
|
|
|
553 |
overEmojiDiv.textContent = `(${overUnderDiv.dataset.proba}%)`;
|
554 |
}
|
555 |
overUnderDiv.appendChild(overEmojiDiv);
|
556 |
+
|
557 |
setTimeout(() => {
|
558 |
overUnderDiv.classList.remove('hidden');
|
559 |
}, 10);
|
|
|
|
|
|
|
|
|
560 |
|
561 |
+
overUnderCell.appendChild(overUnderDiv);
|
|
|
562 |
|
|
|
563 |
showProbabilityOnHover(wrapperDiv);
|
564 |
showProbabilityOnHover(overUnderDiv);
|
565 |
|
566 |
});
|
567 |
}
|
568 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
570 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
|
572 |
//Hover listener
|
573 |
function showProbabilityOnHover(div) {
|
|
|
575 |
let divText = div.children[1];
|
576 |
let eventProcessed = false;
|
577 |
|
|
|
|
|
|
|
578 |
function handleEnter() {
|
579 |
if (eventProcessed) return; // Skip if an event has already been processed
|
580 |
|
|
|
663 |
|
664 |
document.getElementById('submitButton').addEventListener('click', submitData);
|
665 |
|
|
|
666 |
document.addEventListener('keydown', function(event) {
|
667 |
if (event.keyCode === 13) {
|
668 |
submitData();
|
669 |
}
|
670 |
});
|
|
|
|
|
|
|
|
|
|
|
671 |
|
672 |
|
|
|
673 |
</script>
|
674 |
|
675 |
</body>
|
676 |
+
</html>
|