Sofascore Chances

Replace betting odds with chances calculated by the odds

Stan na 12-06-2025. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Sofascore Chances
// @namespace    https://greasyfork.org/users/21515
// @version      0.1.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 getChance = (odds, all) => Math.round((1 / odds) / all * 100 ) + " %";
    var getNodeValue = (node) => Number(node.innerHTML);
    setInterval(()=>{
        [...document.querySelectorAll('[style="opacity: 0.8;"],.Box.Flex.ggRYVx.jLRkRA')].map(i => i.closest("a") ?? i.closest(".pos_relative")).forEach(i=>{
            var homeNode = i.querySelector(".Box a:nth-child(2) > div > div > span") ?? i.querySelector("div:nth-child(2) > a:nth-child(1) > div > span");
            var tieNode = i.querySelector(".Box a:nth-child(3) > div > div > span") ?? i.querySelector("div:nth-child(2) > a:nth-child(2) > div > span");
            var awayNode = i.querySelector(".Box a:nth-child(4) > div > div > span") ?? i.querySelector("div:nth-child(2) > a:nth-child(3) > div > span");
            if (!homeNode || !tieNode || !awayNode || homeNode.innerHTML.includes("%")) return;
            var home = getNodeValue(homeNode);
            var tie = getNodeValue(tieNode);
            var away = getNodeValue(awayNode);
            var all = 1 / home + 1 / tie + 1 / away;
            homeNode.innerHTML = getChance(home, all);
            tieNode.innerHTML = getChance(tie, all);
            awayNode.innerHTML = getChance(away, all);
        });
    },500);
})();