Log an activation message to the console console.log("Activated script"); // Extend the Number prototype with a method to truncate to a specified decimal places Number.prototype.truncateTo = function(decimalPlaces) { var numberStr = this + ""; // Convert number to string var parts = numberStr.split('.'); // Split into integer and fractional parts parts[1] = parts[1] || ""; // If no fractional part, set to empty string // Reconstruct number with truncated fractional part return parseFloat(parts[0] + "." + parts[1].substring(0, decimalPlaces)); }; // Initialize control variables var isFirstRun = true; var tickCount = 0; var delayMs = 1000; // delay in milliseconds // Set up a periodic check every second setInterval(function() { // Check if a certain element (probably a display container) is hidden if ($('.display').css('display') == 'none') { tickCount++; // If within delay period and another element is hidden, update random digits if (delayMs > tickCount && $('#free_play_digits').css('display') == 'none') { // Generate random digits for display elements (possibly a slot machine) $('#multiplier_first_digit').text(Math.floor(Math.random() * 10)); $('#multiplier_second_digit').text(Math.floor(Math.random() * 10)); $('#multiplier_third_digit').text(Math.floor(Math.random() * 10)); $('#multiplier_fourth_digit').text(Math.floor(Math.random() * 10)); $('#multiplier_fifth_digit').text(Math.floor(Math.random() * 10)); } else { // Set display elements to default values $('#free_play_first_digit').text(1); $('#free_play_second_digit').text(0); $('#free_play_third_digit').text(0); $('#free_play_fourth_digit').text(0); $('#free_play_fifth_digit').text(0); // Read current balance from some display element (assumed to be a string number) var balanceElement = $('#balance')[0]._innerHTML || ''; // Parse current balance var currentBalance = parseFloat($('#balance').text()) || 0; // Add some amount to the balance (simulate winnings or gains) var addedAmount = parseFloat(balanceElement); var newBalance = currentBalance + addedAmount; // Truncate the balance to 8 decimal places newBalance = newBalance.truncateTo(8); // Save the new balance to local storage localStorage.setItem('balance', newBalance); // Update the display with the new balance $('#balance').text(newBalance); } } }, 1000); // runs every 1 second