Gleam.io Winning Chance

lets show the odds of winning

当前为 2017-04-01 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Gleam.io Winning Chance
// @namespace    GLEAM
// @version      1.1
// @description  lets show the odds of winning
// @author       Royalgamer06
// @icon         http://i.imgur.com/6PuVE2l.png
// @match        *gleam.io/*
// @grant        none
// ==/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").innerHTML);
                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);
    }
});