1//1 Mål 2//2 Selvmål 3//3 Straffe 4//4 Gult kort 5//5 Rødt kort 6//6 Udskiftning 7//7 Kamp start 8//8 1. halvleg slut 9//9 2. halvleg start 10//10 Kamp slut 11//11 Kamp afbrudt 12//12 Kamp genoptaget 13//13 Forlænget spilletid start 14//14 1. halvleg forl.spilletid slut 15//15 2. halvleg forl.spilletid start 16//16 Forlænget spilletid slut 17//17 Ordinær kamp slut 18//18 Kamp slut 19//19 2. gule kort = rød 20//20 Straffesparkskonkurrence(mål) 21//21 Straffesparkskonkurrence(brændt) 22//22 Straffesparkskonkurrence slut 23//23 Straffespark(Brændt) 24//24 Straffesparkskonkurrence start 25 26 27 28var intervalTimer_livescore; 29var intervalCounter_livescore = 0; 30var livescoreClubId = 0; 31var intervalTimer_getmatches = 0; 32var eventQueue = []; 33 34var nologoImagePath = "/content/img/nologo.png"; 35var noProfilePicPath = "/content/img/noProfilePic.png"; 36 37$(".ls_list").hide(); 38 39$(function () { 40 livescoreClubId = parseInt($(".livescoreModule").first().data("clubid")); 41 42 $(".ls_event").each(function () { 43 44 //$(this).data("created") 45 46 //var time = new moment($(this).data("created"), "MM/DD/YYYY HH:mm:ss.SSS"); 47 48 //$(this).data("created", time.format("DD-MM-YYYY HH:mm:ss.SSS")); 49 }); 50 51 $(document).on("click",".ls_match", function () { 52 if($(this).parents(".livescoreModule").length){ 53 var matchId = $(this).data("matchid"); 54 var teampoolid = $(this).data("teampoolid"); 55 window.location.href = "/kampvisning?matchid=" + matchI
55d + "&poolrowid=" + teampoolid; 56 } 57 }); 58 59 if ($(".matchPageCommentsWrap").length) { 60 $(".matchPageCommentsWrap .comment_sub").each(function () { 61 var comment = $(this); 62 var parentId = $(this).data("parent"); 63 $(".matchPageCommentsWrap li").each(function () { 64 var li = $(this); 65 if (parentId == li.data("commentid")) { 66 comment.detach().appendTo(li.find(".subcomments")); 67 } 68 }); 69 70 }); 71 } 72 73 74 if ($(".matchpage").length) { 75 if (!$(".matchpage").hasClass(".livescoreReciever")) { 76 $(".ls_loading").hide(); 77 $(".ls_list").fadeIn(); 78 $(".ls_isConnected").hide(); 79 } 80 } 81 82 showHideNoComments(); 83 calculateTime(); 84}); 85 86function connectionLost() { 87 $(".ls_isConnected").show(); 88} 89 90function connectionFailed() { 91 //$(".ls_loading").hide(); 92 $(".ls_list").fadeIn(); 93 $(".ls_isConnected").show(); 94 95 $(".ls_match").each(function () { 96 calculateScore($(this)); 97 }); 98 99 100 $(".livescoreModule .ls_match").each(function () { 101 if ($(this).find(".ls_event").first().hasClass("event_home")) { 102 $(this).find(".ls_events").addClass("event_home"); 103 } 104 if ($(this).find(".ls_event").first().hasClass("event_away")) { 105 $(this).find(".ls_events").addClass("event_away"); 106 } 107 }); 108 109 showHideLivescoreModule(); 110 showHideMatchesByCount(); 111 112 calculateTime(); 113 RunPackery(); 114}; 115 116function initLivescore() { 117 $(".ls_match").each(function () { 118 calculateScore($(this)); 119 }); 120 $(".ls_loading").hide(); 121 $(".ls_list").fadeIn(); 122 $(".ls_isConnected").hide(); 123 124 if ($(".livescoreReciever").length) { 125 intervalTimer_livescore = setInterval("checkQueue()", 200); 126 } 127 128 $(".livescoreModule .ls_match").each(function () { 129 if ($(this).find(".ls_event").first().hasClass("event_home")) { 130 $(this).find(".ls_events").addClass("event_home"); 131 } 132 if ($(this).find(".ls_event").first().hasClass("event_away")) { 133 $(this).find(".ls_events").addClass("event_away"); 134 } 135 }); 136 137 showHideLivescoreModule(); 138 showHideMatchesByCount(); 139 140 calculateTime(); 141 RunPackery(); 142 143 if ($(".livescoreReciever").length) { 144 intervalTimer_getmatches = setInterval("getMatches()", 1000); 145 } 146 147} 148 149function getMatches() { 150 intervalTimer_getmatches += 1000; 151 if (intervalCounter_livescore % 60000 === 0) { 152 retrieveMatchData(); 153 } 154} 155 156function checkQueue() 157{ 158 intervalCounter_livescore += 200; 159 160 if (intervalCounter_livescore % 1000 === 0) 161 { 162 calculateTime(); 163 jQuery("time.timeago").timeago(); 164 } 165 166 if (intervalCounter_livescore % 4000 === 0) 167 { 168 var event = eventQueue.shift(); 169 170 if(event != null){ 171 $(".ls_match").each(function () { 172 if ($(this).data("matchid") == event.MatchID && $(this).data("teampoolid") == event.PoolRowTournamentID) 173 { 174 if ($(this).closest(".ls_list").find(".ls_match").first().is($(this))){ 175 //$(this).find(".ls_event").first().effect("highlight", {}, 3000); 176 } 177 else { 178 var parent = $(this).closest(".ls_list"); 179 $(this).hide().detach().prependTo(parent).show().effect("highlight", {}, 3000); 180 } 181 182 //adding the new event 183 var eventContainer = $(this).find(".ls_events"); 184 var newEvent = $("<div>"); 185 newEvent.addClass("ls_event"); 186 var isAway = false; 187 var homeAwayClass = "event_neutral"; 188 if ($(this).find(".ls_homeTeam").data("teamid") == event.Team) { 189 homeAwayClass = "event_home"; 190 } 191 if ($(this).find(".ls_awayTeam").data("teamid") == event.Team) { 192 homeAwayClass = "event_away"; 193 isAway = true; 194 } 195 196 var time = new moment(event.InsertDateTime, "DD-MM-YYYY HH:mm:ss"); 197 //time.setHours(new Date(event.InsertDateTime).getHours() - 1); 198 newEvent.data("created", time.format("DD-MM-YYYY HH:mm:ss")); 199 200 newEvent.addClass("eventType_" + event.EventType); 201 202 eventContainer.removeClass("event_neutral").removeClass("event_home").removeClass("event_away").addClass(homeAwayClass); 203 newEvent.addClass(homeAwayClass); 204 newEvent.append("<span class='minute' data='" + event.Minute + "'>'" + event.Minute + ((event.ExtraMinute != null && event.ExtraMinute != 0) ? "<span>+" + event.ExtraMinute + "</span>" : "") + "</span>"); 205 var nameString = (event.Person_Name != null ? event.Person_Name : "Ukendt spiller"); 206 var subImg = ""; 207 if (event.EventType == 6) { 208 nameString = "<span class='subInName'>Ind: " + event.Person_2_Name + "</span><br/><span class='subOutName'>
208Ud: " + nameString + "</span><br/>"; 209 subImg = "<div class='ls_profilePic " + (event.EventType == 6 ? 'subIn' : '') + "'" + (event.Person_2_ProfileImage != null ? "style='background-image: url(" + event.Person_2_ProfileImage + ");'" : "") + "></div>"; 210 } 211 if (event.EventType >= 7 && event.EventType <= 18) 212 { 213 nameString = event.EventText; 214 } 215 216 nameString = (nameString == null ? "Ukendt spiller" : nameString); 217 218 if (event.EventType == 1) { 219 if (event.Person_2_Name != null && event.Person_2_Name != "Ukendt spiller") { 220 nameString = (nameString == null ? "Ukendt spiller" : nameString) + "<br/><span class='assist'>Assist: " + event.Person_2_Name + "</span>"; 221 } 222 } 223 224 if (event.EventType == 3) { 225 nameString += " (Straffe)"; 226 } 227 if (event.EventType == 2) { 228 nameString += " (Selvmål)"; 229 } 230 231 if (isAway) { 232 newEvent.append("<div class='eventWrap'>" + subImg + "<span class='name'>" + nameString + "</span> <div class='ls_profilePic " + (event.EventType == 6 ? 'subOut' : '') + "' style='" + (event.Person_1_ProfileImage != null ? "background-image: url(" + event.Person_1_ProfileImage + ");" : "") + "'></div> <div class='eventIcon eType_" + event.EventType + "'></div></div>"); 233 } 234 else { 235 newEvent.append("<div class='eventWrap'><div class='eventIcon eType_" + event.EventType + "'></div> <div class='ls_profilePic " + (event.EventType == 6 ? 'subOut' : '') + "' style='" + (event.Person_1_ProfileImage != null ? "background-image: url(" + event.Person_1_ProfileImage + ");" : "") + "'></div> <span class='name'>" + nameString + "</span> " + subImg + "</div>"); 236 } 237 238 eventContainer.prepend(newEvent); 239 if ($(this).closest(".livescoreModule").length) { 240 $(this).find(".ls_event").hide(); 241 } 242 showHideMatchesByCount(); 243 $(this).find(".ls_event").first().effect("highlight", {}, 4000); 244 calculateScore($(this).closest(".ls_match")); 245 calculateTime(); 246 } 247 }); 248 } 249 250 } 251} 252 253function eventDataRecieved(data) 254{ 255 var event = data; 256 eventQueue.push(event); 257} 258 259function matchdataRecieved(data) 260{ 261 var matches = data; 262 $(".ls_match").each(function () { 263 var matchID = $(this).data("matchid"); 264 var teampoolId = $(this).data("teampoolid"); 265 266 var matchFound = false; 267 $.each(data, function (key, match) { 268 if (match.Id == matchID && match.Pool.PoolId == teampoolId) { 269 matchFound = true; 270 } 271 }); 272 if (!matchFound) { 273 $(this).remove(); 274 } 275 }); 276 var matchesToAdd = []; 277 $.each(data, function (key, match) { 278 var matchFound = false; 279 $(".ls_match").each(function () { 280 if (match.Id == $(this).data("matchid") && match.Pool.PoolId == $(this).data("teampoolid")) { 281 matchFound = true; 282 } 283 }); 284 if (!matchFound) { 285 matchesToAdd.push(match); 286 } 287 }); 288 289 if (matchesToAdd.length > 0) { 290 $.each(matchesToAdd, function (key, match) { 291 addMatch(match); 292 }); 293 } 294} 295 296function addMatch(match) 297{ 298 var homeLogo = "<img class='clubLogo img_nologo' src='" + nologoImagePath + "' alt='ingen logo'/>"; 299 if (match.HomeTeam != null && match.HomeTeam.LogoUrl != null) { 300 homeLogo = "<img class='clubLogo' src='" + match.HomeTeam.LogoUrl + "' alt='hjemme logo'/>"; 301 } 302 var awayLogo = "<img class='clubLogo img_nologo' src='" + nologoImagePath + "' alt='ingen logo'/>"; 303 if (match.AwayTeam != null && match.AwayTeam.LogoUrl != null) { 304 awayLogo = "<img class='clubLogo' src='" + match.AwayTeam.LogoUrl + "' alt='ude logo'/>"; 305 } 306 var time = new moment(match.MatchDateTime, "DD-MM-YYYY HH:mm:ss.SSS"); 307 308 var matchDiv = ("<div class='ls_match' data-matchid='" + match.Id + "' data-teampoolid='" + match.Pool.PoolId + "' data-halftimelength='" + match.Halft
308imeLength + "' data-matchlengthordinary='" + match.MatchLengthOrdinary + "' data-extratimelength='" + match.ExtraTimeLength + "'>" + 309 "<div class='ls_hometeam_logobig' style='background-image:url(" + homeLogo + ")'></div><div class='ls_awayteam_logobig' style='background-image:url(" + awayLogo + ")'></div><div><span class='ls_poolRow'>" + match.Pool.RowName + " ⢠" + match.Pool.PoolName + "</span></div>" + 310 "<div class='ls_placeTimeInfo'><span class='ls_stadion'>" + match.StadiumName + "</span> <span class='ls_dateDay'><icon class='fa fa-calendar-o'/>" + time.format("DD-MM-YYYY") + "</span> <span class='ls_dateTime'><icon class='fa fa-clock-o'/>" + time.format("hh.mm") + "</span></div>" + 311 "<div class='ls_infoWrap'><div class='ls_homeTeam' data-teamid='"+ match.HomeTeam.Id+"'>" + 312 "<div class='logoWrap'>"+homeLogo+"</div>" + 313 "<span class='ls_teamName'>"+ match.HomeTeam.Name+"</span></div><div class='ls_score'><div class='score'><table><tbody><tr>" + 314 "<td><span class='homeScore'>0</span></td><td>-</td><td><span class='awayScore'>0</span></td></tr></tbody></table></div>" + 315 "<div class='ls_time'><i class='fa fa-clock-o'></i><span>'00</span></div></div><div class='ls_awayTeam' data-teamid='" + match.AwayTeam.Id + "'>" + 316 "<div class='logoWrap'>"+awayLogo+"</div>" + 317 "<span class='ls_teamName'>"+match.AwayTeam.Name+"</span></div></div><div class='ls_events'></div>" + 318 319 "<div class='ls_link' name='Se detaljeret live-score'><a href='/kampvisning?matchid=" + match.Id + "&poolrowid=" + match.Pool.PoolId + "'><img src='/resources/images/live.png' /></a></div></div>"); 320 321 $(".ls_list").append(matchDiv); 322 showHideLivescoreModule(); 323 showHideMatchesByCount(); 324 initToolTips(); 325} 326 327function retrieveMatchData() { 328 if($(".livescoreModule").length){ 329 $.ajax({
330 type: "GET", 331 url: "/umbraco/DBU/DBUFrontApi/GetCurrentLiveMatches", 332 success: function (returnData) { 333 matchdataRecieved(returnData); 334 } 335 }); 336 } 337} 338 339function retrieveComments() { 340 var matchid = $(".ls_match").data("matchid"); 341 var poolrowid = $(".ls_match").data("teampoolid"); 342 if ($(".matchPageCommentsWrap").length) { 343 $.ajax({ 344 type: "GET", 345 url: "/umbraco/DBU/DBUFrontApi/GetMatchComments", 346 data: { matchid: matchid, poolrowtournamentid: poolrowid }, 347 success: function (returnData) { 348 commentDataRevieved(returnData); 349 } 350 }); 351 } 352} 353 354function commentDataRevieved(data) { 355 var newComments = []; 356 $.each(data, function (key, comment) { 357 var found = false; 358 $(".matchPageCommentsWrap li").each(function () { 359 if (comment.Id == $(this).data("commentid")) { 360 found = true; 361 } 362 }); 363 $(".matchPageCommentsWrap .comment_sub").each(function () { 364 if (comment.Id == $(this).data("commentid")) { 365 found = true; 366 } 367 }); 368 if (!found) { 369 newComments.push(comment); 370 } 371 }); 372 373 $.each(newComments, function (key, comment) { 374 addComment(comment); 375 }); 376} 377 378function addComment(comment) { 379 var time = new moment(comment.Created, "YYYY-MM-DD HH:mm:ss.SSS"); 380 381 if (comment.MatchLiveScoreCommentId != 0) { 382 383 384 var parent = $(".matchPageCommentsWrap li[data-commentid='" + comment.MatchLiveScoreCommentId + "']"); 385 386 var newComment = "<div style='display:none;' class='comment_sub' data-commentid='" + comment.Id + "' data-parent='" + comment.MatchLiveScoreCommentId + "'>" 387 + "<div class='comment_user'><span>" + comment.UserDisplayName + "</span></div>" 388 + "<div class='comment_userImgWrap'>" + (comment.UserImageUrl != null ? "<img src='" + comment.UserImageUrl + "'/>" : "<img src='/resources/images/livescore/profilepic.png'/>") + "</div>" 389 + "<div class='comment_text'>" + (comment.ImageUrl != null ? "<div class='comment_image'><img src='" + comment.ImageUrl + "'/></div>" : "") 390 + "<span>" + comment.Comment + "</span></div>" 391 + "<div class='comment_time'><icon class='fa fa-clock-o'></icon><time class='timeago' datetime='" + time.format("YYYY-MM-DD HH:mm:ss") + "'></time></div></div>"; 392 //todo - add sub-comment to parent comment 393 parent.find(".subcomments").append(newComment).find("div.comment_sub").last().show('bounce', 800); 394 } 395 else { 396 397 var newComment = "<li style='display:none;' data-commentid='" + comment.Id + "'>" 398 + "<div class='comment_user'><span>" + comment.UserDisplayName + "</span></div>" 399 + "<div class='comment_userImgWrap'>" + (comment.UserImageUrl != null ? "<img src='" + comment.UserImageUrl + "'/>" : "<img src='/resources/images/livescore/profilepic.png'/>") + "</div>" 400 + "<div class='comment_text'>" + (comment.ImageUrl != null ? "<div class='comment_image'><img src='" + comment.ImageUrl + "'/></div>" : "") 401 + "<span>" + comment.Comment + "</span>" 402 + "</div>" 403 + "<div class='comment_time'><icon class='fa fa-clock-o'></icon><time class='timeago' datetime='" + time.format("YYYY-MM-DD HH:mm:ss") + "'></time></div><div class='subcomments'></div></li>"; 404 $(".matchPageCommentsWrap ul").prepend(newComment).find("li").first().show('bounce', 800); 405 } 406 407 if (comment.ImageUrl != null) {
408 $(".matchImages").prepend("<a href='" + comment.ImageUrl + "'><div style='background-image:url(" + comment.ImageUrl + "); display:none;' class='matchPage_galleryImage'></div></a>").find(".matchPage_galleryImage").first().show("drop"); 409 setupGalleries(); 410 } 411 showHideNoComments(); 412 jQuery("time.timeago").timeago(); 413} 414 415function showHideMatchesByCount() 416{ 417 $(".livescoreModule").each(function () { 418 var maxCount = $(this).data("maxcount"); 419 if (maxCount != 0) { 420 $(this).find(".ls_match").hide(); 421 $(this).find(".ls_match:lt(" + maxCount + ")").show(); 422 423 } 424 }); 425} 426 427function showHideLivescoreModule() { 428 $(".livescoreModule").each(function () { 429 var hideIfEmpty = $(this).data("hideempty"); 430 if ($(this).find(".ls_match").length == 0 && hideIfEmpty == "True") { 431 $(this).hide(); 432 } 433 else if ($(this).find(".ls_match").length == 0 && hideIfEmpty == "False") { 434 $(this).show().find(".noMatches").show(); 435 } 436 else if($(this).find(".ls_match").length > 0){ 437 $(this).show().find(".noMatches").hide(); 438 } 439 440 441 }); 442} 443 444function showHideNoComments() { 445 if ($(".comments_wrap ul li").length == 0) { 446 $(".noMatchComms").show(); 447 } 448 else { 449 $(".noMatchComms").hide(); 450 } 451 if ($(".matchPage_galleryImage").length == 0) { 452 $(".noMatchImgs").show(); 453 } 454 else { 455 $(".noMatchImgs").hide(); 456 } 457} 458 459function calculateScore(item) 460{ 461 var homeScore = 0; 462 var awayScore = 0; 463 464 homeScore = item.find(".ls_event.event_home.eventType_1").length; 465 awayScore = item.find(".ls_event.event_away.eventType_1").length; 466 467 homeScore += item.find(".ls_event.event_home.eventType_2").length; 468 awayScore += item.find(".event_away.eventType_2").length; 469 470 homeScore += item.find(".ls_event.event_home.eventType_3").length; 471 awayScore += item.find(".ls_event.event_away.eventType_3").length; 472 473 item.find(".homeScore").html(homeScore); 474 item.find(".awayScore").html(awayScore); 475 476} 477 478function calculateHeight(item) { 479 var newHeight = $(item).height() + $(item).closest(".livescoreModule").find(".theme_header").height(); 480 $(item).closest(".livescoreModule").height(newHeight); 481 RunPackery(); 482} 483 484function calculateTime() { 485 $(".livescoreReciever").each(function () { 486 var module = $(this); 487 $(module).find(".ls_match").each(function () { 488 var match = $(this); 489 if (match.find(".ls_event").length == 0) { 490 match.find(".ls_time span").addClass("textOnly").html("Ikke påbegyndt"); 491 } 492 493 //hvis ikke kampen er slut 494 if (match.find(".eventType_18").length == 0 && match.find(".eventType_10").length == 0) { 495 496 var halftimelength = parseInt(match.data("halftimelength")); 497 var matchlengthordinary = parseInt(match.data("matchlengthordinary")); 498 var extratimelength = parseInt(match.data("extratimelength")); 499 500 var breaksDiff = 0; 501 502 var currentHalf = 0; 503 504 if (match.find(".eventType_7").length >= 1) { 505 currentHalf = 1; 506 match.find(".ls_period").html("1. halvleg"); 507 } 508 if (match.find(".eventType_8").length >= 1) { 509 currentHalf = 1; 510 match.find(".ls_period").html("1. halvleg slut"); 511 } 512 if (match.find(".eventType_9").length >= 1) { 513 currentHalf = 2; 514 match.find(".ls_period").html("2. halvleg"); 515 } 516 if (match.find(".eventType_13").length >= 1) { 517 currentHalf = 3; 518 match.find(".ls_period").html("1. halvleg af forl. spilletid"); 519 } 520 if (match.find(".eventType_15").length >= 1) { 521 currentHalf = 4; 522 match.find(".ls_period").html("2. halvleg af forl. spilletid"); 523 } 524 525 match.find(".ls_event").each(function () { 526 _event = $(this); 527 var startOfHalfFound = false; 528 if (!startOfHalfFound) { 529 530 if (_event.hasClass("eventType_7") || _event.hasClass("eventType_9") || _event.hasClass("eventType_13") || _event.hasClass("eventType_15")) { 531 startOfHalfFound = true; 532 } 533 else if (_event.hasClass("eventType_12")) { 534 var breakStartTime = new moment(_event.nextAll(".eventType_11").first().data("created"), "DD-MM-YYYY HH:mm:ss.SSS"); 535 var breakEndTime = new moment(_event.data("created"), "DD-MM-YYYY HH:mm:ss.SSS"); 536 breaksDiff += (breakEndTime.diff(breakStartTime, "seconds")/60); 537 } 538 } 539 }); 540
541 breaksDiff = Math.ceil(breaksDiff); 542 543 var latestEvent = match.find(".ls_event").first(); 544 var gamePausedOrEnded = false; 545 if (latestEvent.is(".eventType_8, .eventType_10, .eventType_11, .eventType_14, .eventType_16, .eventType_17") || latestEvent.length == 0) 546 { 547 gamePausedOrEnded = true; 548 match.find(".ls_time").removeClass("running"); 549 } else { 550 match.find(".ls_time").addClass("running"); 551 } 552 if (!gamePausedOrEnded) 553 { 554 555 var currentMinute = 0; 556 var minuteOverTime = 0; 557 558 var _serverTime = GetServerTime(); 559 560 var timeNow = new moment(_serverTime, "DD-MM-YYYY HH:mm:ss.SSS"); 561 562 if (currentHalf == 1) { 563 564 var firstHalfStartTime = new moment(match.find(".eventType_7").data("created"), "DD-MM-YYYY HH:mm:ss.SSS"); 565 var difference = timeNow.diff(firstHalfStartTime, "minutes"); 566 if (difference > halftimelength) { 567 currentMinute = halftimelength; 568 minuteOverTime = difference - halftimelength + 1 - breaksDiff; 569 } 570 else { 571 currentMinute = (difference + 1 - breaksDiff); 572 } 573 } 574 if (currentHalf == 2) { 575 var secondHalfStartTime = new moment(match.find(".eventType_9").data("created"), "DD-MM-YYYY HH:mm:ss.SSS"); 576 var difference = timeNow.diff(secondHalfStartTime, "minutes"); 577 if (difference > halftimelength) { 578 currentMinute = matchlengthordinary; 579 minuteOverTime = difference + 1 - halftimelength - breaksDiff; 580 } 581 else { 582 currentMinute = difference + 1 + halftimelength - breaksDiff; 583 } 584 } 585 if (currentHalf == 3) { 586 var firstExtraHalfStartTime = new moment(match.find(".eventType_13").data("created"), "DD-MM-YYYY HH:mm:ss.SSS"); 587 var difference = timeNow.diff(firstExtraHalfStartTime, "minutes"); 588 if (difference > (extratimelength/2)) { 589 currentMinute = (matchlengthordinary + extratimelength / 2); 590 minuteOverTime = (difference + 1 - (extratimelength / 2) - breaksDiff); 591 } 592 else { 593 currentMinute = (matchlengthordinary + difference + 1 - (extratimelength / 2) - breaksDiff); 594 } 595 } 596 if (currentHalf == 4) { 597 var secExtraHalfStartTime = new moment(match.find(".eventType_15").data("created"), "DD-MM-YYYY HH:mm:ss.SSS"); 598 var difference = timeNow.diff(secExtraHalfStartTime, "minutes"); 599 if (difference > (extratimelength/2)) { 600 currentMinute = matchlengthordinary + extratimelength; 601 minuteOverTime = (difference + 1 - (extratimelength / 2) - breaksDiff); 602 } 603 else { 604 currentMinute = (matchlengthordinary + difference + 1 + (extratimelength / 2) - breaksDiff); 605 } 606 } 607 if (currentMinute != 0) { 608 match.find(".ls_time span").removeClass("textOnly").html("'" + currentMinute + (minuteOverTime == 0 ? "" : " +" + minuteOverTime)); 609 } 610 if (currentMinute == 0) { 611 match.find(".ls_time span").removeClass("textOnly").html("'00"); 612 } 613 match.find(".ls_dateDay,.ls_dateTime").hide(); 614 } 615 else { 616 var currentMinute = 0; 617 var minuteOverTime = 0; 618 if (latestEvent.is(".eventType_8")) { 619 var firstHalfStartTime = new moment(match.find(".eventType_7").data("created"), "DD-MM-YYYY HH:mm:ss.SSS"); 620 var firstHalfEndTime = new moment(match.find(".eventType_8").data("created"), "DD-MM-YYYY HH:mm:ss.SSS"); 621 var difference = firstHalfEndTime.diff(firstHalfStartTime, "minutes"); 622 if (difference > halftimelength) { 623 currentMinute = halftimelength; 624 minuteOverTime = (difference - halftimelength + 1 - breaksDiff); 625 } 626 else { 627 currentMinute = (difference + 1 - breaksDiff); 628 } 629 if (currentMinute != 0) { 630 match.find(".ls_time span").removeClass("textOnly").html("'" + currentMinute + (minuteOverTime == 0 ? "" : " +" + minuteOverTime)); 631 } 632 } 633 634 match.find(".ls_dateDay,.ls_dateTime").show(); 635 } 636 637 638 } else { 639 match.find(".ls_time span").html("Færdigspillet"); 640 //gamePausedOrEnded = true; 641 match.find(".ls_time").removeClass("running"); 642 match.find(".ls_link").find("img").attr("src", "/resources/images/kampfakta.png"); 643 } 644 }); 645 });
646} 647 648var serverTime; 649 650function GetServerTime() { 651 652 //if (serverTime == null) { 653 654 $.ajax({ 655 async:false, 656 url: "/umbraco/DBU/DBUFrontApi/GetServerTime", 657 success: function (response) { 658 serverTime = response; 659 660 } 661 }); 662 //} 663 return serverTime; 664}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.