(function($){ $.fn.downAndUp = function(speed, waiting, repeat){ var elem = this; //alert('ss'); setTimeout(function() { elem.animate({ scrollTop: $(document).height() - $(window).height() }, speed, function() { setTimeout(function() { elem.animate({ scrollTop: 0 }, speed); }, waiting); }); }, waiting); } })(jQuery); window.reloadLivescore = function() { //$(".livescore").html(""); var request = $.ajax({ url: "https://www.epbf.com/extern/livescores_refresh.php", method: "POST", data: { refresh : true, layout: "full", category: "", tournamentId: "", eventId: "" }, dataType: "html" }); request.done(function( msg ) { $(".livescore").replaceWith( msg ); $(".status_icon .status_tooltip").tooltip('update'); $(".date .date_tooltip").tooltip('update'); $(".date .date_tooltip_mobile").tooltip('update'); initMatchDetails(); }); } var page_reload = 0; var stop_adding_matches = false; var layout = "full"; function getLivescores() { if(page_reload >= 120) { window.location.reload(); } //$.ajaxSetup({async: true}); $.post("https://www.epbf.com/extern/livescores.php", { livescore: true, category: '', tournamentId: '', eventId: '' }, function( data ) { //var status_text = ""; $.each( JSON.parse(data), function( i, values ) { //if(stop_adding_matches) return false; id = values['id']; /* Check if Game exists */ if( $("#game_" + id).length > 0 ) { score_changed = false; score_changed = true; $("#game_" + id).data("alive", true); $("#game_" + id + "_desc").data("alive", true); /* New Scores */ if( $("#game_" + id + " .score_a span").data("ascore") != values['aScore']) { if(layout == "small") { $("#game_" + id + " .score_a span").data("ascore", values['aScore']); $("#game_" + id + " .score_a span").html( values['aScore'] ); $("#game_" + id + " .score_a").stop().animate({backgroundColor: '#cacc00'}, 1500).delay(500).animate({backgroundColor: 'transparent'}, 3000).delay(500).animate({backgroundColor: '#cacc00'}, 1500).delay(500).animate({backgroundColor: 'transparent'}, 3000).delay(500).animate({backgroundColor: '#cacc00'}, 1500).delay(500).animate({backgroundColor: 'transparent'}, 10000); } else { $("#game_" + id + " .score_a span").data("ascore", values['aScore']); $("#game_" + id + " .score_a span").html( values['aScore'] ); $("#game_" + id + " .score_a").stop().animate({backgroundColor: '#cacc00'}, 1500).delay(1000).pulsate({ color: '#cacc00', reach: 20, speed: 1250, pause: 2500, glow: true, repeat: 5, onHover: false}).delay(5000).animate({backgroundColor: 'transparent'}, 10000); } score_changed = true; } if( $("#game_" + id + " .score_b span").data("bscore") != values['bScore']) { if(layout == "small") { $("#game_" + id + " .score_b span").data("bscore", values['bScore']); $("#game_" + id + " .score_b span").html( values['bScore'] ); $("#game_" + id + " .score_b").stop().animate({backgroundColor: '#cacc00'}, 1500).delay(500).animate({backgroundColor: 'transparent'}, 3000).delay(500).animate({backgroundColor: '#cacc00'}, 1500).delay(500).animate({backgroundColor: 'transparent'}, 3000).delay(500).animate({backgroundColor: '#cacc00'}, 1500).delay(500).animate({backgroundColor: 'transparent'}, 10000); } else { $("#game_" + id + " .score_b span").data("bscore", values['bScore']); $("#game_" + id + " .score_b span").html( values['bScore'] ); $("#game_" + id + " .score_b").stop().animate({backgroundColor: '#cacc00'}, 1500).delay(1000).pulsate({ color: '#cacc00', reach: 20, speed: 1250, pause: 2500, glow: true, repeat: 5, onHover: false}).delay(5000).animate({backgroundColor: 'transparent'}, 10000); } score_changed = true; } /* New Highlighting */ /* if( score_changed ) { if(values['aScore'] == values['bScore']) { $("#game_" + id + " .a_player, #game_" + id + " .score_a").removeClass("win"); $("#game_" + id + " .b_player, #game_" + id + " .score_b").removeClass("win"); } if(values['aScore'] > values['bScore']) { $("#game_" + id + " .a_player, #game_" + id + " .score_a").addClass("win"); $("#game_" + id + " .b_player, #game_" + id + " .score_b").removeClass("win"); } if(values['aScore'] < values['bScore']) { $("#game_" + id + " .a_player, #game_" + id + " .score_a").removeClass("win"); $("#game_" + id + " .b_player, #game_" + id + " .score_b").addClass("win"); } } */ /* Change Status */ if( $("#game_" + id + " .status_icon").data("status") != values['matchStatus']) { switch (values['matchStatus']) { case "READY": status = '