-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.js
29 lines (27 loc) · 1.06 KB
/
content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Convert odds to percentage
function oddsToPercentage(odds) {
const parts = odds.split('/');
if (parts.length === 2) {
const numerator = parseInt(parts[0]);
const denominator = parseInt(parts[1]);
if (!isNaN(numerator) && !isNaN(denominator)) {
const percentage = (denominator / (numerator + denominator)) * 100;
return percentage.toFixed(1) + '%';
}
}
return null;
}
// Update odds display
function updateOddsDisplay() {
const oddsElements = document.querySelectorAll('span.odds.basket-add.beta-footnote.bold.participant-info.ng-isolate-scope');
oddsElements.forEach(element => {
const oddsText = element.textContent;
const percentage = oddsToPercentage(oddsText);
if (percentage && !element.dataset.updated) {
element.textContent = percentage;
element.dataset.updated = 'true'; // mark as updated to avoid reprocessing
}
});
}
// Run update function every second to capture dynamic content updates
setInterval(updateOddsDisplay, 1000);