Sofascore Chances

Replace betting odds with chances calculated by the odds

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Sofascore Chances
// @namespace    https://greasyfork.org/users/21515
// @version      0.2.2
// @description  Replace betting odds with chances calculated by the odds
// @author       CennoxX
// @homepage     https://twitter.com/CennoxX
// @match        https://www.sofascore.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=sofascore.com
// @license      MIT
// @grant        none
// ==/UserScript==
/* jshint esversion: 11 */

(function() {
    "use strict";
    var getChances = (nodes) => {
        if (nodes[0].innerHTML?.includes("%"))
            return null;
        var values = nodes.map(n => Number(n.innerHTML));
        var all = values.reduce((sum, v) => sum + 1 / v, 0);
        return values.map(v => Math.round((1 / v) / all * 100) + " %");
    };
    setInterval(()=>{
        var results = [];
        var selector = "span.textStyle_display\\.micro";
        document.querySelectorAll(selector).forEach(span => {
            for (var el = span.parentElement; el; el = el.parentElement) {
                var matches = el.querySelectorAll(selector);
                if (matches.length == 3 && Number(matches[0].innerHTML)) {
                    results.push([...matches]);
                    break;
                }
            }
        });
        results.forEach(r => {
            var chances = getChances(r);
            if (chances)
                requestAnimationFrame(() => r.forEach((node, i) => { node.innerHTML = chances[i] }));
        });
    },500);
})();