(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 = '
'; status_text = 'Ready'; break; case "RUNNING": status = '
'; status_text = 'Running'; break; case "FINISHED": status = '
'; status_text = 'Finished'; break; case "APPROVED": status = '
'; status_text = 'Approved'; break; case "NONE": status = '
'; status_text = 'Approved'; break; case "TIMEOUT": status = ''; status_text = 'Timeout'; break; } $("#game_" + id + " .status_icon").data("status", values['matchStatus']); $("#game_" + id + " .status_icon .status_tooltip").data("originaltitle", status_text); $("#game_" + id + " .status_icon .status_tooltip").prop("title", status_text); $("#game_" + id + " .status_icon .status_tooltip").tooltip('dispose'); $("#game_" + id + " .status_icon .status_tooltip").tooltip('update'); $("#game_" + id + " .status_icon span").html(status); /* $("#game_" + id + " .status_icon").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); */ $("#game_" + id + "_desc .status_icon").data("status", values['matchStatus']); $("#game_" + id + "_desc .status_icon .status_tooltip").data("originaltitle", status_text); $("#game_" + id + "_desc .status_icon .status_tooltip").prop("title", status_text); $("#game_" + id + "_desc .status_icon .status_tooltip").tooltip('dispose'); $("#game_" + id + "_desc .status_icon .status_tooltip").tooltip('update'); $("#game_" + id + "_desc .status_icon span").html(status); status = ""; status_text = ""; score_changed = false; } } else { } }); /* Delete games */ $.each( $(".single_game,.single_game_desc"), function() { if( $(this).data("alive") == false ) { /* console.log("Delete game: " + $(this).prop("id") ); */ $(this).remove(); $(".livescore_table tr:visible").each(function (index) { $(this).css("background-color", !!(index & 1)? "#0b69b3" : "rgba(0, 85, 158, 1)"); }); } $(this).data("alive", false); }); }); //$.ajaxSetup({async: false}); page_reload++; } result = getLivescores();