JSFiddle - React, Tailwind, and code Playground

by antouank

JavaScript

//////////////////
var homeURL = 'https://www.paf.com/mobile/betting#events/live';
var baseURL = 'https://www.paf.com/mobile/betting#event/live';

window.location = homeURL;

var getLiveMarkets = function ($gameDiv) {

    $('div.scoreboard').each(function (i) {
        var $ele = $(this)
        var link = baseURL + '/' + $ele.find('button.starred').data().id;
        var odds = {};
        var home = $ele.find('div.event-name-home').text();
        var away = $ele.find('div.event-name-away').text();
        var time = $ele.find('span.match-clock-time').text();
        var type = $ele.find('span.group').text().match(/^[\w\s]+[^\/]/g)[0];

        $ele.find('button.outcome').each(function () {
            odds[$(this).find('.outcome-label').text()] = $(this).find('.outcome-odds').text();
        });

        console.log(i + "| " + home + " v " + away);

        if (time == '') {
            time = $ele.find('div.set-match-clock').text();
        }

        if (time.replace(":", "").length == 4) {
            time = '00' + time.replace(":", "");
        }

        var matchData = {
            ev: home + ' v ' + away,
            p1: home,
            p2: away,
            type: type,
            time: time,
            active: 1
        };

        checkMatch(matchData);


        //		var followLinkTimer = setInterval(function () {
        //			console.log('checking if '+document.URL+' == '+homeURL);
        //			if(document.URL==homeURL){
        //				window.location = link;
        //				if(document.URL==link){
        //					console.log('succesfully into '+document.URL);
        //					clearInterval(followLinkTimer);
        //					setTimeout(checkMarkets,1000);
        //					setTimeout(function () {window.location = homeURL;},2000);
        //				}
        //			}
        //		},1500);

    });

};

var checkMarkets = function () {
    console.log('checking markets...');
    var markets = $('div.event-page-betoffer');
    $.each(markets, function (i, ele) {
 ...