Skip to content

Commit

Permalink
v1.8 reverts to an earlier version of Draftkings bet slip
Browse files Browse the repository at this point in the history
It's possible this is only in use for certain accounts?
  • Loading branch information
illgitthat committed Feb 25, 2024
1 parent 20c3f35 commit 963120d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 27 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

This private extension makes a few tweaks to betting websites. Currently

- Adjusts stake on Draftkings and Caesars for limited accounts
- Notifies of max stake on Betway for limited bets (such as boosts)
- Adjusts stake on Caesars for limited accounts
- Notifies of max stake on Draftkings and Betway for limited bets

## Installation

Expand Down
28 changes: 4 additions & 24 deletions inject_fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ function DKdisplayLimit(body) {
style: 'currency',
currency: 'USD',
});

if (body.response && body.response.bets && body.response.bets[0].maxStake) {
const numericMaxStake = body.response.bets[0].maxStake;
const maxStake = formatter.format(numericMaxStake);
const maxStake = formatter.format(body.response.bets[0].maxStake);

const betslipElement = document.querySelector('.sportsbook__betslip');

// Only proceed if sportsbook__betslip already exists in the DOM
if (betslipElement) {
const observer = new MutationObserver(() => {
Expand All @@ -50,28 +52,6 @@ function DKdisplayLimit(body) {
maxStakeWarning.innerText = 'The maximum stake is ' + maxStake;
// Stop observing once the element is found
observer.disconnect();

const actionRequiredButton = document.querySelector('.dk-action-required__button button');
const betSelectionElements = document.querySelectorAll('.sportsbook-outcome-cell__body.selected');
actionRequiredButton.click();
betSelectionElements.forEach(betSelectionElement => betSelectionElement.click());

const betslipStakeField = document.querySelector('.betslip-wager-box__input');
const placeBetButton = document.querySelector('.dk-place-bet-button__container');
if (betslipStakeField) {
setTimeout(() => { // timeout needed otherwise the betslip isn't fully rendered yet
betslipStakeField.focus();
document.execCommand('insertText', false, numericMaxStake);
// add a footer of <div class="dk-action-required__title" style="margin-top:10px">Max Stake Adjusted to $25.69</div> to the end of the dk-place-bet-button__container div
const footerContents = document.createElement('div');
footerContents.className = "dk-action-required__title";
footerContents.style.marginTop = "10px";
footerContents.innerHTML = "Max Stake Adjusted to " + maxStake;
footerContents.style.textAlign = "center";
footerContents.style.backgroundColor = "#fbd002";
placeBetButton.appendChild(footerContents);
}, 500);
}
}
});
// Start observing betslipElement and its descendants
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Oddsboom - Sportsbooks Tweaks",
"version": "1.7",
"version": "1.8",
"manifest_version": 3,
"description": "Automatically displays max bet on Draftkings, Caesars, and Betway for limited accounts. Bet is auto adjusted in betslip (not submitted) if bet exceeds limit.",
"web_accessible_resources": [
Expand Down

0 comments on commit 963120d

Please sign in to comment.