Last active
February 10, 2024 14:46
-
-
Save albertopasqualetto/7f499a74317613a6f4aea3b86c0a1b3c to your computer and use it in GitHub Desktop.
Gleam.io Winning Chance userscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Gleam.io Winning Chance | |
// @namespace albertopasqualetto | |
// @version 1.2 | |
// @description lets show the odds of winning | |
// @author Royalgamer06 & albertopasqualetto | |
// @icon http://i.imgur.com/6PuVE2l.png | |
// @match *gleam.io/* | |
// @grant none | |
// @require https://code.jquery.com/jquery-3.7.1.min.js | |
// @downloadURL https://gist.github.com/albertopasqualetto/7f499a74317613a6f4aea3b86c0a1b3c/raw/Gleam.io%2520Winning%2520Chance.user.js | |
// @updateURL https://gist.github.com/albertopasqualetto/7f499a74317613a6f4aea3b86c0a1b3c/raw/Gleam.io%2520Winning%2520Chance.user.js | |
// ==/UserScript== | |
$(document).ready(function() { | |
if (document.getElementById("current-entries") !== null) { | |
$('.span4.blue-square.ng-scope').after('<div class="span4 green-square ng-scope"> <span class="square-describe mont"> <span class="status small"> <span class="current ng-binding" id="winning_chance">NaN</span> </span> <span class="description ng-binding">Winning Chance</span> </span> </div>'); | |
var elems = document.querySelectorAll("div.square-row.row-fluid.center.ng-scope > .span4"); | |
for (var i = 0; i < elems.length; i++) { | |
elems[i].setAttribute("style", "width:25%;"); | |
} | |
var gleam = setInterval(function() { | |
if (document.querySelector(".status.ng-binding") !== null) { | |
var own = parseInt(document.querySelector(".status.ng-binding").innerHTML); | |
var total = parseInt(document.querySelector(".current.ng-binding").textContent.replace(/[,.]/,'')); | |
var chance = Math.round(100000 * own / total ) / 1000; | |
document.getElementById("winning_chance").innerHTML = chance + "%"; | |
console.log("[GLEAM] Your winning chance is " + chance + "%!"); | |
clearInterval(gleam); | |
} | |
}, 500); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment