// ==UserScript== // @name SaltyBot // @namespace http://sseeley.weebly.com/ // @version 0.3 // @description enter something useful // @match https://www.saltybet.com/ // @match https://www.saltybet.com/index* // @copyright 2019 drohack // ==/UserScript== //adds jquery so this script can use it, then calls the callback with jquery enabled function addJQuery(callback) { var script = document.createElement("script"); script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"); script.addEventListener('load', function () { var script = document.createElement("script"); script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();"; document.body.appendChild(script); }, false); document.body.appendChild(script); } function main() { var bet = 400; //400 is the amount of money you start with (or if you go down to 0 you reset at 400) var oldmoney; var nlosses = 0; var lastBet = ""; //Either "player1" or "player2" depending on the last bet to save for future bets //gets games played from the player's stats (unused) function getGamesPlayed(player) { var children = $("div#bettors" + player + " p").clone(); $(children[0]).find('span').remove(); var gamesPlayed = $(children[0]).html().replace('%', ''); return parseInt(gamesPlayed ? gamesPlayed : 0, 10); } function replaceAll(find, replace, str) { return str.replace(new RegExp(find, 'g'), replace); } function tryToSetWager() { var wager = $("#wager"); var money = parseInt(replaceAll(",", "", $("#balance").text().replace(",", "")), 10); var player1 = $("#player1"); var player2 = $("#player2"); //var betconfirm = $("#betconfirm"); // Check to see if the "wager" text box has popped up and is empty. Then try and set the bet to 400 // And auto bet on the same color/player as last time if (wager.is(":visible") && wager.val() == "" && player1.is(":visible") && player2.is(":visible")) { //console.log(oldmoney + " / " + money); oldmoney = money; if (oldmoney && oldmoney > money) { nlosses++; } else { nlosses = 0; } console.log("money: " + money); if (wager && money < bet) { console.log("wager: " + money); wager.val(money); } else if (wager) { console.log("wager: " + bet); wager.val(bet); } //Since this function should only run once each time a user can bet again, we can setup to auto bet on the same color as last time console.log("lastBet: " + lastBet); if (lastBet === "player1") { player1.click(); } else if (lastBet === "player2") { player2.click(); } } //console.log(money); } function addGlobalStyle(css) { var head, style; head = document.getElementsByTagName('head')[0]; if (!head) { return; } style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = css; head.appendChild(style); } //adds settings gear button and popup to bottomcontent function addSettingsButton() { // Add Google Material Icons font var link = document.createElement('link'); link.rel = 'stylesheet'; link.href = 'https://fonts.googleapis.com/icon?family=Material+Icons'; document.head.appendChild(link); // Create gear icon button using Material Icons var gearButton = document.createElement('i'); gearButton.className = 'material-icons'; gearButton.id = 'settings-gear'; gearButton.textContent = 'settings'; gearButton.style.cssText = 'float: right; cursor: pointer; padding: 5px; margin-right: 10px; color: white; font-size: 28px !important;'; // Create settings popup var settingsPopup = document.createElement('div'); settingsPopup.id = 'settings-popup'; settingsPopup.innerHTML = `
×

Settings

`; // Function to check login status and update button function updateAuthButton() { var authButton = document.getElementById('auth-button'); var logoutLink = document.querySelector('a[href="/logout"]'); if (logoutLink) { // User is logged in authButton.textContent = 'Logout'; authButton.onclick = function() { window.location.href = 'https://www.saltybet.com/logout'; }; } else { // User is logged out authButton.textContent = 'Login to SaltyBet'; authButton.onclick = function() { window.location.href = 'https://www.saltybet.com/authenticate?signin=1'; }; } } // Add CSS for the popup (fixed positioning, won't affect layout) addGlobalStyle(` #settings-popup { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); } #settings-popup-content { background-color: #2b2b2b; margin: 10% auto; padding: 20px; border: 2px solid #888; border-radius: 10px; width: 80%; max-width: 500px; color: white; } #settings-popup-content * { font-size: 16px !important; } #settings-close { color: #aaa; float: right; font-size: 28px !important; font-weight: bold; cursor: pointer; line-height: 20px; } #settings-close:hover { color: white; } .settings-option-btn { width: 100%; padding: 15px; margin: 10px 0; font-size: 16px !important; background-color: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer; } .settings-option-btn:hover { background-color: #45a049; } .settings-toggle-option { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-top: 1px solid #444; margin-top: 10px; } .settings-toggle-option label { font-size: 16px !important; } .switch { position: relative; display: inline-block; width: 50px; height: 24px; } .switch input { opacity: 0; width: 0; height: 0; } .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; } .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; } input:checked + .slider { background-color: #4CAF50; } input:checked + .slider:before { transform: translateX(26px); } `); // Add gear button to bottomcontent (just append, don't change positioning) var bottomContent = document.getElementById('bottomcontent'); if (bottomContent) { bottomContent.insertBefore(gearButton, bottomContent.firstChild); } // Add popup to body document.body.appendChild(settingsPopup); // Event listeners gearButton.onclick = function() { updateAuthButton(); // Update button state when popup opens settingsPopup.style.display = 'block'; }; document.getElementById('settings-close').onclick = function() { settingsPopup.style.display = 'none'; }; // Close popup when clicking outside of it window.onclick = function(event) { if (event.target == settingsPopup) { settingsPopup.style.display = 'none'; } }; // DVD Logo functionality var dvdLogoEnabled = localStorage.getItem('dvdLogoEnabled') === 'true'; var dvdLogoElement = null; var dvdAnimationFrame = null; var dvdPosition = { x: 0, y: 0 }; var dvdAngle = Math.PI / 4; // Direction in radians (45 degrees initially) var cornerHitCooldown = false; var lastCornerHitTime = Date.now(); var seekingCorners = false; var targetCorner = -1; // -1 = none, 0 = top-left, 1 = top-right, 2 = bottom-left, 3 = bottom-right var lastHitCorner = -1; var debugMode = localStorage.getItem('dvdDebugMode') === 'true'; var debugHighlight = null; var baseSpeed = 1; // Base velocity magnitude var bouncesToHit = -1; // Predicted bounces until corner hit // Configuration: Time between corner hits (in seconds) - set to 60 for testing, 300 for production var cornerSeekingDelay = 60; // Helper: Get corner positions based on current screen dimensions function getCorners(screenW, screenH, logoW, logoH) { return [ {x: 0, y: 0, id: 0}, {x: screenW - logoW, y: 0, id: 1}, {x: 0, y: screenH - logoH, id: 2}, {x: screenW - logoW, y: screenH - logoH, id: 3} ]; } // Helper: Clamp angle to natural range (20-70 degrees from axes) function clampAngle(angle) { var normalized = angle % (Math.PI * 2); var minAngle = 0.35; if (normalized > 0 && normalized < minAngle) return minAngle; if (normalized < Math.PI && normalized > Math.PI - minAngle) return Math.PI - minAngle; if (normalized > Math.PI && normalized < Math.PI + minAngle) return Math.PI + minAngle; if (normalized < Math.PI * 2 && normalized > Math.PI * 2 - minAngle) return Math.PI * 2 - minAngle; return angle; } // Predict future bounce path function predictNextBounce(x, y, angle, screenW, screenH, logoW, logoH) { var vx = Math.cos(angle); var vy = Math.sin(angle); // Calculate time to each wall var tRight = vx > 0 ? (screenW - logoW - x) / vx : Infinity; var tLeft = vx < 0 ? -x / vx : Infinity; var tBottom = vy > 0 ? (screenH - logoH - y) / vy : Infinity; var tTop = vy < 0 ? -y / vy : Infinity; var tX = Math.min(tLeft, tRight); var tY = Math.min(tTop, tBottom); var newAngle; if (tX < tY) { // Hits vertical wall first newAngle = Math.PI - angle; x = x + vx * tX; y = y + vy * tX; } else { // Hits horizontal wall first newAngle = -angle; x = x + vx * tY; y = y + vy * tY; } // Clamp position to bounds (matches actual behavior) x = Math.max(0, Math.min(x, screenW - logoW)); y = Math.max(0, Math.min(y, screenH - logoH)); return { x: x, y: y, angle: clampAngle(newAngle), wall: tX < tY ? 'vertical' : 'horizontal' }; } // Find optimal bounce angle to reach ANY corner (except last hit) function findOptimalBounceAngle(currentX, currentY, currentAngle, excludeCorner, screenW, screenH, logoW, logoH) { var corners = getCorners(screenW, screenH, logoW, logoH); // First, check if current path already hits any corner var x = currentX, y = currentY, angle = currentAngle; for (var bounce = 0; bounce < 15; bounce++) { var result = predictNextBounce(x, y, angle, screenW, screenH, logoW, logoH); x = result.x; y = result.y; angle = result.angle; // Check all corners (except excluded) for (var c = 0; c < corners.length; c++) { if (corners[c].id !== excludeCorner && Math.abs(x - corners[c].x) <= 2 && Math.abs(y - corners[c].y) <= 2) { return {angle: 0, corner: corners[c].id, bounces: bounce + 1}; // Current path already hits a corner! } } } // Search for best angle adjustment var bestAngle = 0; var bestScore = Infinity; var bestCorner = -1; var bestBounces = -1; var foundHit = false; // Try different angle adjustments for (var adj = -0.15; adj <= 0.15; adj += 0.01) { var testAngle = currentAngle + adj; x = currentX; y = currentY; angle = testAngle; // Simulate next 15 bounces var minDist = Infinity; var hitCornerNum = -1; var bounceCount = 0; var hitBounceNum = -1; for (bounce = 0; bounce < 15; bounce++) { result = predictNextBounce(x, y, angle, screenW, screenH, logoW, logoH); x = result.x; y = result.y; angle = result.angle; bounceCount++; // Check all corners for (c = 0; c < corners.length; c++) { if (corners[c].id !== excludeCorner) { var dist = Math.sqrt(Math.pow(x - corners[c].x, 2) + Math.pow(y - corners[c].y, 2)); if (dist < minDist) minDist = dist; // Check for exact hit (±2px) if (Math.abs(x - corners[c].x) <= 2 && Math.abs(y - corners[c].y) <= 2) { hitCornerNum = corners[c].id; hitBounceNum = bounceCount; foundHit = true; break; } } } if (hitCornerNum !== -1) break; } // Score: heavily favor actual hits var score = hitCornerNum !== -1 ? (bounceCount * 5 + Math.abs(adj) * 10) : // Hit: minimize bounces and adjustment (minDist * 200 + Math.abs(adj) * 100); // Miss: heavily penalize if (score < bestScore) { bestScore = score; bestAngle = adj; bestCorner = hitCornerNum; bestBounces = hitBounceNum; } // Early exit if found good hit if (hitCornerNum !== -1 && Math.abs(adj) < 0.05) break; } // Return angle, predicted corner, and bounces return { angle: foundHit ? bestAngle : (Math.random() - 0.5) * 0.03, corner: foundHit ? bestCorner : -1, bounces: foundHit ? bestBounces : -1 }; } function createDVDLogo() { if (dvdLogoElement) return; dvdLogoElement = document.createElement('img'); dvdLogoElement.src = 'https://i.imgur.com/OoWwfWj.png'; dvdLogoElement.style.cssText = 'position: fixed; width: 225px; height: auto; z-index: 9998; pointer-events: none;'; // Wait for image to load and get actual dimensions dvdLogoElement.onload = function() { var actualWidth = dvdLogoElement.offsetWidth; var actualHeight = dvdLogoElement.offsetHeight; dvdPosition.x = Math.floor(Math.random() * (window.innerWidth - actualWidth)); dvdPosition.y = Math.floor(Math.random() * (window.innerHeight - actualHeight)); }; document.body.appendChild(dvdLogoElement); // Reset timer and angle when logo is created lastCornerHitTime = Date.now(); seekingCorners = false; targetCorner = -1; dvdAngle = Math.PI / 4; // Start at 45 degrees } function createConfetti() { var colors = ['#ff0000', '#ff7f00', '#ffff00', '#00ff00', '#0000ff', '#4b0082', '#9400d3', '#ff1493', '#00ffff']; for (var i = 0; i < 100; i++) { var confetti = document.createElement('div'); var width = 6 + Math.random() * 8; var height = 12 + Math.random() * 8; var leftPos = Math.random() * 100; var duration = (4 + Math.random() * 3).toFixed(2); var delay = (Math.random() * 3.5).toFixed(2); var wobble = (Math.random() * 40 - 20); var rotation = (Math.random() * 1440 - 720); confetti.className = 'confetti-piece'; confetti.style.cssText = 'position: fixed; width: ' + width + 'px; height: ' + height + 'px; background: ' + colors[Math.floor(Math.random() * colors.length)] + '; left: ' + leftPos + '%; top: -20px; z-index: 10000; animation: confetti-fall-' + i + ' ' + duration + 's linear ' + delay + 's forwards;'; // Create unique keyframe animation for this confetti piece var styleSheet = document.createElement('style'); styleSheet.textContent = '@keyframes confetti-fall-' + i + ' { 0% { top: -20px; transform: translateX(0) rotate(0deg); } 50% { transform: translateX(' + wobble + 'px) rotate(' + (rotation/2) + 'deg); } 100% { top: ' + (window.innerHeight + 20) + 'px; transform: translateX(0) rotate(' + rotation + 'deg); } }'; document.head.appendChild(styleSheet); document.body.appendChild(confetti); // Clean up after animation completes setTimeout(function(elem, style) { if (elem.parentNode) document.body.removeChild(elem); if (style.parentNode) document.head.removeChild(style); }, (parseFloat(duration) + parseFloat(delay)) * 1000 + 100, confetti, styleSheet); } } function showCornerHit() { if (cornerHitCooldown) return; cornerHitCooldown = true; lastCornerHitTime = Date.now(); seekingCorners = false; lastHitCorner = targetCorner; targetCorner = -1; createConfetti(); // Create wrapper for both text layers var cornerTextWrapper = document.createElement('div'); cornerTextWrapper.id = 'corner-hit-wrapper'; cornerTextWrapper.style.cssText = 'position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10001; pointer-events: none; animation: corner-hit-pulse 0.5s ease-out;'; // Black outline layer (back) var outlineText = document.createElement('div'); outlineText.textContent = 'Corner Hit!'; outlineText.style.cssText = 'position: absolute; top: 0; left: 0; font-size: 240px !important; font-weight: bold; color: black; text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, -3px -3px 0 #000, 3px -3px 0 #000, -3px 3px 0 #000, 3px 3px 0 #000, -4px -4px 0 #000, 4px -4px 0 #000, -4px 4px 0 #000, 4px 4px 0 #000, -5px -5px 0 #000, 5px -5px 0 #000, -5px 5px 0 #000, 5px 5px 0 #000, -6px -6px 0 #000, 6px -6px 0 #000, -6px 6px 0 #000, 6px 6px 0 #000, -6px 0 0 #000, 6px 0 0 #000, 0 -6px 0 #000, 0 6px 0 #000;'; cornerTextWrapper.appendChild(outlineText); // Rainbow gradient layer (front) var cornerTextFill = document.createElement('div'); cornerTextFill.textContent = 'Corner Hit!'; cornerTextFill.style.cssText = 'position: relative; font-size: 240px !important; font-weight: bold; background: linear-gradient(45deg, red 0%, red 10%, orange 10%, orange 20%, yellow 20%, yellow 30%, green 30%, green 50%, cyan 50%, cyan 60%, blue 60%, blue 70%, indigo 70%, indigo 85%, violet 85%, violet 100%); background-size: 300% 300%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; filter: blur(0.5px); animation: rainbow-shift 6s linear infinite;'; cornerTextWrapper.appendChild(cornerTextFill); document.body.appendChild(cornerTextWrapper); setTimeout(function() { if (cornerTextWrapper.parentNode) { document.body.removeChild(cornerTextWrapper); } cornerHitCooldown = false; }, 6000); } addGlobalStyle(` @keyframes rainbow-shift { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } } @keyframes corner-hit-pulse { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 50% { transform: translate(-50%, -50%) scale(1.1); } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } } `); function removeDVDLogo() { if (dvdLogoElement) { document.body.removeChild(dvdLogoElement); dvdLogoElement = null; } if (dvdAnimationFrame) { cancelAnimationFrame(dvdAnimationFrame); dvdAnimationFrame = null; } if (debugHighlight && debugHighlight.parentNode) { document.body.removeChild(debugHighlight); debugHighlight = null; } } function animateDVDLogo() { if (!dvdLogoElement) return; var logoWidth = dvdLogoElement.offsetWidth; var logoHeight = dvdLogoElement.offsetHeight; // Enable corner seeking after configured delay without a hit var timeSinceLastHit = (Date.now() - lastCornerHitTime) / 1000; if (timeSinceLastHit > cornerSeekingDelay && !seekingCorners) { seekingCorners = true; targetCorner = -1; // Will be determined by path prediction on next bounce } // If prediction missed, reset and try again if (bouncesToHit < 0 && targetCorner !== -1) { targetCorner = -1; bouncesToHit = -1; } // Move at constant speed based on angle dvdPosition.x += Math.cos(dvdAngle) * baseSpeed; dvdPosition.y += Math.sin(dvdAngle) * baseSpeed; var hitX = false; var hitY = false; // Bounce off edges - check both, reflect angles if (dvdPosition.x + logoWidth >= window.innerWidth || dvdPosition.x <= 0) { dvdAngle = Math.PI - dvdAngle; // Reflect horizontally dvdPosition.x = Math.max(0, Math.min(dvdPosition.x, window.innerWidth - logoWidth)); // Clamp immediately hitX = true; } if (dvdPosition.y + logoHeight >= window.innerHeight || dvdPosition.y <= 0) { dvdAngle = -dvdAngle; // Reflect vertically dvdPosition.y = Math.max(0, Math.min(dvdPosition.y, window.innerHeight - logoHeight)); // Clamp immediately hitY = true; } // Clamp angle immediately after bouncing if (hitX || hitY) { dvdAngle = clampAngle(dvdAngle); } // Handle seeking/path verification ONCE after bounces and clamping if ((hitX || hitY) && seekingCorners) { if (targetCorner === -1) { // No target yet, find optimal path var optimal = findOptimalBounceAngle(dvdPosition.x, dvdPosition.y, dvdAngle, lastHitCorner, window.innerWidth, window.innerHeight, logoWidth, logoHeight); dvdAngle += optimal.angle; if (optimal.corner !== -1) { targetCorner = optimal.corner; bouncesToHit = optimal.bounces; } } else { // Locked on target, verify path still good var targetPos = getCorners(window.innerWidth, window.innerHeight, logoWidth, logoHeight)[targetCorner]; var testX = dvdPosition.x, testY = dvdPosition.y, testAngle = dvdAngle; var pathValid = false; var updatedBounces = -1; for (var b = 0; b < 15; b++) { var testResult = predictNextBounce(testX, testY, testAngle, window.innerWidth, window.innerHeight, logoWidth, logoHeight); testX = testResult.x; testY = testResult.y; testAngle = testResult.angle; if (Math.abs(testX - targetPos.x) <= 2 && Math.abs(testY - targetPos.y) <= 2) { pathValid = true; updatedBounces = b + 1; break; } } if (pathValid) { bouncesToHit = updatedBounces; } else { targetCorner = -1; bouncesToHit = -1; } } } else if ((hitX || hitY) && !seekingCorners) { // Not seeking, add random variance and clamp dvdAngle = clampAngle(dvdAngle + (Math.random() - 0.5) * 0.05); } // Check for corner hit (within 2 pixel tolerance) if (hitX || hitY) { var corners = getCorners(window.innerWidth, window.innerHeight, logoWidth, logoHeight); for (var c = 0; c < corners.length; c++) { if (Math.abs(dvdPosition.x - corners[c].x) <= 2 && Math.abs(dvdPosition.y - corners[c].y) <= 2) { targetCorner = corners[c].id; bouncesToHit = 0; showCornerHit(); break; } } } // Update debug highlight if (debugMode) { if (seekingCorners && targetCorner === -1) { // Show "SEEKING" in center when no path found yet if (!debugHighlight) { debugHighlight = document.createElement('div'); debugHighlight.innerHTML = '
'; debugHighlight.style.cssText = 'position: fixed; width: 150px; height: 80px; border: 4px solid orange; z-index: 9997; pointer-events: none; box-shadow: 0 0 30px orange; border-radius: 10px; background: rgba(0,0,0,0.7);'; document.body.appendChild(debugHighlight); } debugHighlight.style.left = '50%'; debugHighlight.style.top = '50%'; debugHighlight.style.transform = 'translate(-50%, -50%)'; debugHighlight.style.borderColor = 'orange'; debugHighlight.style.boxShadow = '0 0 30px orange'; debugHighlight.style.display = 'block'; var timerText = document.getElementById('debug-timer'); if (timerText) { timerText.textContent = 'SEEKING'; timerText.style.color = 'orange'; } } else if (seekingCorners && targetCorner !== -1) { // Show corner target with bounce countdown if (!debugHighlight) { debugHighlight = document.createElement('div'); debugHighlight.innerHTML = '
'; debugHighlight.style.cssText = 'position: fixed; width: 100px; height: 100px; border: 4px solid lime; z-index: 9997; pointer-events: none; box-shadow: 0 0 20px lime; border-radius: 10px;'; document.body.appendChild(debugHighlight); } // Position 100x100px box in screen corner (not logo position) var debugBoxSize = 100; var cornerX = (targetCorner === 0 || targetCorner === 2) ? 0 : (window.innerWidth - debugBoxSize); var cornerY = (targetCorner === 0 || targetCorner === 1) ? 0 : (window.innerHeight - debugBoxSize); debugHighlight.style.left = cornerX + 'px'; debugHighlight.style.top = cornerY + 'px'; debugHighlight.style.transform = 'none'; debugHighlight.style.borderColor = 'lime'; debugHighlight.style.boxShadow = '0 0 20px lime'; debugHighlight.style.display = 'block'; var timerText = document.getElementById('debug-timer'); if (timerText) { timerText.textContent = bouncesToHit > 0 ? bouncesToHit : '?'; timerText.style.color = 'lime'; timerText.style.fontSize = '32px'; } } else if (!seekingCorners) { // Show countdown timer in center when not seeking if (!debugHighlight) { debugHighlight = document.createElement('div'); debugHighlight.innerHTML = '
'; debugHighlight.style.cssText = 'position: fixed; width: 120px; height: 80px; border: 4px solid #888; z-index: 9997; pointer-events: none; box-shadow: 0 0 20px #888; border-radius: 10px; background: rgba(0,0,0,0.5);'; document.body.appendChild(debugHighlight); } debugHighlight.style.left = '50%'; debugHighlight.style.top = '50%'; debugHighlight.style.transform = 'translate(-50%, -50%)'; debugHighlight.style.borderColor = '#888'; debugHighlight.style.boxShadow = '0 0 20px #888'; debugHighlight.style.display = 'block'; var timerText = document.getElementById('debug-timer'); if (timerText) { var timeRemaining = Math.max(0, cornerSeekingDelay - timeSinceLastHit); timerText.textContent = Math.ceil(timeRemaining) + 's'; timerText.style.color = '#888'; } } } else if (debugHighlight) { debugHighlight.style.display = 'none'; } // Update position dvdLogoElement.style.left = dvdPosition.x + 'px'; dvdLogoElement.style.top = dvdPosition.y + 'px'; dvdAnimationFrame = requestAnimationFrame(animateDVDLogo); } // Initialize toggle state var dvdToggle = document.getElementById('dvd-logo-toggle'); dvdToggle.checked = dvdLogoEnabled; // Initialize delay input var delayInput = document.getElementById('corner-delay-input'); var delaySetting = document.getElementById('corner-delay-setting'); var savedDelay = localStorage.getItem('cornerSeekingDelay'); if (savedDelay) { cornerSeekingDelay = parseInt(savedDelay); delayInput.value = cornerSeekingDelay; } // Initialize speed input var speedInput = document.getElementById('speed-input'); var speedSetting = document.getElementById('speed-setting'); var savedSpeed = localStorage.getItem('dvdBaseSpeed'); if (savedSpeed) { baseSpeed = parseInt(savedSpeed); speedInput.value = baseSpeed; } // Initialize debug toggle var debugToggle = document.getElementById('debug-toggle'); var debugSetting = document.getElementById('debug-setting'); debugToggle.checked = debugMode; // Show/hide settings based on toggle if (dvdLogoEnabled) { delaySetting.style.display = 'flex'; speedSetting.style.display = 'flex'; debugSetting.style.display = 'flex'; } // Start animation if enabled if (dvdLogoEnabled) { createDVDLogo(); animateDVDLogo(); } // Handle toggle change dvdToggle.onchange = function() { dvdLogoEnabled = dvdToggle.checked; localStorage.setItem('dvdLogoEnabled', dvdLogoEnabled); if (dvdLogoEnabled) { delaySetting.style.display = 'flex'; speedSetting.style.display = 'flex'; debugSetting.style.display = 'flex'; createDVDLogo(); animateDVDLogo(); } else { delaySetting.style.display = 'none'; speedSetting.style.display = 'none'; debugSetting.style.display = 'none'; removeDVDLogo(); if (debugHighlight && debugHighlight.parentNode) { document.body.removeChild(debugHighlight); debugHighlight = null; } } }; // Handle delay input change delayInput.onchange = function() { cornerSeekingDelay = parseInt(delayInput.value); localStorage.setItem('cornerSeekingDelay', cornerSeekingDelay); // Reset timer when delay is changed lastCornerHitTime = Date.now(); seekingCorners = false; targetCorner = -1; }; // Handle speed input change speedInput.onchange = function() { baseSpeed = parseInt(speedInput.value); localStorage.setItem('dvdBaseSpeed', baseSpeed); }; // Handle debug toggle change debugToggle.onchange = function() { debugMode = debugToggle.checked; localStorage.setItem('dvdDebugMode', debugMode); if (!debugMode && debugHighlight && debugHighlight.parentNode) { document.body.removeChild(debugHighlight); debugHighlight = null; } }; // Test corner hit button document.getElementById('corner-hit-test-btn').onclick = function() { cornerHitCooldown = false; // Reset cooldown for test showCornerHit(); }; } var saltyBotRunner; //sets up salty bot and runs it with the config provided by the user function setUpSaltyBot() { console.log("Start setUpSaltyBot"); saltyBotRunner = setInterval(tryToSetWager, 500); console.log("Set CSS"); addGlobalStyle('body {background-color: black !important;}'); addGlobalStyle('#header, #chat-wrapper, #sbettorswrapper, #footer {\ display: none !important;\ visibility: collapse !important;\ }'); addGlobalStyle('html * {\ font-size: x-large !important;\ }'); addGlobalStyle('#stream {\ max-width: none !important;\ width: 100% !important;\ top: 5px !important;\ left: 0px !important;\ right: 0px !important;\ }'); addGlobalStyle('#bottomcontent {width: 100% !important; bottom : 10px;}'); addGlobalStyle('#fightcard {margin-bottom: 0px;}'); addGlobalStyle('#bet-table {padding-top: 10px; padding-bottom: 10px;}'); addGlobalStyle('#player1 {width: 95% !important;}'); addGlobalStyle('#player2 {width: 95% !important;}'); // Set the player1 & player2 backgrounds to fit around the button document.getElementById("player1").parentElement.parentElement.style.height = '100px'; //document.getElementById("player1").parentElement.parentElement.style.borderRadius = '25px'; document.getElementById("player2").parentElement.parentElement.style.height = '100px'; //document.getElementById("player2").parentElement.parentElement.style.borderRadius = '25px'; document.getElementById("odds").parentElement.parentElement.style.bottom = '0px'; // Add settings button addSettingsButton(); } $(document).ready(function () { console.log("jQuery added to Tampermonkey!"); setUpSaltyBot(); var currentInterval = null; // Store the current active interval // Function to repeatedly click a button until it's allowed function tryClickButton(playerButton) { // If an interval is already running, clear it before starting a new one if (currentInterval) { clearInterval(currentInterval); console.log("Cleared previous interval."); } // Set a new interval to try clicking the button currentInterval = setInterval(function () { // Check if the button is visible and not disabled if (playerButton.is(":visible") && !playerButton.is('[disabled=disabled]')) { console.log("Clicking on player button..."); playerButton.click(); clearInterval(currentInterval); // Stop trying once it's clicked currentInterval = null; // Reset the currentInterval variable } }, 100); // Check every 100ms, adjust this as needed } document.body.onkeyup = function (e) { var wager = $("#wager"); var player1 = $("#player1"); var player2 = $("#player2"); // If the "a" key is pressed then try and bet on Player 1 if (e.keyCode == 65) { console.log("\"a\" key pressed; wager: " + wager.val() + "; player1.isVisible: " + player1.is(":visible") + "; player1.disabled: " + player1.is('[disabled=disabled]')); if (wager && wager.val() != "" && player1.is(":visible")) { //Highlight player 1 button document.getElementById("player1").parentElement.parentElement.style.background = 'red'; document.getElementById("player2").parentElement.parentElement.style.background = ''; // Try to click Player 1 button repeatedly until allowed tryClickButton(player1); } } // If the "k" key is pressed then try and bet on Player 2 if (e.keyCode == 75) { console.log("\"k\" key pressed; wager: " + wager.val() + "; player2.isVisible: " + player2.is(":visible") + "; player2.disabled: " + player2.is('[disabled=disabled]')); if (wager && wager.val() != "" && player2.is(":visible")) { //Highlight player 2 button document.getElementById("player1").parentElement.parentElement.style.background = ''; document.getElementById("player2").parentElement.parentElement.style.background = 'blue'; // Try to click Player 2 button repeatedly until allowed tryClickButton(player2); } } } document.getElementById("player1").onclick = function(){ console.log("bet on p1"); lastBet = "player1"; }; document.getElementById("player2").onclick = function(){ console.log("bet on p2"); lastBet = "player2"; }; }); } addJQuery(main); //console.log("Hello, world!");