flashscore_add_on

red cards finder

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         flashscore_add_on
// @namespace    http://tampermonkey.net/
// @version      0.9
// @description  red cards finder
// @author       botclimber
// @match        https://www.flashscore.pt/
// @match        https://www.flashscore.com/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var trAudio = new Audio();
    trAudio.src = "/res/sound/_fs/ogg/common-cheers.ogg";

    document.getElementsByClassName("container__content content")[0].style.width = "1150px";
    var space = document.getElementById('rc-top');

    var found = '-';

    space.style.width = "400px";
    setInterval(function(){

        var foundAux = 0;
        var lGames = document.getElementsByClassName("event__match event__match--live event__match--oneLine");

        space.innerHTML = "<h2>Found: "+found+"</h2>";

        for (var i = 0; i < lGames.length; i++){

        var score = lGames[i].getElementsByClassName("event__scores")[0].textContent;
        var time = lGames[i].getElementsByClassName("event__stage--block")[0].textContent;

        var hTeam = lGames[i].getElementsByClassName("event__participant event__participant--home")[0];
        var aTeam = lGames[i].getElementsByClassName("event__participant event__participant--away")[0];

        var hCardTeam = hTeam.getElementsByClassName("card___2ip_DLm icon--redCard").length;
        var aCardTeam = aTeam.getElementsByClassName("card___2ip_DLm icon--redCard").length;

            if(hCardTeam > 0 || aCardTeam > 0){
                foundAux++;

                var newGame = localStorage.getItem(lGames[i].id);

                if(newGame == undefined){
                    trAudio.play();
                    localStorage.setItem(lGames[i].id, "Game nr: "+i);
                }

                hTeam = (hCardTeam > 0)? "<span style='color:orange;'>"+hTeam.textContent+"</span>" : hTeam.textContent ;
                aTeam = (aCardTeam > 0)? "<span style='color:orange;'>"+aTeam.textContent+"</span>" : aTeam.textContent ;

                if(hCardTeam > 0 && aCardTeam == 0){
                    space.innerHTML += "<a href='#"+lGames[i].id+"'><p style='padding:2px;font-size:10pt;'><font style='border-radius:10%;width:15px;height:10px;background-color:red;color:white;'><b>"+hCardTeam+"</b></font> "+hTeam+" "+score+" "+aTeam+" - '"+time+"</p></a>";

                }else if(hCardTeam == 0 && aCardTeam > 0){
                    space.innerHTML += "<a href='#"+lGames[i].id+"'><p style='padding:2px;font-size:10pt;'>"+hTeam+" "+score+" "+aTeam+" <font style='border-radius:10%;width:15px;height:10px;background-color:red;color:white;'><b>"+aCardTeam+"</b></font> - '"+time+"</p></a>";

                }else{
                    space.innerHTML += "<a href='#"+lGames[i].id+"'><p style='padding:2px;font-size:10pt;'><font style='border-radius:10%;width:15px;height:10px;background-color:red;color:white;'><b>"+hCardTeam+"</b></font> "+hTeam+" "+score+" "+aTeam+" <font style='border-radius:10%;width:10px;height:10px;background-color:red;color:white;'><b>"+aCardTeam+"</b></font> - '"+time+"</p></a>";
                }
            }
        }

        found = foundAux;

   }, 3000);

})();