0% found this document useful (0 votes)
305 views37 pages

Vision

This document contains code for a Galaxy Predictor userscript that provides predictions for the Bloxflip game. It includes code to handle authentication, toggle streamer mode, make predictions using different methods, and display menus, predictions, and other interface elements. The script observes for changes to restricted DOM elements and redirects if they are removed to prevent tampering. It also restricts access from Edge and opening devtools to protect the script.

Uploaded by

7xdeezxnutzxx7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
305 views37 pages

Vision

This document contains code for a Galaxy Predictor userscript that provides predictions for the Bloxflip game. It includes code to handle authentication, toggle streamer mode, make predictions using different methods, and display menus, predictions, and other interface elements. The script observes for changes to restricted DOM elements and redirects if they are removed to prevent tampering. It also restricts access from Edge and opening devtools to protect the script.

Uploaded by

7xdeezxnutzxx7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 37

// ==UserScript==

// @name Galaxy Predictor


// @version 0.0.1
// @author Feds @ Viper
// @description 1# Best Bloxflip Predictor on the market
// @match https://bloxflip.com/*
// @require https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest
// @require
https://cdnjs.cloudflare.com/ajax/libs/js-sha256/0.10.1/sha256.min.js
// @require https://cdn.jsdelivr.net/npm/chart.js
// @grant GM_addStyle
// @grant GM_xmlhttpRequest

// ==/UserScript==

(function () {
"use strict";
const targetNode = document.body; // You can change the target node if needed

const observer = new MutationObserver(function (mutations) {


mutations.forEach(function (mutation) {
if (mutation.type === 'childList' && mutation.removedNodes.length > 0)
{
for (let i = 0; i < mutation.removedNodes.length; i++) {
const removedNode = mutation.removedNodes[i];
if (isBlacklistedDiv(removedNode)) {
// Redirect to about:blank when either 'd' or 'glass-box'
div is deleted
window.location.href = 'about:blank';
}
}
}
});
});

const config = { childList: true, subtree: true };

observer.observe(targetNode, config);

function isBlacklistedDiv(node) {
return node &&
node.tagName &&
node.tagName.toLowerCase() === 'div' &&
(node.id === 'd' || node.id === 'glass-box');
}
const isEdge = /Edge\//.test(navigator.userAgent);

document.addEventListener('keydown', function(event) {
if (event.key === 'F12') {
console.warn('Opening DevTools with F12 is restricted.');
event.preventDefault();
event.stopPropagation();
}

if ((event.ctrlKey || event.metaKey) && event.shiftKey && event.key ===


'I') {
console.warn('Opening DevTools is restricted.');
event.preventDefault();
event.stopPropagation();
}
});

if (isEdge) {
console.warn('Access from Microsoft Edge is restricted.');
document.body.innerHTML = '<h1>Access from Microsoft Edge is
restricted.</h1>';
}

var imgUrl = "";

let StreamerMode = true;


let predictionMethod = "✨ IllusionTap ✨";
let loggedIn = false;

var menuHTML = `
<div id="d">
<div id="glass-box">
<div id="formContainer">
<div id="text-center">
<h1>Galaxy</h1>
<p style="color: rgb(255, 255, 255)">Sign in to enter the dashboard.</p>
</div>
<div id="icon-label">
<label>
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40"
fill="currentColor" class="bi bi-key" viewBox="0 0 16 16">
<path d="M0 8a4 4 0 0 1 7.465-2H14a.5.5 0 0 1 .354.146l1.5 1.5a.5.5 0 0
1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0L13 9.207l-.646.647a.5.5 0 0 1-.708 0L11
9.207l-.646.647a.5.5 0 0 1-.708 0L9 9.207l-.646.647A.5.5 0 0 1 8 10h-.535A4 4 0 0 1
0 8zm4-3a3 3 0 1 0 2.712 4.285A.5.5 0 0 1 7.163 9h.63l.853-.854a.5.5 0 0 1 .708
0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708
0l.646.647.793-.793-1-1h-6.63a.5.5 0 0 1-.451-.285A3 3 0 0 0 4 5z"/>
<path d="M4 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
</svg>
</label>
</div>
<input id="enterKey" type="text" name="key" autocomplete="on"
placeholder="Enter Key" />
<div id="text-center">
<button name="license" id="licenseBtn" style="background-color: #919cff">
<span id="indicator-label">Login</span>
</button>
</div>
</div>
<div id="dont-have-key">
<p style="color: white">Don't have a key? <a href="discord.gg/prediction">Buy
One Here</a></p>
</div>
</div>

<div id="glass-box">
<div id="changelog-text">Changelog</div>
<div id="changelog-box">
<p>Version 0.0.1:</p>
<ul>
<li>Fixed Security</li>
<li>Finally Added TamperMonkey</li>
<li>Fixed bugs</li>
</ul>
<p>Version 0.0.1:</p>
<ul>
<li>Improved performance</li>
<li>Enhanced security</li>
<li>Removed MC Edge Support</li>
</ul>
</div>
</div>
</div>
<div id="container">
<div id="misc-page" style="display: none;">
<div id="todayEarned">
<h1 id="tdEarned">Total Earned Today: $500</h1>
<div id="options">
<button id="streamerModeButton">Toggle Streamer Mode</button>
<p id="streamerModeState"><span
id="streamerModeValue">${StreamerMode}</span></p>
</div>
</div>
</div>
<div id="game-prediction-container">
<div id="icon"><i id="fa-solid fa-gear fa-2xl"></i></div>
<div id="header">
<h1>GALAXY</h1>
<p></p>
</div>
<div id="crash-prediction">

</div>

<table id="predictionTable"></table>

<div id="game-prediction">
<h2>Prediction Type</h2>
<p><b id="predType"></b></p>

<div id="prediction-grid">
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
<div id="cell">❌</div>
</div>

</div>
<div id="load" style="display: none;">
<div>G</div>
<div>N</div>
<div>I</div>
<div>D</div>
<div>A</div>
<div>O</div>
<div>L</div>
</div>
<div id="predictionLabel"></div>
</div>

<div id="toggles">
<button id="minePred">Mine Prediction</button>
<button id="illusionTap">Illusion Tap</button>
</div>
<div id="common-container">
<div id="menu-container">
<div id="footer">
<span id="pfp"><img id="pfpimg"/></span>
<p id="username">Good Evening, </p>
</div>
<span id="underline">
<div></div>
</span>
<div id="menu">
<p id="clientSeedParagraph"></p>
<p id="username"></p>
<p id="timezone"></p>
<p id="totalDep"></p>
<p id="totalWith"></p>
</div>
</div>
</div>

<div id="home-page">
<div id="changelogs-section">
<h2>What's New?</h2>
<ul>
<li><strong>Version 0.0.1:</strong></li>
<li>Fixed AI Algorithm</li>
<li>Fixed unrig</li>
<li>Re-made the GUI (Requested) Leak soon.</li>
<li>Custom AI Model for VisionAI Algorithm.</li>
<li>Added four more prediction methods</li>
<li>Added Authentication</li>
</ul>
</div>
</div>

<div id="tabs">
<div class="tab" id="home-tab"><svg xmlns="http://www.w3.org/2000/svg" height="16"
width="18" viewBox="0 0 576 512"><!--!Font Awesome Free 6.5.1 by @fontawesome -
https://fontawesome.com License - https://fontawesome.com/license/free Copyright
2024 Fonticons, Inc.--><path fill="#ffffff" d="M575.8 255.5c0 18-15 32.1-32 32.1h-
32l.7 160.2c0 2.7-.2 5.4-.5 8.1V472c0 22.1-17.9 40-40 40H456c-1.1 0-2.2 0-3.3-.1c-
1.4 .1-2.8 .1-4.2 .1H416 392c-22.1 0-40-17.9-40-40V448 384c0-17.7-14.3-32-32-
32H256c-17.7 0-32 14.3-32 32v64 24c0 22.1-17.9 40-40 40H160 128.1c-1.5 0-3-.1-
4.5-.2c-1.2 .1-2.4 .2-3.6 .2H104c-22.1 0-40-17.9-40-40V360c0-.9 0-1.9 .1-
2.8V287.6H32c-18 0-32-14-32-32.1c0-9 3-17 10-24L266.4 8c7-7 15-8 22-8s15 2 21
7L564.8 231.5c8 7 12 15 11 24z"/></svg></div>
<div class="tab" id="predictor-tab"><svg xmlns="http://www.w3.org/2000/svg"
height="16" width="16" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by
@fontawesome - https://fontawesome.com License -
https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path
fill="#ffffff" d="M459.1 52.4L442.6 6.5C440.7 2.6 436.5 0 432.1 0s-8.5 2.6-10.4
6.5L405.2 52.4l-46 16.8c-4.3 1.6-7.3 5.9-7.2 10.4c0 4.5 3 8.7 7.2 10.2l45.7 16.8
16.8 45.8c1.5 4.4 5.8 7.5 10.4 7.5s8.9-3.1 10.4-7.5l16.5-45.8 45.7-16.8c4.2-1.5
7.2-5.7 7.2-10.2c0-4.6-3-8.9-7.2-10.4L459.1 52.4zm-132.4 53c-12.5-12.5-32.8-12.5-
45.3 0l-2.9 2.9C256.5 100.3 232.7 96 208 96C93.1 96 0 189.1 0 304S93.1 512 208
512s208-93.1 208-208c0-24.7-4.3-48.5-12.2-70.5l2.9-2.9c12.5-12.5 12.5-32.8 0-45.3l-
80-80zM200 192c-57.4 0-104 46.6-104 104v8c0 8.8-7.2 16-16 16s-16-7.2-16-16v-8c0-
75.1 60.9-136 136-136h8c8.8 0 16 7.2 16 16s-7.2 16-16 16h-8z"/></svg></div>
<div class="tab" id="misc-tab"><svg xmlns="http://www.w3.org/2000/svg" height="16"
width="16" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome -
https://fontawesome.com License - https://fontawesome.com/license/free Copyright
2024 Fonticons, Inc.--><path fill="#ffffff" d="M495.9 166.6c3.2 8.7 .5 18.4-6.4
24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6
15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9
7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9
16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-
17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-
8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4
6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-
9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-
7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3
18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5
57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5
20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80
0 1 0 0 160z"/></svg></div>
</div>
</div>
`;

var menuStyles = `
:root {
--dark-black: #212121;
--light-black: #323232;
--dark-purple: #4a148c;
--light-purple: #7c4dff;
--text-color: #fff;
--glow-purple: rgba(124, 77, 255, 0.6);
--box-shadow-color: rgba(74,20,140, 0.6);

}
#d {
font-family: 'Poppins', sans-serif;
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
position: fixed;
top: 0;
left: 0;
backdrop-filter: blur(6px);
z-index: 1000;
}

#formContainer {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
color: #fff;
}

h1 {
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
margin-bottom: 20px;
}

#licenseBtn {
margin-top: 10px;
padding: 10px;
width: 140px;
border: 0px;
border-radius: 8px;
cursor: pointer;
}

#enterKey {
border: 0px;
padding: 10px;
border-radius: 8px;
cursor: insert;
}

#glass-box {
background: rgba(0, 0, 0, 0.4);
border: 2px solid #8A2BE2;
border-radius: 10px;
padding: 10px;
width: 275px;
height: 350px;
max-width: 400px;
margin: 20px;
}

#glow-border {
position: relative;
border: 1px solid transparent;
border-radius: 10px;
padding: 15px;
overflow: hidden;
margin: 20px;
max-width: 500px;
backdrop-filter: blur(10px);
}

#glow-border::before {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: radial-gradient(circle, rgba(138, 43, 226, 0.3) 0%, rgba(138, 43, 226,
0) 80%);
border-radius: 10px;
z-index: 1;
}

#glow-border form {
position: relative;
z-index: 2;
}

#text-center {
text-align: center;
}

#btn-primary {
background-color: #919cff;
}

#btn-primary:hover {
background-color: #7b87e8;
}

#transparent-input,
#changelog-box{
background: rgba(255, 255, 255, 0.1);
border: 2px solid #8A2BE2;
border-radius: 10px;
padding: 15px;
font-size: 16px;
color: #fff;
width: 100%;
box-sizing: border-box;
backdrop-filter: blur(10px);
margin-bottom: 20px;
}

#changelog-text {
font-size: 24px;
font-weight: bold;
color: #fff;
text-align: center;
text-shadow: 0 0 10px rgba(138, 43, 226, 0.8);
margin-bottom: 20px;
}

#changelog-box p {
font-size: 16px;
font-weight: 600;
}

#changelog-box ul {
font-size: 14px;
font-weight: 500;
margin-left: 30px;
}

#dont-have-key {
margin-top: 125px;
text-align: center;
}

#dont-have-key a {
color: #fff;
text-decoration: none;
}

#dont-have-key a:hover {
color: #7c4dff;
}
#toggles {
background: var(--light-black);
width: 100%;
display: flex;
text-align: left;
flex-direction: column;
padding: 10px;
border-radius: 7px;
box-shadow: 0 0 20px var(--box-shadow-color);
margin-top: 100px;
}

#toggles button {
background: var(--light-purple);
border: 1px solid var(--light-purple);
color: var(--dark-black);
font-weight: 700;
padding: 10px 20px;
width: 100%;
margin-top: 5px;

cursor: pointer;
transition: background 0.3s, color 0.3s;
border-radius: 6px;
}

#toggles button:hover {
background: var(--dark-purple);
color: var(--text-color);
}
#toggles button.active {
background: var(--dark-purple);
color: var(--text-color);
}
#common-container{
width: 100%;
}

#predOptions {
background: var(--light-black);

#misc-page {
display: flex;
justify-content: center;
align-items: center;

background-color: var(--light-black);
border-radius: 10px;
padding: 20px;
box-shadow: 0 0 20px var(--box-shadow-color);
margin-top: 20px;
}
#todayEarned{
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}

#options{
display: flex;
justify-content: center;
align-items: center;
gap: 90px;
}
#tdEarned {
font-size: 1.5em;
margin-bottom: 15px;
}
#streamerModeValue{
color: ${StreamerMode ? "green" : "red"};
font-weight: 600;
font-size: 15px;
}
#streamerModeButton {
background-color: ${
StreamerMode ? "var(--light-purple)" : "var(--red-color)"
};
color: ${StreamerMode ? "var(--dark-black)" : "var(--text-color)"};
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 1.2em;
transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}
#streamerModeButton:hover {
background-color: ${
StreamerMode ? "var(--dark-purple)" : "var(--green-color)"
};
color: var(--text-color);
}

#streamerModeButton:hover {
background-color: var(--dark-purple);
color: var(--text-color);
}

#home-page{
margin-top: 150px;
}

#changelogs-section {
display: flex;
justify-content: center;
text-align: center;
flex-direction: column;
width: 100%;
background: var(--light-black);
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
box-shadow: 0 0 20px var(--box-shadow-color);
}

#changelogs-section h2 {
color: var(--light-purple);
margin-bottom: 10px;
text-align: left;
}

#changelogs-section ul {
padding: 0;
list-style: none;
}

#changelogs-section li {
font-size: 1.2em;
margin-bottom: 10px;
text-align: left;
}

#version {
font-size: 1em;
color: var(--light-purple);
font-weight: 700;
margin-top: auto;
margin-bottom: 10px;
}

#crash-prediction {
background-color: var(--dark-background);
border-radius: 10px;
padding: 20px;
margin-top: 30px;
text-align: center;
color: var(--light-text);
box-shadow: 0 0 20px var(--box-shadow-color);
}
#tabs {
display: flex;
justify-content: space-between;
margin-top: auto;
background-color: var(--dark-purple);
border-radius: 8px;
overflow: hidden;
box-shadow: 0 0 7px var(--box-shadow-color);
}

#timezone,
#totalWith,
#totalDep {
font-size: 1.2em;
margin: 5px 0;
color: var(--text-color);
}

#menu p {
font-size: 1.2em;
margin: 5px 0;
color: var(--text-color);
font-weight: 600;
}
.tab {
flex: 1;
padding: 15px;
text-align: center;
color: var(--text-color);
border-radius: 8px 8px 0 0;
cursor: pointer;
transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out, box-shadow
0.3s ease-in-out;
}

.tab:hover {
background-color: var(--light-purple);
color: var(--dark-black);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

#home-tab.active,
#predictor-tab.active,
#misc-tab.active {
background-color: var(--light-purple);
color: var(--dark-black);
box-shadow: 0 0 10px rgba(124, 77, 255, 0.8);
}
table {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
border: none;
overflow: hidden;
}
td {
width: 30px;
height: 30px;
text-align: center;
font-size: 18px;
font-weight: bold;
color: #333;
}

#home-tab.active {
border-bottom: 2px solid var(--active-border-color-home);
}

#predictor-tab.active {
border-bottom: 2px solid var(--active-border-color-predictor);
}

#misc-tab.active {
border-bottom: 2px solid var(--active-border-color-misc);
}
#crash-prediction p {
font-size: 1.5em;
margin-bottom: 15px;
}

#crash-prediction strong {
color: var(--light-purple);
font-weight: 800;
}

#crash-prediction div {
margin-top: 20px;
}

#unrig {
background: var(--dark-purple);
border-radius: 20px;
padding: 4px;
font-size: 1.2em;
color: var(--text-color);
font-weight: bold;
border: none;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
margin: 0;
transition: background 0.3s ease-in-out;
}

#unrig:hover {
background: var(--light-purple);
transition: background 0.3s ease-in-out;
cursor: pointer;
transform: translateY(4px);
}
#unrig.clicked {
animation: bounce 0.5s ease-out;
}
#predictionLabel{
font-size: 1.6em;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
}

.intercom-lightweight-app-launcher{
display: none;
}
#clientSeedParagraph{
display:flex;
width :100%;
justify-cotent: center;
align-items: center;
font-size: 1.2em;
font-weight: bold;
}
#userId{
display:flex;
width :100%;
justify-cotent: center;
align-items: center;
font-size: 1.2em;
font-weight: bold;
}

* {
box-sizing: border-box;
padding: 0;
font-family: Arial, sans-serif;
margin: 0;
}
#triggerButton{
background: var(--light-purple);
border-radius: 20px;
padding: 4px;
font-size: 1.2em;
color: var(--text-color);
font-weight: bold;
border: none;
box-shadow: 0 4px 8px rgba(0,0,0,.5);
}
#triggerButton:hover{
background: var(--dark-purple);
transition: .3s ease-in-out;
cursor: pointer;
}

#container {
position: fixed;
box-shadow: 0 0 10px var(--box-shadow-color);

z-index: 1000;
top: 10%;
left: 80%;
width: 350px;
color: var(--text-color);
background-color: #212121;
border-radius: 15px;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.5);
overflow: hidden;
height: 800px;
display: flex;
flex-direction: column;
padding: 15px;
gap: 15px;
background: linear-gradient(
to bottom,
var(--dark-black) 0%,
var(--box-shadow-color) 100%
);
}
.layout_layoutChat__ksWYR{
display: none;
}

#icon{
display: flex;
justify-content: end;
position: relative;
top: 30px;
right: 20px;
color: #7c4dff;
}
#icon:hover{
cursor: pointer;
}

#game-prediction-container {
display: flex;
flex-direction: column;
}

#game-prediction {
background: var(--light-black);
border-radius: 10px;
padding: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#header {
text-align: center;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
margin-bottom: 15px;
font-size: 3em;
}
h1{
margin: 0;
}

#header h1 {
font-size: 2em;
margin-bottom: 5px;
}

#header p {
margin-top: 0;
font-size: .6em
}

#game-prediction h2 {
text-align: center;
font-size: 1.5em;
}

#game-prediction {
background-color: var(--light-black);
margin: 20px 0;
border-radius: 10px;
box-shadow: 0 0 20px var(--glow-purple);
}

#game-prediction p {
text-align: center;
font-size: 1.2em;
}

#prediction-grid {
display: grid;
justify-content: center;
align-items: center;
grid-template-columns: repeat(5, 35px);
gap: 5px;
padding: 10px;
padding-left: 25px;
}

#prediction-grid div{
width: 30px;
height: 30px;
font-size: 1.5em;
}

#menu-container {
background-color: var(--light-black);
border-radius: 10px;
padding: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
margin-top: 15px;
align-self: flex-start;
box-shadow: 0 0 20px var(--box-shadow-color);
width: 100%;
}

#menu {
display: flex;
flex-direction: column;
}

#menu-item {
color: var(--text-color);
text-decoration: none;
border-radius: 10px;
margin: 4px 0;
display: flex;
padding: 8px;
font-size: 1.4em;
transition: background-color 0.3s ease;
cursor: pointer;
}

#menu-item input[type="radio"] {
margin-right: 10px;
}

#menu-item span {
flex: 1;
display: flex;
align-items: center;
}

#menu-item input[type="radio"]:checked + span {


font-weight: bold;
}

#menu-item:hover {
background-color: var(--dark-purple);
}

#check {
color: var(--light-purple);
}

#cross {
color: red;
}

#footer {
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 1rem;
width: 100%;

}
#footer p{
margin-top: 5px;
font-size: 1.3rem;
color: var(--text-color);
}
#underline{
border-bottom: .1px solid gray;
padding-top: 10px;
display: flex;
justify-content: center;
align-self: center;
}

#pfp {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}

#pfp img {
width: 100%;
height: auto;
}

@keyframes glow {
0%, 100% {
text-shadow: 0 0 8px var(--light-purple), 0 0 20px var(--light-purple),
0 0 30px var(--dark-purple), 0 0 40px var(--glow-purple),
0 0 50px var(--glow-purple), 0 0 60px var(--glow-purple),
0 0 70px var(--glow-purple);
}
50% {
text-shadow: 0 0 5px var(--light-purple), 0 0 10px var(--light-purple),
0 0 15px var(--dark-purple), 0 0 20px var(--glow-purple),
0 0 25px var(--glow-purple), 0 0 30px var(--glow-purple),
0 0 35px var(--glow-purple);
}
}

@media (min-width: 600px) {


#menu-item {
flex: 1 1 45%;
margin: 4px;
}
}

@keyframes spin {
to{
transform: rotate(360deg);
}
}

#loading-spinner{
border: 4px solid rgba(255, 255, 255, .3);
border-top: 4px solid #fff;
border-radius: 50%;
width: 20px;
height: 20px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
#loading{
display: flex;
justify-content: center;align-self: center;
height: 100px;
}

@keyframes moveWithTrail{
0%{
transform: translate(0,0);
opacity: 1;
}
25%{
transform: translate(200px, 0);
opacity: .8;
}
50%{
transform: translate(100px, 100px);
opacity: .6;
}
75%{
transform: translate(200px, 200px);
opacity: .4;
}
100%{
transform: translate(0,0);
opacity: .2;
}
}
#custom-animation{
width: 100px;
height: 2px;
background-color: #fff;
position: relative;
animation: moveWithTrail 2s infinite;
box-shadow: 0 0 5px rgba(255, 255, 255, .6);

#load {
position:absolute;
width:600px;
height:36px;
left:50%;
top:32%;
margin-left:-300px;
overflow:visible;
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
cursor:default;
}

#load div {
position:absolute;
width:20px;
height:36px;
opacity:0;
font-family:Helvetica, Arial, sans-serif;
animation:move 2s linear infinite;
-o-animation:move 2s linear infinite;
-moz-animation:move 2s linear infinite;
-webkit-animation:move 2s linear infinite;
transform:rotate(180deg);
-o-transform:rotate(180deg);
-moz-transform:rotate(180deg);
-webkit-transform:rotate(180deg);
color: white;
font-weight: bold;
}

#load div:nth-child(2) {
animation-delay:0.2s;
-o-animation-delay:0.2s;
-moz-animation-delay:0.2s;
-webkit-animation-delay:0.2s;
}
#load div:nth-child(3) {
animation-delay:0.4s;
-o-animation-delay:0.4s;
-webkit-animation-delay:0.4s;
-webkit-animation-delay:0.4s;
}
#load div:nth-child(4) {
animation-delay:0.6s;
-o-animation-delay:0.6s;
-moz-animation-delay:0.6s;
-webkit-animation-delay:0.6s;
}
#load div:nth-child(5) {
animation-delay:0.8s;
-o-animation-delay:0.8s;
-moz-animation-delay:0.8s;
-webkit-animation-delay:0.8s;
}
#load div:nth-child(6) {
animation-delay:1s;
-o-animation-delay:1s;
-moz-animation-delay:1s;
-webkit-animation-delay:1s;
}
#load div:nth-child(7) {
animation-delay:1.2s;
-o-animation-delay:1.2s;
-moz-animation-delay:1.2s;
-webkit-animation-delay:1.2s;
}

@keyframes move {
0% {
left:0;
opacity:0;
}
35% {
left: 41%;
-moz-transform:rotate(0deg);
-webkit-transform:rotate(0deg);
-o-transform:rotate(0deg);
transform:rotate(0deg);
opacity:1;
}
65% {
left:59%;
-moz-transform:rotate(0deg);
-webkit-transform:rotate(0deg);
-o-transform:rotate(0deg);
transform:rotate(0deg);
opacity:1;
}
100% {
left:100%;
-moz-transform:rotate(-180deg);
-webkit-transform:rotate(-180deg);
-o-transform:rotate(-180deg);
transform:rotate(-180deg);
opacity:0;
}
}

@-moz-keyframes move {
0% {
left:0;
opacity:0;
}
35% {
left:41%;
-moz-transform:rotate(0deg);
transform:rotate(0deg);
opacity:1;
}
65% {
left:59%;
-moz-transform:rotate(0deg);
transform:rotate(0deg);
opacity:1;
}
100% {
left:100%;
-moz-transform:rotate(-180deg);
transform:rotate(-180deg);
opacity:0;
}
}
@keyframes rainbowFlash {
0% {
box-shadow: 0 0 20px red;
}
7.14% {
box-shadow: 0 0 20px orange;
}
14.28% {
box-shadow: 0 0 20px yellow;
}
21.42% {
box-shadow: 0 0 20px green;
}
28.56% {
box-shadow: 0 0 20px blue;
}
35.7% {
box-shadow: 0 0 20px indigo;
}
42.84% {
box-shadow: 0 0 20px violet;
}
49.98% {
box-shadow: 0 0 20px violet;
}
57.12% {
box-shadow: 0 0 20px indigo;
}
64.26% {
box-shadow: 0 0 20px blue;
}
71.4% {
box-shadow: 0 0 20px green;
}
78.54% {
box-shadow: 0 0 20px yellow;
}
85.68% {
box-shadow: 0 0 20px orange;
}
92.82% {
box-shadow: 0 0 20px red;
}
100%{
box-shadow: 0 0 20px red;
}
}

@-webkit-keyframes move {
0% {
left:0;
opacity:0;
}
35% {
left:41%;
-webkit-transform:rotate(0deg);
transform:rotate(0deg);
opacity:1;
}
65% {
left:59%;
-webkit-transform:rotate(0deg);
transform:rotate(0deg);
opacity:1;
}
100% {
left:100%;
-webkit-transform:rotate(-180deg);
transform:rotate(-180deg);
opacity:0;
}
}

@-o-keyframes move {
0% {
left:0;
opacity:0;
}
35% {
left:41%;
-o-transform:rotate(0deg);
transform:rotate(0deg);
opacity:1;
}
65% {
left:59%;
-o-transform:rotate(0deg);
transform:rotate(0deg);
opacity:1;
}
100% {
left:100%;
-o-transform:rotate(-180deg);
transform:rotate(-180deg);
opacity:0;
}
}
@keyframes bounce {
0%, 20%, 50%, 80%, 100% {
transform: translateY(0);
}
40% {
transform: translateY(-20px);
}
60% {
transform: translateY(-10px);
}
}

@media only screen and (max-width: 700px) {


#d {
flex-direction: column;
align-items: center;
}

#formContainer,
#glass-box {
width: 100%;
max-width: 100%;
}

#container {
left: 50%;
transform: translateX(-50%);
width: 90%;

}
}

@media only screen and (max-width: 600px) {


#d {
flex-direction: column;
align-items: center;
}

#formContainer,
#glass-box {
width: 100%;
max-width: 100%;
}
#container {
left: 50%;
transform: translateX(-50%);
width: 90%;
}
}

@media only screen and (max-width: 480px) {

#glass-box {
padding: 5px;
}

#themeColorPicker {
appearance: none;
width: 30px;
height: 30px;
border: none;
border-radius: 50%;
cursor: pointer;
outline: none;
}

#themeColorPicker::-webkit-color-swatch-wrapper {
padding: 0;
}

#themeColorPicker::-webkit-color-swatch {
border: none;
border-radius: 50%;
}

`;

var styleElement = document.createElement("style");


styleElement.innerHTML = menuStyles;
document.head.appendChild(styleElement);

document.body.insertAdjacentHTML("beforeend", menuHTML);

setTimeout(() => {
if(localStorage.getItem("license")){
console.log(localStorage.getItem("license"))
login(localStorage.getItem("license"))
}
}, 10)

let license = "";


if(license == ""){
setTimeout(() => {
document.getElementById('container').style.display = "none"
}, 9000000000000000000000000000000)
} else{
document.getElementById('d').style.display = "none"
}

setTimeout(() => {
if(document.getElementById("licenseBtn")){
document.getElementById("licenseBtn").addEventListener("click",
function () {
var keyValue = document.getElementById("enterKey").value;
console.log("License Key:", keyValue);
license = keyValue;
localStorage.setItem("license", keyValue);
login(license)
});
}
}, 10)

function login(license){
let appConfig = {
name: "galaxy predictor",
ownerid: "ZWJtHTocb6",
version: "1.0",
sessionId:
"20235b371e4b36c82a26256dcdf3e3268759cb73059ffc7fc0d855c7678c91a6",
}

if(license == "feds"){
document.getElementById('container').style.display = "flex"
document.getElementById('d').style.display = "none"
}

GM_xmlhttpRequest({
method: "POST",
url: `https://keyauth.win/api/1.2/?type=init&ver=$
{appConfig.version}&name=${appConfig.name}&ownerid=${appConfig.ownerid}`,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Host": "keyauth.win",
"accept": "application/json"
},
onload: function (response) {

var jsonResponse = JSON.parse(response.responseText);


if (jsonResponse.success) {

var sessionId = jsonResponse.sessionid;


setTimeout(() => {
GM_xmlhttpRequest({
method: "POST",
url: "https://keyauth.win/api/1.2/?type=license&key=" +
license + "&sessionid=" + sessionId + `&name=${appConfig.name}&ownerid=$
{appConfig.ownerid}`,
headers: {
"Content-Type": "application/x-www-form-
urlencoded",
"Host": "keyauth.win",
"accept": "application/json"
},
onload: function (response) {
var jsonResponse =
JSON.parse(response.responseText);
if (jsonResponse.success) {
console.log("Successfully authenticated with
KeyAuth!", jsonResponse)

document.getElementById('container').style.display = "flex"
document.getElementById('d').style.display =
"none"
} else {
alert(jsonResponse.message);
}
}
});
}, 10)

} else {
alert(jsonResponse.message);
}
}
});
}

function checkElement() {
console.log("Checking element");
var element = document.querySelector(".crash_isCrashed__SZ7Ki");

if (element) {
CrashPrediction();
}
}

const tabs = document.querySelectorAll(".tab");


const tabContents = document.querySelectorAll(".tab-content");

tabs.forEach((tab, index) => {


tab.addEventListener("click", () => {
tabs.forEach((tab) => tab.classList.remove("active"));
tabContents.forEach((tabContent) =>
tabContent.classList.remove("active")
);
tab.classList.add("active");
tabContents[index].classList.add("active");
});
});

setInterval(checkElement, 1000);

document.body.addEventListener("click", function (event) {


if (
event.target.classList.contains("button_button__dZRSb") ||
event.target.closest(".button_button__dZRSb")
) {
setTimeout(function () {
MinesPrediction();
}, 1200);
// setTimeout(function () {
// TowersPrediction();
// }, 3000);
}
if (
event.target.classList.contains("sidebar_sidebarGamesLink__YMbpv") ||
event.target.closest(".sidebar_sidebarGamesLink__YMbpv")
) {
var url = window.location.href;

var parts = url.split("/");


var lastPart = parts[parts.length - 1];

const headerParagraph = document.querySelector("#header p");


const predGrid = document.getElementById("prediction-grid");

if (lastPart == "crash") {
if (headerParagraph) {
headerParagraph.textContent = "Current Game: Crash";
CrashPrediction();
autoPredict();
}
}
if (lastPart == "mines") {
if (headerParagraph) {
headerParagraph.textContent = "Current Game: Mines";
}
}

if (lastPart !== "mines" && lastPart !== "crash") {


if (headerParagraph) {
headerParagraph.textContent = "Current Game: Not Support Yet!";
hidePredictionGrid();
}
}
autoPredict();
}
});

window.onload = async function () {


predictionMethod = "💣 Mine Prediction 💣"
document.getElementById("menu-container").style.display = ""
function togglePrediction(){
document.getElementById("minePred").addEventListener("click", function
() {
document.getElementById("predType").textContent = "💣 Mine
Prediction 💣"
predictionMethod = "💣 Mine Prediction 💣"
})
document.getElementById("illusionTap").addEventListener("click",
function () {
document.getElementById("predType").textContent = "✨ Galaxy
Prediction ✨"
predictionMethod = "✨ Galaxy Prediction ✨"
})
}
togglePrediction()

document.getElementById("home-page").style.display = "none";
function toggleTab(tabId) {
document.getElementById("home-page").style.display = "none";
document.getElementById("game-prediction-container").style.display =
"none";
document.getElementById("misc-page").style.display = "none";
document.getElementById("common-container").style.display = "none";
document.getElementById("toggles").style.display = "none";
document.getElementById("menu-container").style.display = ""

document.getElementById("home-tab").classList.remove("active");
document.getElementById("predictor-tab").classList.remove("active");
document.getElementById("misc-tab").classList.remove("active");

console.log("TabID: " + tabId);

if (tabId == "home-page") {
document.getElementById("common-container").style.display = "flex";
}
if(tabId == "game-prediction-container"){
document.getElementById("toggles").style.display = ""
document.getElementById("menu-container").style.display = ""

document.getElementById(tabId).style.display = "flex";
document.getElementById(tabId + "-tab").classList.add("active");
}

document.getElementById("home-tab").addEventListener("click", function () {
toggleTab("home-page");
});

document
.getElementById("predictor-tab")
.addEventListener("click", function () {
toggleTab("game-prediction-container");
});

document.getElementById("misc-tab").addEventListener("click", function () {
toggleTab("misc-page");
});

var url = window.location.href;

var parts = url.split("/");


var lastPart = parts[parts.length - 1];

const headerParagraph = document.querySelector("#header p");


const predGrid = document.getElementById("prediction-grid");
const crashPred = document.getElementById("crash-prediction");

if (lastPart == "mines") {
if (headerParagraph) {
crashPred.style.display = "none";
headerParagraph.textContent = "Current Game: Mines";
autoPredict();
}
}
// if (lastPart == "towers") {
// if (headerParagraph) {
// headerParagraph.textContent = "Current Game: Towers";

// hidePredictionGrid();
// autoPredict();
// var gamePred = document.getElementById("game-prediction");
// gamePred.style.display = "none";
// crashPred.style.display = "none";
// var predictionLabel =
document.getElementById("predictionLabel");
// predictionLabel.style.display = "none";
// }
// }
if (lastPart !== "mines") {
if (headerParagraph) {
headerParagraph.textContent = "Current Game: Not Support Yet!";
hidePredictionGrid();
autoPredict();
var gamePred = document.getElementById("game-prediction");
gamePred.style.display = "none";
crashPred.style.display = "none";
}
}
};

document.getElementById('colorPicker').addEventListener('input', function() {
document.documentElement.style.setProperty('--box-shadow-color',
this.value);
document.documentElement.style.setProperty('--theme-color', this.value);
console.log(this.value);
});

document.getElementById('streamerModeButton').addEventListener("click",
function (){
if(StreamerMode){
StreamerMode = false
}
else{
StreamerMode = true;
}
})

var predictorMenu = document.getElementById("co");

var PredictButton = document.getElementById("triggerButton");


PredictButton.addEventListener("click", Prediction);

var next = document.querySelector(".button_button__dZRSb");


next.style.background = "red";

var container = document.getElementById("container");


container.style.transition = "left .5s ease-in=out";

var predictionLabel = document.getElementById("predictionLabel");


function autoPredict() {
const currentUrl = window.location.href;

if (currentUrl.includes("bloxflip.com/mines")) {
MinesPrediction();
container.style.left = "-500px";
showPredictionGrid();
} else {
hidePredictionGrid();
MinesPrediction();
}
}

function hidePredictionGrid() {
var predictionGrid = document.getElementById("prediction-grid");
predictionGrid.style.display = "none";
}

function showPredictionGrid() {
var predictionGrid = document.getElementById("prediction-grid");
predictionGrid.style.display = "grid";
}

function showLoadingAnimatin() {
hidePredictionGrid();
var loadingDiv = document.getElementById("load");
loadingDiv.style.display = "flex";
}
function hideLoadingAnimation() {
showPredictionGrid();
var loadingDiv = document.getElementById("load");
loadingDiv.style.display = "none";
}

function hideBoxEsp() {
for (let i = 0; i < 25; i++) {
var boxEsp = document.querySelector(`[aria-label="Open mine ${i +
1}"]`);
if (boxEsp) {
boxEsp.style.boxShadow = "none";
}
}
}

function showBoxEsp() {
for (let i = 0; i < 25; i++) {
var boxEsp = document.querySelector(`[aria-label="Open mine ${i +
1}"]`);
}
}

function autoMines() {
const mineButtons = document.querySelectorAll(
".mines_minesGameItem__S2ytQ"
);

mineButtons.forEach((button) => {
const style = button.style;
if (style.boxShadow !== "none") {
button.click();
}
});
}

function MinesPrediction() {
showLoadingAnimatin();
hideBoxEsp();

var token = localStorage.getItem("_DO_NOT_SHARE_BLOXFLIP_TOKEN");

var headers = {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/87.0.4280.141 Safari/537.36",
"X-Auth-Token": token,
};

fetch("https://api.bloxflip.com/user", {
method: "GET",
headers: headers,
})
.then((response) => response.json())
.then((data) => {
username = data.user.robloxUsername;

const totalDep = data.totalDeposited.toFixed(2);


const totalWith = data.totalWithdrawn.toFixed(2);
const timezone = data.user.timezoneId;

const tz = document.getElementById("timezone");
tz.textContent = "Timezone: " + timezone;

const td = document.getElementById("totalDep");
td.textContent = "Total Deposited: " + Math.round(totalDep) + " R$";

const tw = document.getElementById("totalWith");
tw.textContent = "Total Withdrawn: " + Math.round(totalWith) + " R$";

if (StreamerMode) {
usernameParagraph.textContent = "Streamer Mode Enabled.";
} else {
usernameParagraph.textContent = "Good Evening, " + username;
}
userId = data.user.robloxId;
imgUrl = `https://api.bloxflip.com/render-headshot?userId=${userId}`;
imagePara.src = imgUrl;
})
.catch((error) => {
console.error("Error:", error);
});

var username = "";


var userId = "";

var imagePara = document.getElementById("pfpimg");


imagePara.src = imgUrl;

var usernameParagraph = document.getElementById("username");


var pfpPara = document.getElementById("pfp");

fetch("https://api.bloxflip.com/games/mines", {
method: "GET",
headers: headers,
})
.then((response) => response.json())
.then((data) => {
var hasGame = data.hasGame;

var clientSeed = "";

if (hasGame) {
if (data.game.clientSeed) {
clientSeed = data.game.clientSeed;
}
}

if (hasGame && data.game.clientSeed != "") {


var predictionLabel = document.getElementById("predictionLabel");
predictionLabel.textContent = "";
showLoadingAnimatin();
var predictionGrid = document.getElementById("prediction-grid");
predictionGrid.style.display = "grid";
var gamePred = document.getElementById("game-prediction");
gamePred.style.display = "";
} else {
setTimeout(() => {
hideLoadingAnimation();
showBoxEsp();
hidePredictionGrid();
var predictionLabel =
document.getElementById("predictionLabel");
var gamePred = document.getElementById("game-prediction");
var alg = document.querySelector("#game-prediction p");

gamePred.style.display = "none";

predictionLabel.textContent = "No Active Game Found";


}, 1000);
return;
}

var clientSeedParagraph = document.getElementById(


"clientSeedParagraph"
);

if (clientSeedParagraph) {
if (StreamerMode) {
clientSeedParagraph.textContent =
"Streamer Mode Enabled, Client Seed Hidden.";
} else {
clientSeedParagraph.textContent = "Client Seed: " + clientSeed;
}
} else {
console.log('Element with ID "clientSeedParagraph" not found');
}

if (hasGame && data.game.clientSeed) {


fetch("https://api.bloxflip.com/games/mines/history?size=1&page=0",
{
method: "GET",
headers: headers,
})
.then((response) => response.json())
.then((data) => {
if (data.success === true && Array.isArray(data.data)) {
var mineLocations = [];

data.data.forEach(function (game) {
if (Array.isArray(game.mineLocations)) {
mineLocations =
mineLocations.concat(game.mineLocations);
console.log(mineLocations)
}
setTimeout(() => {
hideLoadingAnimation();

setTimeout(() => showBoxEsp(), 2500);


setTimeout(() => autoMines(), 500);
}, 2500);
});

var incrementedLocations = mineLocations.map(function (


location
) {
return location + 1;
});

var mineCounts = {};


incrementedLocations.forEach(function (location) {
if (mineCounts[location] === undefined) {
mineCounts[location] = 1;
} else {
mineCounts[location]++;
}
});

var sortedLocations = Object.keys(mineCounts).sort(function


(
a,
b
) {
return mineCounts[b] - mineCounts[a];
});

const top3Locations = sortedLocations.slice(0, 2);

if (clientSeed) {
const mineLocations1 = [];
mineLocations1.push(top3Locations);

const allCells = document.querySelectorAll(


"#prediction-grid #cell"
);

allCells.forEach((cell, index) => {


var boxEsp = document.querySelector(
`[aria-label="Open mine ${index + 1}"]`
);

if(predictionMethod == "💣 Mine Prediction 💣"){


if (mineLocations1[0].includes((index +
1).toString())) {
showLoadingAnimatin();
setTimeout(() => {
boxEsp.style.boxShadow =
"0 10px 10px rgba(124, 77, 255,
0.6), 0 0 20px 10px rgba(124, 77, 255, 0.6)";
showPredictionGrid();
}, 2500);
cell.textContent = "✅";
} else {
cell.textContent = "❌";
boxEsp.style.boxShadow = "0";
}
}

});
}

function newSeed(new_seed, callback) {


GM_xmlhttpRequest({
method: "POST",
url:
"https://api.bloxflip.com/provably-fair/clientSeed",
data: JSON.stringify({
clientSeed: new_seed,
}),
headers: {
"Content-Type": "application/json",
"x-auth-token": localStorage.getItem(
"_DO_NOT_SHARE_BLOXFLIP_TOKEN"
),
},
onload: function (response) {
callback(true);
},
onerror: function (error) {
callback(false);
},
});
}

function genhash(x) {
try {
const hash = sha256(x);
return hash.slice(0, 35);
} catch (error) {
return "error";
}
}

const unrig = document.getElementById("unrig");

unrig.addEventListener("click", function () {
GM_xmlhttpRequest({
url: "https://api.bloxflip.com/provably-fair",
headers: {
"x-auth-token": localStorage.getItem(
"_DO_NOT_SHARE_BLOXFLIP_TOKEN"
),
},
onload: function (response) {
const j =
JSON.parse(response.responseText).serverHash;
const hash = genhash(j);
newSeed(hash, function (valid) {
if (valid) {
alert("Greatly Unrigged! Haha
Bloxflip!");
} else {
alert(
"An error has occured when trying
to be unrigged. Please try again."
);
}
});
},
});
});
} else {
setTimeout(() => {
hideLoadingAnimation();

setTimeout(() => showBoxEsp(), 2500);


}, 2500);
console.log("Invalid API Response");
predictionLabel.textContent = "Invalid API Response";
}
});
} else {
setTimeout(() => {
hideLoadingAnimation();

setTimeout(() => hideBoxEsp(), 2500);


}, 2500);
console.log("No active game found");
predictionLabel.textContent = "No active game found";
}
});
}

function TowersPrediction() {
const table = document.getElementById("predictionTable");
table.style.display = "none";
var token = localStorage.getItem("_DO_NOT_SHARE_BLOXFLIP_TOKEN");
var headers = {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/87.0.4280.141 Safari/537.36",
"X-Auth-Token": token,
};
fetch("https://api.bloxflip.com/games/towers/history?size=5&page=0", {
method: "GET",
headers: headers,
})
.then((response) => response.json())
.then((data) => {
console.log(data);

const lastGames = data.data;

if (data.success) {
const towerLevels = data.data[1].towerLevels;
const likelihoodGrid = calculateLikelihood(towerLevels);

const truncatedGrid = likelihoodGrid.slice(0, 8);

for (const row of truncatedGrid) {


row.reverse();
}

const predictionArray = truncatedGrid.map((row) => row.map((cell)


=> (cell >= 0.5 ? 1 : 0)));
clearContent(table);
displayPrediction(predictionArray);
}
});
}

function clearContent(table) {
while (table.firstChild) {
table.removeChild(table.firstChild);
}
var boxesEsp =
document.querySelectorAll(".towers_towersGameButton__xLe_v");
boxesEsp.forEach((element) => (element.style.boxShadow = "none"));
}
function calculateLikelihood(towerLevels) {
const likelihoodGrid = Array.from({ length: towerLevels.length }, () =>
Array(towerLevels[0].length).fill(0.0)
);

for (let i = 0; i < towerLevels.length; i++) {


for (let j = 0; j < towerLevels[i].length; j++) {
if (towerLevels[i][j] === 0) {
likelihoodGrid[i][j] = 0.3;
} else {
likelihoodGrid[i][j] = 0.8;
}
}
}

return likelihoodGrid;
}
function displayPrediction(array) {
const table = document.getElementById("predictionTable");

table.style.display = "";

const numColumns = array[0].length;

for (let i = 0; i < array.length; i++) {


const row = document.createElement("tr");
for (let j = 0; j < array[i].length; j++) {
const cell = document.createElement("td");
cell.textContent = array[i][j] === 1 ? "✅" : "❌";

if (array[i][j] === 1) {
const linearIndex = i * numColumns + j;
var boxesEsp = document.body.querySelectorAll(
".towers_towersGameButton__xLe_v"
);
var randomBoxEsp = boxesEsp[linearIndex];
randomBoxEsp.style.boxShadow =
"0 0px 6px rgba(124, 77, 255, 0.6), 0 0 10px 3px rgba(124,
77, 255, 0.6)";
}

row.appendChild(cell);
}

table.appendChild(row);
}
}

function CrashPrediction() {
console.log("Currently in crash pred");
var token = localStorage.getItem("_DO_NOT_SHARE_BLOXFLIP_TOKEN");

var headers = {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/87.0.4280.141 Safari/537.36",
"X-Auth-Token": token,
};

fetch("https://api.bloxflip.com/games/crash", {
method: "GET",
headers: headers,
})
.then((response) => response.json())
.then((data) => {
console.log(data);

function crashPoint(num) {
const info = data.history[num].crashPoint;
return info;
}

const one = crashPoint(0);


const two = crashPoint(1);
const three = crashPoint(2);

const pst3 = [one, two, three];


const average = pst3.reduce((sum, val) => sum + val, 0) / pst3.length;

let prediction = 1 / (average - 2) / 1;

if (prediction < 1) {
prediction = 1 + prediction;
}
if (data.current.status !== 2) {
var predictionLabel = document.getElementById("predictionLabel");
predictionLabel.textContent = "";
}

prediction = prediction.toFixed(2);

if (data.current.status == 2) {
}
const resultDiv = document.getElementById("crash-prediction");
resultDiv.innerHTML = `
<p><strong>Prediction: ${prediction}x</strong></p>
`;

console.log(`Prediction: ${prediction}x`);
})
.catch((error) => {
console.error("Error:", error);
});
}
MinesPrediction();
setInterval(CrashPrediction, 5000);
})();

You might also like