var excludeMobileRedirect = ["/fifaworldcup/organisation/ticketing/", "/worldcup/organisation/ticketing/"];;(function () { 'use strict'; var module = angular.module('matchDataManage', []); var matchDataManage = (function () { var _hasLineup = function (match) { if (!match) { return false; } return (match.hasLineup && !match.isLive && !match.isFinished && !match.isAbandoned); }; return { isLive: function (match) { if (!match) { return false; } return match.isLive || _hasLineup(match); }, hasLineup: function (match) { return _hasLineup(match); }, /* Format Minute + Extension Time + Phase Label */ matchMinuteFormat: function (match, liveMatchData, $scope) { if (!liveMatchData) { liveMatchData = match; } switch (liveMatchData.phaseCode) { case '1': /*FirstHalf*/ if (liveMatchData.minute > 45 || liveMatchData.minuteExtra > 0) { match.minuteFormatted = 45; match.showext = true; } else { match.minuteFormatted = liveMatchData.minute; match.showext = false; } break; case 'H': case '2': /*HalfTime*/ if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.halfTimeLabelAbbr; } else { match.minuteFormatted = $scope.halfTimeLabel; } match.showext = false; break; case '4': /*SecondHalf*/ if (liveMatchData.minute > 90 || liveMatchData.minuteExtra > 0) { match.minuteFormatted = 90; match.showext = true; } else { match.minuteFormatted = liveMatchData.minute; match.showext = false; } break; case '5': /*End SecondHalf*/ if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.endSecondHalfLabelAbbr; } else { match.minuteFormatted = $scope.endSecondHalfLabel; } match.showext = false; break; case '6': /*Fist Extra*/ if (liveMatchData.minute > 105 || liveMatchData.minuteExtra > 0) { match.minuteFormatted = 105; match.showext = true; } else { match.minuteFormatted = liveMatchData.minute; match.showext = false; } break; case '7': /*End Fist Extra*/ if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.endFirstExtraLabelAbbr; } else { match.minuteFormatted = $scope.endFirstExtraLabel; } match.showext = false; break; case '8': /*Second Extra*/ if (liveMatchData.minute > 120 || liveMatchData.minuteExtra > 0) { match.minuteFormatted = 120; match.showext = true; } else { match.minuteFormatted = liveMatchData.minute; match.showext = false; } break; case '9': /*End Second Extra*/ if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.endSecondExtraLabelAbbr; } else { match.minuteFormatted = $scope.endSecondExtraLabel; } match.showext = false; break; case 'A': /* PSO*/ if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.penaltyLabelAbbr; } else { match.minuteFormatted = $scope.penaltyLabel; } match.showext = false; break; } }, /* Manage Reason Win Text Translate and Replace placeholder */ matchReasonWinSet: function (match, liveMatchData, $scope) { if (!liveMatchData) { liveMatchData = match; } var tag = 'fifa.winningReason_' + liveMatchData.reasonWinCode; var text = ''; var textAbbr = ''; textAbbr = fifa.vocManager.translateAbbr(tag); text = fifa.vocManager.translate(tag); textAbbr = textAbbr.replace('{ScorePenH}', liveMatchData.scorePenaltyHome); textAbbr = textAbbr.replace('{ScorePenA}', liveMatchData.scorePenaltyAway); textAbbr = textAbbr.replace('{ScoreAggH}', liveMatchData.scoreAggregateHome); textAbbr = textAbbr.replace('{ScoreAggA}', liveMatchData.scoreAggregateAway); textAbbr = textAbbr.replace('{WinTeamName}', liveMatchData.winTeamName); textAbbr = textAbbr.replace('{WinTeamCountry}', liveMatchData.winTeamShortName); text = text.replace('{ScorePenH}', liveMatchData.scorePenaltyHome); text = text.replace('{ScorePenA}', liveMatchData.scorePenaltyAway); text = text.replace('{ScoreAggH}', liveMatchData.scoreAggregateHome); text = text.replace('{ScoreAggA}', liveMatchData.scoreAggregateAway); text = text.replace('{WinTeamName}', liveMatchData.winTeamName); text = text.replace('{WinTeamCountry}', liveMatchData.winTeamShortName); match.winReasonTextAbbr = textAbbr; match.winReasonText = text; }, matchDataCreate: function (match, $scope) { this.dateManage(match); if (match.isLive) { match.status = 3; this.matchMinuteFormat(match, null, $scope); } if (match.isFinished) { match.status = 0; match.showext = false; if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.fullTimeLabelAbbr; } else { match.minuteFormatted = $scope.fullTimeLabel; } if (match.reasonWinCode != null) { this.matchReasonWinSet(match, null, $scope); } } if (!match.isFinished && !match.isLive && match.hasLineup) { match.status = 1; if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.lineupLabelAbbr; } else { match.minuteFormatted = $scope.lineupLabel; } } if (match.isFinished && match.winnerTeamId != null) { if (match.winnerTeamId == match.idHomeTeam) { match.winTeamName = match.homeTeamName; match.winTeamShortName = match.homeTeamName; } if (match.winnerTeamId == match.idAwayTeam) { match.winTeamName = match.AwayTeamName; match.winTeamShortName = match.AwayTeamName; } } if (match.isAbandoned) { match.status = 1; if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.abandonedLabelAbbr; } else { match.minuteFormatted = $scope.abandonedLabel; } } if (match.isAwarded) { match.status = 1; if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.forfeitedLabelAbbr; } else { match.minuteFormatted = $scope.forfeitedLabel; } } }, dateManage: function (match) { var date = new Date(Date.parse(match.matchDate)); var monthNum = date.getMonth() + 1; var dayNum = date.getDate(); var yearNum = date.getFullYear(); var monthText = fifa.vocManager.translateAbbr('fifa.month_' + monthNum); match.dayName = fifa.vocManager.translate('fifa.dayOfWeek_' + date.getDay()); match.fullDateFormatted = dayNum + ' ' + monthText + ' ' + yearNum; match.dayNum = dayNum; match.monthNum = monthNum; match.daymonth = dayNum + '' + monthNum; var clientDt = new Date(match.matchDateUTC); if (match.kickOffTime && !isNaN(clientDt.getTime())) { match.kickOffTime = [clientDt.getHours().twoDigits(), clientDt.getMinutes().twoDigits()].join(':'); match.fullDateTimeFormatted = match.fullDateFormatted + ' ' + match.kickOffTime; } else { match.kickOffTime = '-:-'; match.fullDateTimeFormatted = match.fullDateFormatted; } }, getTeamImage: function (team, type, size, cupKindId, continentalIdCup) { if (team) { switch (type) { case "nationalteam": return fifa.extensions.getTeamFlag(team, size); case "club": return fifa.extensions.getClubLogo(team, size); case "competition": if (cupKindId && cupKindId == 102) { return fifa.extensions.getContinentalLogo(team, continentalIdCup, size); } else { return fifa.extensions.getCompetitionLogo(team, size); } } } }, /* Match Info Live Data Merge */ LiveMatchDataMerge: function (matchData, liveMatchData, $scope) { if (!liveMatchData) { liveMatchData = matchData; } matchData.isLive = liveMatchData.isLive; matchData.hasLineup = liveMatchData.hasLineup; matchData.isFinished = liveMatchData.isFinished; matchData.isSuspended = liveMatchData.isSuspended; matchData.isAbandoned = liveMatchData.isAbandoned; if (_hasLineup(liveMatchData)) { $scope.showLineupLabel = true; } if (liveMatchData.isLive) { matchData.status = 3; this.matchMinuteFormat(matchData, liveMatchData, $scope); matchData.scoreHome = liveMatchData.scoreHome; matchData.scoreAway = liveMatchData.scoreAway; } if (liveMatchData.isFinished) { matchData.status = 0; matchData.showext = false; if ($scope.locals && $scope.locals.isMobile) { matchData.minuteFormatted = $scope.fullTimeLabelAbbr; } else { matchData.minuteFormatted = $scope.fullTimeLabel; } matchData.scoreHome = liveMatchData.scoreHome; matchData.scoreAway = liveMatchData.scoreAway; matchData.reasonWinCode = liveMatchData.reasonWinCode; matchData.scorePenaltyHome = liveMatchData.scorePenaltyHome; matchData.scorePenaltyAway = liveMatchData.scorePenaltyAway; matchData.scoreAggregateHome = liveMatchData.scoreAggregateHome; matchData.scoreAggregateAway = liveMatchData.scoreAggregateAway; matchData.winnerTeamId = liveMatchData.winnerTeamId; if (liveMatchData.winnerTeamId != null) { if (liveMatchData.winnerTeamId == liveMatchData.idHomeTeam) { matchData.winTeamName = liveMatchData.homeTeamName; matchData.winTeamShortName = liveMatchData.homeTeamName; } if (liveMatchData.winnerTeamId == liveMatchData.idAwayTeam) { matchData.winTeamName = liveMatchData.AwayTeamName; matchData.winTeamShortName = liveMatchData.AwayTeamName; } } if (liveMatchData.reasonWinCode != null) { this.matchReasonWinSet(matchData, liveMatchData, $scope); } } }, getCompetitionImageClass: function (comp) { var cupKindID = comp.cupKindID; if (!comp.isFifaCompetition && cupKindID !== 111 && cupKindID !== 102 && cupKindID !== 103) { return "flag-national-league"; } else if (cupKindID === 111 || cupKindID === 103 || cupKindID === 102) { return "logo-competition"; } else if (comp.isFifaCompetition) { return "logo-fifa-competition"; } }, getCompetitionImagePath: function (comp, size) { var cupKindID = comp.cupKindID, idCup = comp.idCup; if (!comp.isFifaCompetition && cupKindID !== 111 && cupKindID !== 102 && cupKindID !== 103) { return fifa.extensions.getTeamFlag(comp.countryCode, size); } else if (cupKindID === 111 || cupKindID === 103 || cupKindID === 102) { if (cupKindID === 102 || cupKindID === 103) { return fifa.extensions.getContinentalLogo(idCup, comp.idCupSeason, size); } else { return fifa.extensions.getCompetitionLogo(idCup, size); } } else if (comp.isFifaCompetition) { if (cupKindID === 105) { return fifa.extensions.getFriendliesLogo(); } else { if (cupKindID === 101 && idCup !== 520) { return ''; } else { return fifa.extensions.getTournamentLogo(idCup, comp.edition); } } } }, checkFifaGenericImage: function (url) { if (url && url.split('/')[url.split('/').length - 1] == 'generic.png') { return 'generic-image'; } }, winReasonText: function (match) { var tag = 'fifa.winningReason_' + match.reasonWinCode; var text = fifa.vocManager.translate(tag); text = text.replace('{ScorePenH}', match.scorePenaltyHome); text = text.replace('{ScorePenA}', match.scorePenaltyAway); text = text.replace('{ScoreAggH}', match.scoreAggregateHome); text = text.replace('{ScoreAggA}', match.scoreAggregateAway); text = text.replace('{WinTeamName}', match.winTeamName); text = text.replace('{WinTeamCountry}', match.winTeamShortName); return text; }, winReasonTextAbbr: function (match) { var tag = 'fifa.winningReason_' + match.reasonWinCode; var text = fifa.vocManager.translateAbbr(tag); text = text.replace('{ScorePenH}', match.scorePenaltyHome); text = text.replace('{ScorePenA}', match.scorePenaltyAway); text = text.replace('{ScoreAggH}', match.scoreAggregateHome); text = text.replace('{ScoreAggA}', match.scoreAggregateAway); text = text.replace('{WinTeamName}', match.winTeamName); text = text.replace('{WinTeamCountry}', match.winTeamShortName); return text; }, hasDifferentDataFromLiveData: function (match, liveData, comp, compLiveData) { if (match.isLive != liveData.isLive) { return true; } if (match.isFinished != liveData.isFinished) { return true; } if (match.scoreHome != liveData.scoreHome) { return true; } if (match.idWinTeam != liveData.winnerTeamId) { return true; } if (match.reasonWinCode != liveData.reasonWinCode) { return true; } if (match.scorePenaltyHome != liveData.scorePenaltyHome) { return true; } if (match.scorePenaltyAway != liveData.scorePenaltyAway) { return true; } if (match.scoreAggregateHome != liveData.scoreAggregateHome) { return true; } if (match.scoreAggregateAway != liveData.scoreAggregateAway) { return true; } if (match.scoreHomeFirstLeg != liveData.scoreHomeFirstLeg) { return true; } if (match.scoreAwayFirstLeg != liveData.scoreAwayFirstLeg) { return true; } if (comp.hasMatchLive != compLiveData.hasMatchLive) { return true; } return false; }, setGoalHighlightTimeout: function (match) { setTimeout(function () { localStorage.removeItem("ls-hl-" + match.idMatch); }, 60000); }, setGoalHighlight: function (match, liveData) { var highlightDirection = ""; var _this = this; if ((liveData.scoreHome > 0) && (liveData.scoreHome !== match.scoreHome)) { highlightDirection = "home"; } else if ((liveData.scoreAway > 0) && (liveData.scoreAway !== match.scoreAway)) { highlightDirection = "away"; } if (highlightDirection) { match.goalHighlight = highlightDirection; localStorage.setItem("ls-hl-" + match.idMatch, "true"); _this.setGoalHighlightTimeout(match); } }, mapLiveData: function (match, liveData, $scope, comp, compLiveData) { match.isLive = liveData.isLive; match.isFinished = liveData.isFinished; if (liveData.competitionId !== 106) { match.isSuspended = liveData.isSuspended; } match.isAbandoned = liveData.isAbandoned; comp.hasMatchLive = compLiveData.hasMatchLive; if (!localStorage.getItem("ls-hl-" + match.idMatch)) { delete match.goalHighlight; } if (liveData.isLive) { match.status = 3; $scope.minute(match, liveData, $scope); if ($scope.checkHighlight) { this.setGoalHighlight(match, liveData); } match.scoreHome = liveData.scoreHome; match.scoreAway = liveData.scoreAway; } if (liveData.isFinished && match.status == 3) { match.status = 0; match.showext = false; match.minuteFormatted = $scope.fullTimeLabel; match.scoreHome = liveData.scoreHome; match.scoreAway = liveData.scoreAway; if (!$scope.callLoadFavourites) { $scope.callLoadFavourites = true; } } match.hasLineup = liveData.hasLineup; if (match.status == 0 && liveData.winnerTeamId != null) { match.idWinTeam = liveData.winnerTeamId; } if (liveData.reasonWinCode != null && match.status == 0) { if (match.reasonWinCode !== liveData.reasonWinCode) { match.reasonWinCode = liveData.reasonWinCode; match.scorePenaltyHome = liveData.scorePenaltyHome; match.scorePenaltyAway = liveData.scorePenaltyAway; match.scoreAggregateHome = liveData.scoreAggregateHome; match.scoreAggregateAway = liveData.scoreAggregateAway; match.scoreHomeFirstLeg = liveData.scoreHomeFirstLeg; match.scoreAwayFirstLeg = liveData.scoreAwayFirstLeg; } if (liveData.winnerTeamId != null && liveData.winnerTeamId == match.idHomeTeam) { match.winTeamName = match.homeTeamName; match.winTeamShortName = match.homeTeamName; } if (liveData.winnerTeamId != null && liveData.winnerTeamId == match.idAwayTeam) { match.winTeamName = match.awayTeamName; match.winTeamShortName = match.awayTeamName; } } }, updateDataLive: function ($scope) { var _matchUpdate = false; angular.forEach($scope.competitions.competitionslist, function (comp, key) { if (comp != null && $scope.livematches[comp.idCupSeason]) { var matchlist = $scope.livematches[comp.idCupSeason].matchlist; var compLiveData = $scope.livematches[comp.idCupSeason]; angular.forEach(matchlist, function (liveData, key) { angular.forEach(comp.matchlist, function (match, key) { if (match.idMatch == liveData.id) { $scope.mapLiveData(match, liveData, $scope, comp, compLiveData); if (_matchUpdate) { $scope.hasDifferentDataFromLiveData(match, liveData, comp, compLiveData); } } }); }); if (($scope.filteredCompetitions || []).length > 0) { angular.forEach($scope.filteredCompetitions, function (compfiltered, key) { if (compfiltered.idCupSeason == comp.idCupSeason) { compfiltered.hasMatchLive = comp.hasMatchLive; } }); } } }); if ($scope.callLoadFavourites) { $scope.forceReloadFavourites(); } if (_matchUpdate) { fifa.dispatcher.trigger('analytics:customPageView', { dataupdates: true }); } }, minute: function (match, liveData, $scope) { switch (liveData.phaseCode) { case '1': /*FirstHalf*/ if (liveData.minute > 45 || liveData.minuteExtra > 0) { match.minuteFormatted = 45; match.showext = true; } else { match.minuteFormatted = liveData.minute; match.showext = false; } break; case 'H': case '2': /*HalfTime*/ match.minuteFormatted = $scope.halfTimeLabel; match.showext = false; break; case '4': /*SecondHalf*/ if (liveData.minute > 90 || liveData.minuteExtra > 0) { match.minuteFormatted = 90; match.showext = true; } else { match.minuteFormatted = liveData.minute; match.showext = false; } break; case '5': /*End SecondHalf*/ match.minuteFormatted = $scope.endSecondHalfLabel; match.showext = false; break; case '6': /*Fist Extra*/ if (liveData.minute > 105 || liveData.minuteExtra > 0) { match.minuteFormatted = 105; match.showext = true; } else { match.minuteFormatted = liveData.minute; match.showext = false; } break; case '7': /*End Fist Extra*/ match.minuteFormatted = $scope.endFirstExtraLabel; match.showext = false; break; case '8': /*Second Extra*/ if (liveData.minute > 120 || liveData.minuteExtra > 0) { match.minuteFormatted = 120; match.showext = true; } else { match.minuteFormatted = liveData.minute; match.showext = false; } break; case '9': /*End Second Extra*/ match.minuteFormatted = $scope.endSecondExtraLabel; match.showext = false; break; case 'A': /* PSO*/ match.minuteFormatted = $scope.penaltyLabel; match.showext = false; break; } }, getFilteredScorerGoalsEvents: function (scorer, teamId) { var _filtered_events_goals = _.filter(scorer.events, function (evt) { if (evt.eventCode == 3 && (scorer.teamID == teamId && evt.subKindCode != 'O') || (scorer.teamID != teamId && evt.subKindCode == 'O')) { return evt; } }); return _filtered_events_goals; } }; }()); var matchListManage = { fillMatchList: function ($scope, data) { $scope.matchList = data; } } /* Expose the library in a factory*/ module.factory('matchDataManage', function () { return matchDataManage; }); module.factory('matchListManage', function () { return matchListManage; }); }()); ;(function () { 'use strict'; var module = angular.module('middlewareCalls', []); var mockType = ""; if (localStorage.getItem("useMock") == "true") { mockType = "/mock"; } var host = window.location.host, _lang = "en", _localDate = new Date(), _timeshift = _localDate.getTimezoneOffset() * -1, _localDateMidnight = new Date(Date.UTC(_localDate.getFullYear(), _localDate.getMonth(), _localDate.getDate())), _middlewareBaseUrl = (host.indexOf('localhost') !== -1) ? 'http://localhost:1337' : '//data.fifa.com'; var middlewareMatchCalls = { lang: "en", localDate: new Date(), middlewareBaseUrl: (host.indexOf('localhost') !== -1) ? 'http://localhost:1337' : '//data.fifa.com', getClosestMatches: function (successCallback, idmatch, $http) { window._closestMatchesCallback = successCallback; $http.jsonp(this.middlewareBaseUrl + '/matches/' + this.lang + '/closest/' + idmatch, null); }, getTeamMatches: function (successCallback, idteam, count, $http) { window._teamMatchesCallback = successCallback; $http.jsonp(this.middlewareBaseUrl + '/matches/' + this.lang + '/byteam/' + idteam + '/' + count, null); }, getTeamMatchesPrevNext: function (successCallback, idteam, $http) { window._teamMatchesPrevNextCallback = successCallback; var middleWareUrl = this.middlewareBaseUrl + '/matches/' + this.lang + '/byteam/prevnext/' + idteam; $http.jsonp(middleWareUrl, null); }, getPlayingCompetitions: function (successCallback, idteam, $http) { window._playingCompetitionsCallback = successCallback; $http.jsonp(this.middlewareBaseUrl + '/livescores/' + this.lang + '/competitions/playingbyteam/' + idteam, null); }, getLiveMatches: function (successCallback, $http) { window._liveMatchesCallback = successCallback; $http.jsonp(this.middlewareBaseUrl + '/livescores/live/matches' + mockType, null); }, getAllClubMatches: function (successCallBack, idclub, $http) { window._matchesbyclub = successCallBack; $http.jsonp(this.middlewareBaseUrl + '/livescores/en/matches/byclub/' + idclub, null); }, getMatchInfo: function (successCallback, matchid, $http) { window._matchInfoCallBack = successCallback; $http.jsonp(this.middlewareBaseUrl + '/matches/' + this.lang + '/info/' + matchid, null); }, getLiveMatchInfo: function (successCallback, matchid, $http) { window._matchInfoCallBack = successCallback; $http.jsonp(this.middlewareBaseUrl + '/matches/' + this.lang + '/live/info/' + matchid, null); } }; var middlewareTeamCalls = { lang: "en", localDate: new Date(), middlewareBaseUrl: (host.indexOf('localhost') !== -1) ? 'http://localhost:1337' : '//data.fifa.com', getListYearWithMatch: function (successCallback, idteam, $http) { window._yearsbyteam = successCallback; $http.jsonp(this.middlewareBaseUrl + '/livescores/' + this.lang + '/years/teams/' + idteam); }, getCompetionsMatchList: function (successCallback, idteam, year, $http) { window._matchesbyteam = successCallback; $http.jsonp(this.middlewareBaseUrl + '/livescores/' + this.lang + '/matches/byteam/' + +idteam + '/years/' + year); } }; var middlewareCompetitionsCalls = { getCompetitionInfo: function (successCallback, idcup, $http) { window._competitionInfoCallback = successCallback; $http.jsonp(_middlewareBaseUrl + '/livescores/' + _lang + '/competitions/info/' + idcup); }, getCompetitionClosestMatches: function (successCallback, idcup, $http) { window._closestMatchesByIdCupCallback = successCallback; $http.jsonp(_middlewareBaseUrl + '/livescores/' + _lang + '/matches/closest/competitions/' + idcup + '/' + _localDateMidnight.getTime()); }, getMatchesByYearAndMonth: function (successCallback, idcup, year, month, $http) { window._matchesByYearAndMonthCallback = successCallback; $http.jsonp(_middlewareBaseUrl + '/livescores/' + _lang + '/matches/byyearandmonth/' + idcup + '/' + year + '/' + month); }, getCompetitionStandings: function (successCallback, idcup, count, $http) { window._competitionListStandingsByCupCallback = successCallback; count = count || 50; $http.jsonp(_middlewareBaseUrl + '/livescores/' + _lang + '/standings/bycup/' + idcup + '/' + count); }, getTopScorers: function (successCallback, idcup, count, $http) { window._topScorersByIdCupCallback = successCallback; count = count || 100; $http.jsonp(_middlewareBaseUrl + '/livescores/' + _lang + '/competitions/' + idcup + '/topscorers/' + count); }, getListMonthWithMatch: function (successCallback, idCup, $http) { window._monthbycompetition = successCallback; $http.jsonp(_middlewareBaseUrl + '/livescores/' + _lang + '/months/competitions/' + idCup); } }; var middlewareInternationalTournamentsCalls = { getListMonths: function (successCallback, gender, $http) { window._monthListCallback = successCallback; $http.jsonp(_middlewareBaseUrl + '/livescores/' + _lang + '/internationaltournaments/months/' + gender); }, getMatchesByYearAndMonth: function (successCallback, year, month, gender, $http) { window._matchesByYearAndMonthCallback = successCallback; $http.jsonp(_middlewareBaseUrl + '/livescores/' + _lang + '/internationaltournaments/matches/' + gender + '/byyearandmonth/' + year + '/' + month); }, getMatchesByDateRange: function (successCallback, dateFrom, dateTo, gender, $http) { window._matchesByDateRangeCallback = successCallback; $http.jsonp(_middlewareBaseUrl + '/livescores/' + _lang + '/internationaltournaments/matches/' + gender + '/bydaterange/' + dateFrom + '/' + dateTo); } }; module.factory('middlewareMatchCalls', function () { return middlewareMatchCalls; }); module.factory('middlewareTeamCalls', function () { return middlewareTeamCalls; }); module.factory('middlewareCompetitionsCalls', function () { return middlewareCompetitionsCalls; }); module.factory('middlewareInternationalTournamentsCalls', function () { return middlewareInternationalTournamentsCalls; }); }()); ;var MatchPageApp = angular.module("matchApp", ['ngRoute', 'smoothScroll', 'inline', 'matchDataManage', 'utilityModule', 'middlewareCalls']); MatchPageApp.config(function ($locationProvider) { $locationProvider.html5Mode({ enabled: true, requireBase: false }); }); MatchPageApp.run(function ($location, $rootScope, $templateCache, $http) { window.loadFifaConfigMatchApp($rootScope); $rootScope.controllerToLoad = 0; $rootScope.$on('app.controllerLoaderManage', function () { $rootScope.controllerToLoad = $rootScope.controllerToLoad - 1; if ($rootScope.controllerToLoad == 0) { $rootScope.$emit('app.updateRefreshLoader'); } }); if ($location.search().usemock == "true") { localStorage.setItem("useMock", "true"); } if ($location.search().usemock == "false") { localStorage.removeItem("useMock"); } }); window.loadFifaConfigMatchApp = function ($rootScope) { if (window.fifa && window.fifa.vocManager && window.fifa.vocManager.vocabularies.length > 0) { $rootScope.$emit('FinishLoadFifaConfigMatchApp'); return; } requestAnimationFrame(function () { window.loadFifaConfigMatchApp($rootScope); }); }; ;MatchPageApp.factory("StandingService", ['$http', '$location', function ($http, $location) { var middlewareBaseUrl = '//data.fifa.com'; var lang = "en"; var host = $location.host(); var bypassLocalHost = (window.location.search.indexOf("nolocal") !== -1); if (host === 'localhost' && bypassLocalHost === false) { middlewareBaseUrl = 'http://localhost:1337'; } var getCompetitionStandings = function (successCallback, phaseid) { window._competitionStandingsCallback = successCallback; $http.jsonp(middlewareBaseUrl + '/livescores/' + lang + '/standing/byphase/' + phaseid, null); }; return { GetCompetitionStandings: getCompetitionStandings } }]); ;MatchPageApp.factory('MatchDataManagementService', ['$http', '$location', '$rootScope', 'matchDataManage', function ($http, $location, $rootScope, matchDataManage) { var _sObj = {}; $rootScope.$on('FifaObjLoaded', function () { _sObj.isMobile = fifa.is_mobile; /*Phase Match*/ _sObj.lineupLabel = fifa.vocManager.translate('fifa.lineups'); _sObj.halfTimeLabel = fifa.vocManager.translate('fifa.half-time'); _sObj.endSecondHalfLabel = fifa.vocManager.translate('fifa.end2ndhalf'); _sObj.endFirstExtraLabel = fifa.vocManager.translate('fifa.endfirstextra'); _sObj.endSecondExtraLabel = fifa.vocManager.translate('fifa.endsecondextra'); _sObj.penaltyLabel = fifa.vocManager.translate('fifa.penaltiesphase'); _sObj.fullTimeLabel = fifa.vocManager.translate('fifa.full-time'); _sObj.lineupLabelAbbr = fifa.vocManager.translateAbbr('fifa.lineups'); _sObj.halfTimeLabelAbbr = fifa.vocManager.translateAbbr('fifa.half-time'); _sObj.endSecondHalfLabelAbbr = fifa.vocManager.translateAbbr('fifa.end2ndhalf'); _sObj.endFirstExtraLabelAbbr = fifa.vocManager.translateAbbr('fifa.endfirstextra'); _sObj.endSecondExtraLabelAbbr = fifa.vocManager.translateAbbr('fifa.endsecondextra'); _sObj.penaltyLabelAbbr = fifa.vocManager.translateAbbr('fifa.penaltiesphase'); _sObj.fullTimeLabelAbbr = fifa.vocManager.translateAbbr('fifa.full-time'); }); var matchDataCreate = function (match) { if (match.isLive) { match.status = 3; minute(match); } if (match.isFinished) { match.status = 0; match.showext = false; if (_sObj.isMobile) { match.minuteFormatted = _sObj.fullTimeLabelAbbr; } else { match.minuteFormatted = _sObj.fullTimeLabel; } if (match.reasonWinCode != null) { reasonWinText(match); } } if (!match.isFinished && !match.isLive && match.hasLineup) { match.status = 1; if (_sObj.isMobile) { match.minuteFormatted = _sObj.lineupLabelAbbr; } else { match.minuteFormatted = _sObj.lineupLabel; } } /* Manage Win Team */ if (match.isFinished && match.winnerTeamId != null) { if (match.winnerTeamId == match.idHomeTeam) { match.winTeamName = match.homeTeamName; match.winTeamShortName = match.homeTeamName; } if (match.winnerTeamId == match.idAwayTeam) { match.winTeamName = match.AwayTeamName; match.winTeamShortName = match.AwayTeamName; } } return match; } var minute = function (match) { switch (match.phaseCode) { case '1': //FirstHalf if (match.minute > 45 || match.minuteExtra > 0) { match.minuteFormatted = 45; match.showext = true; } else { match.minuteFormatted = match.minute; match.showext = false; } break; case 'H': case '2': //HalfTime if (_sObj.isMobile) { match.minuteFormatted = _sObj.halfTimeLabelAbbr; } else { match.minuteFormatted = _sObj.halfTimeLabel; } match.showext = false; break; case '4': //SecondHalf if (match.minute > 90 || match.minuteExtra > 0) { match.minuteFormatted = 90; match.showext = true; } else { match.minuteFormatted = match.minute; match.showext = false; } break; case '5': //End SecondHalf if (_sObj.isMobile) { match.minuteFormatted = _sObj.endSecondHalfLabelAbbr; } else { match.minuteFormatted = _sObj.endSecondHalfLabel; } match.showext = false; break; case '6': //Fist Extra if (match.minute > 105 || match.minuteExtra > 0) { match.minuteFormatted = 105; match.showext = true; } else { match.minuteFormatted = match.minute; match.showext = false; } break; case '7': //End Fist Extra if (_sObj.isMobile) { match.minuteFormatted = _sObj.endFirstExtraLabelAbbr; } else { match.minuteFormatted = _sObj.endFirstExtraLabel; } match.showext = false; break; case '8': //Second Extra if (match.minute > 120 || match.minuteExtra > 0) { match.minuteFormatted = 120; match.showext = true; } else { match.minuteFormatted = match.minute; match.showext = false; } break; case '9': //End Second Extra if (_sObj.isMobile) { match.minuteFormatted = _sObj.endSecondExtraLabelAbbr; } else { match.minuteFormatted = _sObj.endSecondExtraLabel; } match.showext = false; break; case 'A': // PSO if (_sObj.isMobile) { match.minuteFormatted = _sObj.penaltyLabelAbbr; } else { match.minuteFormatted = _sObj.penaltyLabel; } match.showext = false; break; } }; var reasonWinText = function (match) { var tag = 'fifa.winningReason_' + match.reasonWinCode; var text = ''; var textAbbr = ''; textAbbr = fifa.vocManager.translateAbbr(tag); text = fifa.vocManager.translate(tag); textAbbr = textAbbr.replace('{ScorePenH}', match.scorePenaltyHome); textAbbr = textAbbr.replace('{ScorePenA}', match.scorePenaltyAway); textAbbr = textAbbr.replace('{ScoreAggH}', match.scoreAggregateHome); textAbbr = textAbbr.replace('{ScoreAggA}', match.scoreAggregateAway); textAbbr = textAbbr.replace('{WinTeamName}', match.winTeamName); textAbbr = textAbbr.replace('{WinTeamCountry}', match.winTeamShortName); text = text.replace('{ScorePenH}', match.scorePenaltyHome); text = text.replace('{ScorePenA}', match.scorePenaltyAway); text = text.replace('{ScoreAggH}', match.scoreAggregateHome); text = text.replace('{ScoreAggA}', match.scoreAggregateAway); text = text.replace('{WinTeamName}', match.winTeamName); text = text.replace('{WinTeamCountry}', match.winTeamShortName); match.winReasonTextAbbr = textAbbr; match.winReasonText = text; } return { MatchDataCreate: matchDataCreate } }]); ;(function () { 'use strict'; var module = angular.module('utilityModule', []); var utilityManager = { getCompetitionImagePath: function (comp) { var cupKindID = comp.cupKindID, idCup = comp.idCup; if (!comp.isFifaCompetition && cupKindID !== 111 && cupKindID !== 102 && cupKindID !== 103) { return fifa.extensions.getTeamFlag(comp.countryCode, '3'); } else if (cupKindID === 111 || cupKindID === 103 || cupKindID === 102) { if (cupKindID === 102 || cupKindID === 103) { return fifa.extensions.getContinentalLogo(idCup, comp.idCupSeason, '3'); } else { return fifa.extensions.getCompetitionLogo(idCup, '3'); } } else if (comp.isFifaCompetition) { if (cupKindID === 105) { return fifa.extensions.getFriendliesLogo(); } else { if (cupKindID === 101 && idCup !== 520) { return ''; } else { return fifa.extensions.getTournamentLogo(idCup, comp.edition); } } } }, registerEmit: function (emit) { if (!window.initializerEmit) { window.initializerEmit = []; } window.initializerEmit.push(emit); }, replaceMoreUrl: function (context, queryPath, selector) { var _basePath = document.location.pathname; _basePath = _basePath.substring(0, _basePath.indexOf(queryPath)); var _buttonObj = document.querySelector("div[data-context='" + context + "'] .qlink-wrap" + selector + " .qlink-link .qlink-link-wrap a"); if (_buttonObj) { var _href = _buttonObj.getAttribute("href"); _href = _href.replace("[basepath]", _basePath); _buttonObj.setAttribute("href", _href); } } }; var sliderManager = { sliderListObject: null, dataValue: null, initListObject: function () { this.sliderListObject = angular.element(document.querySelectorAll("div[data-elment-name='slider'] > ul > li")); }, click: function ($event) { if (!this.sliderListObject) { this.initListObject(); } if (this.dataValue) { this.dataValue = null; } var dataType = $event.currentTarget.dataset.type; if (dataType) { switch (dataType) { case 'next': this.next(); break; case 'prev': this.prev(); break; } return this.dataValue; } }, next: function () { var activeItemIndex = this.getActiveItemIndexByDataType(); this.manageNextNewActiveItemIndex(activeItemIndex); }, prev: function () { var activeItemIndex = this.getActiveItemIndexByDataType(); this.managePrevNewActiveItemIndex(activeItemIndex); }, selectSpecificItem: function (value) { if (!this.sliderListObject) { this.initListObject(); } if (this.dataValue) { this.dataValue = null; } var activeItemIndex = this.getActiveItemIndexByDataValue(value); this.manageSelectedActiveItemIndex(activeItemIndex); return this.dataValue; }, getActiveItemIndexByDataValue: function (value) { var index = null; for (var i = 0; i < (this.sliderListObject || this.initListObject(), this.sliderListObject).length; i++) { var el = this.sliderListObject[i]; if (el.getAttribute('data-value') == value) { index = i; return index; } } }, getActiveItemIndexByDataType: function () { var index = null; for (var i = 0; i < (this.sliderListObject || this.initListObject(), this.sliderListObject).length; i++) { var el = this.sliderListObject[i]; if (el.getAttribute('data-type') === 'active') { index = i; return index } } }, manageSelectedActiveItemIndex: function (activeItemIndex) { var _newPrevIndex = activeItemIndex - 1; var _newActiveIndex = activeItemIndex; var _newNextIndex = activeItemIndex + 1; this.setUpdateActiveItemPosition(_newPrevIndex, _newActiveIndex, _newNextIndex); }, managePrevNewActiveItemIndex: function (activeItemIndex) { var _newPrevIndex = activeItemIndex - 2; var _newActiveIndex = activeItemIndex - 1; var _newNextIndex = activeItemIndex; this.setUpdateActiveItemPosition(_newPrevIndex, _newActiveIndex, _newNextIndex); }, manageNextNewActiveItemIndex: function (activeItemIndex) { var _newPrevIndex = activeItemIndex; var _newActiveIndex = activeItemIndex + 1; var _newNextIndex = activeItemIndex + 2; this.setUpdateActiveItemPosition(_newPrevIndex, _newActiveIndex, _newNextIndex); }, setUpdateActiveItemPosition: function (prev, active, next) { if (!this.sliderListObject) { this.initListObject(); } var emptyEl = document.getElementById('empty-item'); if (emptyEl) { emptyEl.parentNode.removeChild(emptyEl); } for (var i = 0; i < this.sliderListObject.length; i++) { var el = this.sliderListObject[i]; el.setAttribute('data-type', ''); el.setAttribute('class', 'item hidden'); if (i == prev) { el.setAttribute('data-type', 'prev'); el.setAttribute('class', 'item prev'); } if (i == active) { el.setAttribute('data-type', 'active'); el.setAttribute('class', 'item active'); this.dataValue = el.getAttribute('data-value'); } if (i == next) { el.setAttribute('data-type', 'next'); el.setAttribute('class', 'item next'); } } if (active === 0) { var listLi = document.querySelector("div[data-elment-name='slider'] > ul"); var emptyli = document.createElement("li"); var emptyText = document.createTextNode("-"); emptyli.appendChild(emptyText); emptyli.setAttribute('class', 'item item-empty'); emptyli.setAttribute('id', 'empty-item'); listLi.insertBefore(emptyli, listLi.childNodes[0]); } if (active == this.sliderListObject.length - 1) { var listLi = document.querySelector("div[data-elment-name='slider'] > ul"); var emptyli = document.createElement("li"); var emptyText = document.createTextNode("-"); emptyli.appendChild(emptyText); emptyli.setAttribute('class', 'item item-empty'); emptyli.setAttribute('id', 'empty-item'); listLi.appendChild(emptyli); } } }; var standingsManager = { ISSRankTypeList: [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 1048576, 536870912, 1073741824], ISSRankTypeListMappingFifaTag: [{ id: 1, name: "fifa.matchesBrowser" } , { id: 2, name: "fifa.championshipPlayOff" } , { id: 4, name: "fifa.relegationPlayOff" } , { id: 8, name: "fifa.relegation" } , { id: 16, name: "fifa.promotion" } , { id: 32, name: "fifa.promotionPlayOff" } , { id: 64, name: "fifa.championsLeagueEc" } , { id: 128, name: "fifa.championsLeaguePreliminary" } , { id: 256, name: "fifa.uefaCupPlayOff" } , { id: 512, name: "fifa.uefaCupByDomestic" } , { id: 1024, name: "fifa.nextRound" } , { id: 2048, name: "fifa.play-offs" } , { id: 4096, name: "fifa.finalTournament" } , { id: 8192, name: "fifa.championsPlayOff" } , { id: 16384, name: "fifa.uefaCupPlayOff" } , { id: 32768, name: "fifa.intertoto" } , { id: 65536, name: "fifa.intertotoPlayOff" } , { id: 131072, name: "fifa.copaLibertadores" } , { id: 262144, name: "fifa.copaSudamericana" } , { id: 1048576, name: "fifa.uefaCup" } , { id: 536870912, name: "fifa.uefaCupThroughDomestic" } , { id: 1073741824, name: "fifa.periodChampions" }], standingsMarkerManageByCompetitionList: function (competitionListStandingsData) { var _this = this; angular.forEach(competitionListStandingsData, function (comp, key) { comp.tableLegend = []; angular.forEach(comp.listStandings, function (standingRow, key) { _this.getPositionMarker(standingRow); var legendItem = _this.getLegendStandings(standingRow); if (legendItem) { var checkItemExist = _.find(comp.tableLegend, function (el) { if (el.id == legendItem.id) { return true; } else { return false; } }); if (!checkItemExist) { comp.tableLegend.push(legendItem); } } }); }); }, standingsMarkerManageByListStandingsRow: function (listStandingsRow) { var _this = this; angular.forEach(listStandingsRow, function (standingRow, key) { _this.getPositionMarker(standingRow); }); }, getPositionMarker: function (standingRow) { standingRow.rankMarkerType = this.getRankTypeBW(standingRow.providerRankCode); }, getRankTypeBW: function (rankType) { for (var i = 0; i < this.ISSRankTypeList.length; i++) { if ((rankType & this.ISSRankTypeList[i]) > 0) { return rankType & this.ISSRankTypeList[i]; } } return 0; }, getLegendStandings: function (standingRow) { for (var i = 0; i < this.ISSRankTypeListMappingFifaTag.length; i++) { var key = this.ISSRankTypeListMappingFifaTag[i].id; if ((standingRow.providerRankCode & key) > 0) { return this.ISSRankTypeListMappingFifaTag[i]; } } } }; module.factory('utilityManager', function () { return utilityManager; }); module.factory('sliderManager', function () { return sliderManager; }); module.factory('standingsManager', function () { return standingsManager; }); module.directive('lsMatchesList', ['$compile', function ($compile) { return { restrict: 'A', scope: true, link: { post: function ($scope, element, $attr) { var teamNameLength = $scope.locals && $scope.locals.isMobile ? 10 : 12, muClassGet = function (match) { var cssClass = []; if (match.isClubCompetition) { cssClass.push('club-competition'); } else { cssClass.push('team-competition'); } if (match.isFinished) { cssClass.push('result'); } else if (match.isLive) { cssClass.push('live'); } else if (!match.isLive && !match.hasLineup) { cssClass.push('fixture'); } return cssClass.join(' '); }, teamMarkupGet = function (match, idTeam, teamName, teamCountryCode, teamClass) { var html_buf = []; html_buf.push('
'); if (!match.isClubCompetition) { html_buf.push('
'); html_buf.push(''); html_buf.push('', teamName, ''); html_buf.push(''); html_buf.push('
'); } else { html_buf.push('
'); html_buf.push(''); html_buf.push(''); html_buf.push('', teamName, ''); html_buf.push(''); html_buf.push('
'); } html_buf.push('
'); html_buf.push('', teamName, ''); html_buf.push('', teamCountryCode, ''); html_buf.push('
'); html_buf.push('
'); return html_buf.join(''); }, matchUnitMarkupGet = function (match) { var html_buf = []; /*mu-i*/ html_buf.push('
'); html_buf.push('
', match.fullDateTimeFormatted, ' ', $scope.localTimeLabel, '
'); html_buf.push('
', match.fullDateFormatted, '
'); html_buf.push('
', match.matchNumber, '
'); html_buf.push('
', match.competitionName, '
'); html_buf.push('
', match.dayName, '
'); html_buf.push('
', match.fullDateFormatted, '
'); html_buf.push('
'); html_buf.push('
', match.stadiumName, '
'); html_buf.push('
', match.venueName, '
'); html_buf.push('
'); html_buf.push('
'); /*end mu-i*/ /*mu-day*/ html_buf.push('
'); html_buf.push('', match.dayNum, ''); html_buf.push('', match.monthNum, ''); html_buf.push('
'); /*end mu-day*/ /*mu-m*/ html_buf.push('
'); /*t home*/ html_buf.push(teamMarkupGet(match, match.idHomeTeam, match.homeTeamName, match.homeCountryCode, 'home')); /*end t home*/ /*t away*/ html_buf.push(teamMarkupGet(match, match.idAwayTeam, match.awayTeamName, match.awayCountryCode, 'away')); /*end t away*/ /*s*/ html_buf.push('
'); /*s-fixture*/ html_buf.push('
'); /*s-status*/ html_buf.push('
'); if (match.minuteFormatted && (match.minuteFormatted.length > 0 || match.minuteFormatted > 0)) { html_buf.push('', match.minuteFormatted, ''); } if (match.minuteFormatted > 0) { html_buf.push('\''); } if (match.showext) { html_buf.push('+'); } html_buf.push('
'); /*end s-status*/ /*s-status-abbr*/ html_buf.push('
'); if (match.minuteFormatted && (match.minuteFormatted.length > 0 || match.minuteFormatted > 0)) { html_buf.push('', match.minuteFormatted, ''); } if (match.minuteFormatted > 0) { html_buf.push('\''); } if (match.showext) { html_buf.push('+'); } html_buf.push('
'); /*end s-status-abbr*/ /*s-score*/ html_buf.push('
'); if (match.isLive || match.isFinished) { html_buf.push(''); var lang = "en"; if (lang.toLowerCase() !== 'ar') { html_buf.push('', match.scoreHome, ''); html_buf.push('-'); html_buf.push('', match.scoreAway, ''); } else { html_buf.push('', match.scoreAway, ''); html_buf.push('-'); html_buf.push('', match.scoreHome, ''); } html_buf.push(''); } else if (!match.isLive && !match.isFinished) { html_buf.push(''); if (match.kickOffTime && match.kickOffTime !== '-:-') { var dtClient = new Date(match.matchDate), koTime = match.kickOffTime; if (!isNaN(dtClient.getTime())) { koTime = [dtClient.getHours().twoDigits(), dtClient.getMinutes().twoDigits()].join(':'); } html_buf.push('', koTime, ''); } else { html_buf.push('-:-'); } html_buf.push(''); } html_buf.push('
'); /*end s-score*/ html_buf.push('
'); /*end s-fixture*/ html_buf.push('
'); /*end s*/ /*mu-reasonwin*/ html_buf.push('
'); html_buf.push('', match.winReasonText, ''); html_buf.push('
'); /*end mu-reasonwin*/ /*mu-reasonwin-abbr*/ html_buf.push('
'); html_buf.push('', match.winReasonTextAbbr, ''); html_buf.push('
'); /*end mu-reasonwin-abbr*/ html_buf.push('
'); /*end mu-m*/ return html_buf.join(''); }, matchUnitTemplateSet = function (match) { var html_buf = []; html_buf.push(['
'].join('')); if (match.link && match.link.length > 0) { html_buf.push(['', matchUnitMarkupGet(match), ''].join('')); } else { html_buf.push(matchUnitMarkupGet(match)); } html_buf.push('
'); return html_buf; }, matchesListTemplateSet = function (matches) { matches = matches || $scope.matches; if (!matches) { return; } var html_buf = [], i = 0, l = matches.length; for (i; i < l; i++) { html_buf.push(matchUnitTemplateSet($scope.matches[i]).join('')); } element.html(html_buf.join('')); }; matchesListTemplateSet(); $scope.$watchCollection($attr.lsMatchesList, function (newValue, oldValue) { if ((window.fifa && window.fifa.vocManager && window.fifa.vocManager.vocabularies.length > 0) && _.isEqual(newValue, oldValue)) { return; } if (!newValue) { return; } matchesListTemplateSet(newValue); }, true); } } }; }]); module.directive('lsMatchUnit', ['$compile', 'matchDataManage', function ($compile, matchDataManage) { return { restrict: 'A', scope: true, link: { post: function ($scope, element, $attr) { var _isMobile = $scope.locals && $scope.locals.isMobile, teamNameLength = _isMobile ? 16 : 23, muClassGet = function (match, comp) { if (match.isLive) { return 'live'; } if (matchDataManage.hasLineup(match)) { return 'lineups'; } if ((match.reasonWinCode != null) && (match.reasonWinCode > 1)) { return 'win-reason-view'; } if (!comp.favouriteByTeam) { return 'no-duplicated'; } }, teamMarkupGet = function (match, idTeam, teamName, teamCountryCode, teamClass, userFavObj) { var html_buf = []; html_buf.push('
'); if (match.isClubCompetition) { teamCountryCode = undefined; } if (teamClass === 't-h') { if ($scope.checkTeamInFavMatchUnit(idTeam, teamCountryCode, match.countryCode, userFavObj)) { html_buf.push(''); } } html_buf.push('', teamName, ''); if (teamClass === 't-a') { if ($scope.checkTeamInFavMatchUnit(idTeam, teamCountryCode, match.countryCode, userFavObj)) { html_buf.push(''); } } html_buf.push('
'); return html_buf.join(''); }, matchUnitMarkupGet = function (match, userFavObj) { var html_buf = []; html_buf.push('
'); if (match.status == 0) { html_buf.push('', $scope.fullTimeLabel, ''); if (match.cupKindID == 105) { html_buf.push('', match.venueName, ''); } } else { if (matchDataManage.hasLineup(match)) { html_buf.push('', $scope.lineupLabel, ''); } if (match.status != 1) { html_buf.push(''); if (match.isAwarded) { html_buf.push(fifa.vocManager.translateAbbr('fifa.forfeited').toUpperCase()); } if (match.isAbandoned) { html_buf.push(fifa.vocManager.translateAbbr('fifa.abandonedStatus').toUpperCase()); } if (match.isSuspended) { html_buf.push(fifa.vocManager.translateAbbr('fifa.suspendedstatus').toUpperCase()); } else { if (match.minuteFormatted || match.minuteFormatted > 0) { html_buf.push('', match.minuteFormatted, ''); if (match.minuteFormatted > 0) { html_buf.push("'"); } } if (match.showext) { html_buf.push('+'); } } html_buf.push(''); } if (match.cupKindID == 105) { html_buf.push('', match.venueName, ''); } } html_buf.push('
'); html_buf.push('
'); html_buf.push('
'); html_buf.push('
'); /*t-h*/ html_buf.push(teamMarkupGet(match, match.idHomeTeam, match.homeTeamName, match.homeCountryCode, 't-h', userFavObj)); /*end t-h*/ if (match.status != 1) { html_buf.push('
', match.scoreHome, ' - ', match.scoreAway, '
'); } else if (match.status == 1) { html_buf.push('
'); if (!match.kickOffTime) { html_buf.push('-:-'); } else if (match.kickOffTime.length > 0) { var dt_utc = new Date(match.matchDateUTC), koTime = match.kickOffTime; if (dt_utc.getFullYear() > 1800) { var dtClient = new Date(match.matchDateUTC); if (!isNaN(dtClient.getTime())) { koTime = [dtClient.getHours().twoDigits(), dtClient.getMinutes().twoDigits()].join(':'); } } html_buf.push('', koTime, ''); if (match.isNextDay) { html_buf.push(' (+1)'); } } html_buf.push('
'); } /*t-a*/ html_buf.push(teamMarkupGet(match, match.idAwayTeam, match.awayTeamName, match.awayCountryCode, 't-a', userFavObj)); /*end t-a*/ html_buf.push('
'); /*end ls-mu-det*/ /*ls-mu-rw*/ if (match.reasonWinCode && match.reasonWinCode > 1) { html_buf.push('
'); var winReasonTxt; if (_isMobile) { winReasonTxt = $scope.winReasonTextAbbr(match); } else { winReasonTxt = $scope.winReasonText(match); } html_buf.push('', winReasonTxt, ''); html_buf.push('
'); } /*end ls-mu-rw*/ return html_buf.join(''); }, matchUnitTemplateSet = function (match, elm, userFavObj) { match = match || $scope.match; var html_buf = [], comp = $scope.comp; var _goalHLClass = ""; var isGoalHLHidden = (angular.element(document.querySelector(".goal-hl-hidden")) && angular.element(document.querySelector(".goal-hl-hidden")).length > 0); if (match.goalHighlight && !isGoalHLHidden) { _goalHLClass = (match.goalHighlight === "home") ? "goal-hl-home" : "goal-hl-away"; } html_buf.push('
'); if (match.link && match.link.length > 0) { html_buf.push('', matchUnitMarkupGet(match, userFavObj), ''); } else { html_buf.push(''); } html_buf.push('
'); (elm || element).html(html_buf.join('')); }; matchUnitTemplateSet(undefined, undefined, $scope.userFavObj); } } }; }]); module.directive('lsCompetitionList', ['$compile', '$filter', function ($compile, $filter) { return { restrict: 'A', scope: true, link: { post: function ($scope, element, $attr) { var filter = $attr.lsFilter, matchesFilter = $attr.lsMatchesFilter, matchesGroupBy = $attr.lsMatchesGroupBy, _isMobile = $scope.locals && $scope.locals.isMobile, competitionListTemplate = function (complist) { complist = (complist || $scope[$attr.lsCompetitionList]); if (filter) { complist = $filter($attr.lsFilter)(complist); } if (!complist) { return; } complist = complist.hasOwnProperty('competitionslist') ? complist.competitionslist : complist; var html_buf = []; if (!angular.isArray(complist)) { var result = []; for (var compkey in complist) { result.push(complist[compkey]); } complist = result; } var i = 0, l = complist.length; if (_isMobile) { $scope.userFavObj = $scope.getUserFavObj(); } for (i; i < l; i++) { $scope.comp = complist[i]; html_buf.push(competitionUnitTemplate()); } if (_isMobile) { delete $scope.userFavObj; } element.html(html_buf.join('')); $(element[0]).find('.favourites-icon-btn').off('click.favourites').on('click.favourites', function () { var complist = angular.element(this).scope().$parent.competitions.competitionslist; var idCup = $(this).closest('.competition-row').attr('data-idcup'); if (!angular.isArray(complist)) { var result = []; for (var compkey in complist) { result.push(complist[compkey]); } complist = result; } var comp = undefined, i = 0, l = complist.length; for (i; i < l; i++) { if (complist[i].idCup == idCup) { comp = complist[i]; break; } } if (!comp) { return; } $scope.$apply(function () { $scope.manageFavouriteIcon('competitions', comp); }); }); }, competitonNameTemplate = function (comp) { var html_buf = []; var compImageClass = $scope.CompetitionImageClass(comp); var compImagePath = $scope.CompetitionImagePath(comp); var compFifaGenericImage = $scope.checkFifaGenericImage(compImagePath); html_buf.push(''); html_buf.push('', comp.name, ''); return html_buf.join(''); }, competitionUnitTemplate = function (comp) { comp = comp || $scope.comp; var html_buf = []; if (!comp.showInFavourites || _isMobile) { html_buf.push('
'); html_buf.push('
'); /* title wrap*/ html_buf.push('

'); if (comp.link && comp.link.length > 0) { html_buf.push('', competitonNameTemplate(comp), ''); } else { html_buf.push(''); } /* Favourites manage */ if ($scope.checkCompetitionCupKind(comp.cupKindID)) { html_buf.push(''); } /* End Favourites manage */ html_buf.push('

'); /* end title wrap*/ if (!_isMobile) { html_buf.push(''); } html_buf.push('
'); /*Match List*/ html_buf.push('
'); var matchlist = comp.matchlist; if (matchesFilter) { matchlist = $filter(matchesFilter)(matchlist); } var l = matchlist.length, m = 0; if (!l) { return ''; } var last_group_by_date, match, match_date_format; for (m; m < l; m++) { $scope.match = match = matchlist[m]; if (matchesGroupBy === 'date' && last_group_by_date !== (match_date_format = match.matchDate.formatDate('dddd dd/MM/yyyy'))) { last_group_by_date = match_date_format; html_buf.push('

', match_date_format, '

'); } html_buf.push($compile('
')($scope).html()); } html_buf.push('
'); /*End Match List*/ /*Mobile matches and standings button*/ if (_isMobile) { html_buf.push(''); } html_buf.push('
'); return html_buf.join(''); } return ''; }; competitionListTemplate(); var _watchCollection = $scope.$watch($attr.lsCompetitionList, function (newValue, oldValue) { if ((window.fifa && window.fifa.vocManager && window.fifa.vocManager.vocabularies.length > 0) && _.isEqual(newValue, oldValue)) { return; } competitionListTemplate(newValue); }, true); element.on('$destroy', function () { _watchCollection(); }); } } }; }]); module.directive('lsGenericSlider', ['$compile', function ($compile) { return { restrict: 'A', scope: true, link: function ($scope, element, $attr) { var sliderItemTemplate = function (listItem) { var i = 0, l = (listItem || $scope.listItem || []).length, html_buf = []; if (!l) { return; } for (i; i < l; i++) { var item = $scope.listItem[i]; html_buf.push('
  • '); html_buf.push('
    ', item.value, '
    '); html_buf.push('
  • '); } element.html(html_buf.join('')); $(element[0]).find('.item').off('click.slideritem').on('click.slideritem', function (e) { $scope.ClickAction(e, { hashValue: this.getAttribute('data-hash') }); }); }; sliderItemTemplate(); var _watchCollection = $scope.$watch($attr.lsGenericSlider, function (newValue, oldValue) { if ((window.fifa && window.fifa.vocManager && window.fifa.vocManager.vocabularies.length > 0) && _.isEqual(newValue, oldValue)) { return; } if (!newValue) { return; } sliderItemTemplate(newValue); }); element.on('$destroy', function () { _watchCollection(); }); } }; }]); }()); ;MatchPageApp.controller('initializeController', ['$scope', '$rootScope', 'middlewareMatchCalls', 'utilityManager', '$location', '$timeout', '$http', function ($scope, $rootScope, middlewareMatchCalls, utilityManager, $location, $timeout, $http) { $scope.idMatch = angular.element(document.querySelector("div[data-context='match']")).attr("data-idcontext"); $scope.showLoader = true; var initialize = function () { middlewareMatchCalls.getMatchInfo(function (data) { utilityManager.registerEmit({ middlewareCall: "middlewareMatchCalls.getMatchInfo", emitEvent: "match.matchInfoLoaded" }); $rootScope.$emit('match.matchInfoLoaded', data); }, $scope.idMatch, $http); middlewareMatchCalls.getClosestMatches(function (data) { utilityManager.registerEmit({ middlewareCall: "middlewareMatchCalls.getClosestMatches", emitEvent: "match.matchListLoaded" }); $rootScope.$emit('match.matchListLoaded', data); }, $scope.idMatch, $http); }; $rootScope.$on('app.updateRefreshLoader', function () { initialize(); $scope.showLoader = false; }); }]); ;MatchPageApp.filter('matchfulldate', function () { return function (item) { var _dateObj = new Date(item), _output = '', _hours = ''; _hours = _dateObj.getHours().toString().length == 1 ? '0' + _dateObj.getHours() : _dateObj.getHours(); _minutes = _dateObj.getMinutes().toString().length == 1 ? '0' + _dateObj.getMinutes() : _dateObj.getMinutes(); _output = _dateObj.getDate() + ' ' + _dateObj.GetMonthStr(true) + ' ' + _dateObj.getFullYear() + ' - ' + _hours + ':' + _minutes; return _output; }; }); MatchPageApp.filter('matchdayofweek', function () { return function (item) { var _dateObj = new Date(item), _output = ''; _output = fifa.vocManager.translate('fifa.dayOfWeek_' + _dateObj.getDay()); return _output; }; }); MatchPageApp.filter('matchdateDDMMMYYYY', function () { return function (item) { var _dateObj = new Date(item), _output = '', _hours = ''; _output = _dateObj.getDate() + ' ' + _dateObj.GetMonthStr(true) + ' ' + _dateObj.getFullYear(); return _output; }; }); MatchPageApp.filter('matchdateDD', function () { return function (item) { var _dateObj = new Date(item), _output = ''; _output = _dateObj.getDate(); return _output; }; }); MatchPageApp.filter('matchdateMM', function () { return function (item) { var _dateObj = new Date(item), _output = ''; _output = _dateObj.getMonth(); return _output; }; }); ;/*global fifa : false*/ /*global _ : false*/ /*global MatchPageApp : false*/ MatchPageApp.controller('matchHeaderController', ['$scope', '$rootScope', '$timeout', '$location', 'matchDataManage', 'middlewareMatchCalls', '$http', function ($scope, $rootScope, $timeout, $location, matchDataManage, middlewareMatchCalls, $http) { $scope.textLineup = undefined; $scope.textMatches = undefined; $scope.textPhotos = undefined; $scope.textStandings = undefined; $scope.textComments = undefined; $scope.testMessage = undefined; $scope.IdMatch = undefined; $scope.matchdata = undefined; $scope.ownGoal = undefined; $scope.penaltyGoal = undefined; $scope.locals = undefined; $scope.enablePollingFeed = true; $scope.showLineup = false; $scope.showPlayByPlay = false; $scope.showReportMenuItem = false; $scope.showLoader = $rootScope.showLoader; $rootScope.controllerToLoad = $rootScope.controllerToLoad + 1; var initialize = function () { $scope.locals = { isMobile: fifa.is_mobile }; $scope.localTimeLabel = fifa.vocManager.translate('fifa.localtime'); /*Get IdMatch*/ $scope.IdMatch = angular.element(document.querySelector("div[data-context='match']")).attr("data-idcontext"); /*-----------*/ /*Menu Item*/ $scope.textOverview = fifa.vocManager.translate('fifa.overview'); $scope.textLineup = fifa.vocManager.translate('fifa.lineups'); $scope.textMatches = fifa.vocManager.translate('fifa.matches'); $scope.textPhotos = fifa.vocManager.translate('fifa.photos'); $scope.textStandings = fifa.vocManager.translate('fifa.standings'); $scope.textComments = fifa.vocManager.translate('fifa.comments'); $scope.textReport = fifa.vocManager.translate('fifa.report'); /*Phase Match*/ $scope.ownGoal = fifa.vocManager.translateAbbr('fifa.ownGoal'); $scope.penaltyGoal = fifa.vocManager.translateAbbr('fifa.penaltyGoal'); $scope.abandonedLabel = fifa.vocManager.translate('fifa.abandonedStatus'); $scope.abandonedLabelAbbr = fifa.vocManager.translateAbbr('fifa.abandonedStatus'); $scope.forfeitedLabelAbbr = fifa.vocManager.translateAbbr('fifa.forfeited'); $scope.forfeitedLabel = fifa.vocManager.translate('fifa.forfeited'); $scope.lineupLabel = fifa.vocManager.translate('fifa.lineups'); $scope.halfTimeLabel = fifa.vocManager.translate('fifa.half-time'); $scope.endSecondHalfLabel = fifa.vocManager.translate('fifa.end2ndhalf'); $scope.endFirstExtraLabel = fifa.vocManager.translate('fifa.endfirstextra'); $scope.endSecondExtraLabel = fifa.vocManager.translate('fifa.endsecondextra'); $scope.penaltyLabel = fifa.vocManager.translate('fifa.penaltiesphase'); $scope.fullTimeLabel = fifa.vocManager.translate('fifa.full-time'); $scope.lineupLabelAbbr = fifa.vocManager.translateAbbr('fifa.lineups'); $scope.halfTimeLabelAbbr = fifa.vocManager.translateAbbr('fifa.half-time'); $scope.endSecondHalfLabelAbbr = fifa.vocManager.translateAbbr('fifa.end2ndhalf'); $scope.endFirstExtraLabelAbbr = fifa.vocManager.translateAbbr('fifa.endfirstextra'); $scope.endSecondExtraLabelAbbr = fifa.vocManager.translateAbbr('fifa.endsecondextra'); $scope.penaltyLabelAbbr = fifa.vocManager.translateAbbr('fifa.penaltiesphase'); $scope.fullTimeLabelAbbr = fifa.vocManager.translateAbbr('fifa.full-time'); $rootScope.$emit('app.controllerLoaderManage'); }; $rootScope.$on('match.matchInfoLoaded', function (event, data) { $scope.MatchInfoDataManage(data.match); $scope.matchdata = data.match; /* Start Polling Live Feed*/ if ($scope.enablePollingFeed) { $scope.loadLiveInfo(); $scope.timedLoadLiveInfo(); } fifa.dispatcher.trigger('menu:view:ajaxDiscoverHideableItems'); }); var _live_info_promise = null; $scope.timedLoadLiveInfo = function () { if (_live_info_promise) { $timeout.cancel(_live_info_promise); $scope.loadLiveInfo(); } _live_info_promise = $timeout($scope.timedLoadLiveInfo, '10000'.withRandomShift()); }; $scope.loadLiveInfo = function () { middlewareMatchCalls.getLiveMatchInfo(function (data) { matchDataManage.LiveMatchDataMerge($scope.matchdata, data.match, $scope); $scope.matchdata.events = data.match.events; $scope.matchdata.lineups = data.match.lineups; if ($scope.matchdata.hasLineup) { $scope.MatchScorerManage($scope.matchdata); } else { $scope.MatchScorerManageFromEventsList($scope.matchdata); } $scope.reloadOthersControllers(); }, $scope.IdMatch, $http); }; $scope.reloadOthersControllers = function () { if ($scope.matchdata.hasFullCoverage) { $rootScope.$emit('match.reloadPlayByPlay', $scope.matchdata); $rootScope.$emit('match.reloadLineup', $scope.matchdata); } }; $scope.reloadStandingsCotroller = function () { $rootScope.$emit('match.reloadStandings', $scope.matchdata); }; $rootScope.$on('FinishLoadFifaConfigMatchApp', function () { initialize(); }); $rootScope.$on('app.updateRefreshLoader', function () { $scope.showLoader = $rootScope.showLoader; }); /* Function Header */ $scope.MatchInfoDataManage = function (match) { if (match.hasLineup && (match.isLive || match.isFinished)) { $scope.showLineupLabel = true; } $scope.showReportMenuItem = match.hasReport; $scope.dateManage(match); /*Manage Match Status + Minute */ if (match.isLive) { match.status = 3; matchDataManage.matchMinuteFormat(match, null, $scope); if (match.hasLineup) { $scope.MatchScorerManage(match); } else { $scope.MatchScorerManageFromEventsList(match); } } if (match.isFinished) { match.status = 0; match.showext = false; if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.fullTimeLabelAbbr; } else { match.minuteFormatted = $scope.fullTimeLabel; } if (match.reasonWinCode != null) { matchDataManage.matchReasonWinSet(match, null, $scope); } if (match.hasLineup) { $scope.MatchScorerManage(match); } else { $scope.MatchScorerManageFromEventsList(match); } } if (!match.isFinished && !match.isLive && match.hasLineup) { match.status = 1; if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.lineupLabelAbbr; } else { match.minuteFormatted = $scope.lineupLabel; } } if (match.isAbandoned) { if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.abandonedLabelAbbr; } else { match.minuteFormatted = $scope.abandonedLabel; } } if (match.isAwarded) { if ($scope.locals && $scope.locals.isMobile) { match.minuteFormatted = $scope.forfeitedLabelAbbr; } else { match.minuteFormatted = $scope.forfeitedLabel; } } /* Manage Win Team */ if (match.isFinished && match.winnerTeamId != null) { if (match.winnerTeamId == match.idHomeTeam) { match.winTeamName = match.homeTeamName; match.winTeamShortName = match.homeTeamName; } if (match.winnerTeamId == match.idAwayTeam) { match.winTeamName = match.AwayTeamName; match.winTeamShortName = match.AwayTeamName; } } }; /* Manage Date Match */ $scope.dateManage = function (match) { if (match.dateLocal) { /* Check for start Polling Live Feed */ var dateNow = new Date(); /* Local */ var date = new Date(Date.parse(match.dateLocal)); date.setMinutes(date.getMinutes() + date.getTimezoneOffset()); var monthNum = date.getMonth() + 1; var dayNum = date.getDate(); dateNow.setHours(dateNow.getHours() - 10); /*if we're looking to a match already played*/ if (dateNow > date) { $scope.enablePollingFeed = false; } dateNow = new Date(); dateNow.setHours(dateNow.getHours() + 10); /*if we're looking to a future match*/ if (dateNow < date) { $scope.enablePollingFeed = false; } var yearNum = date.getFullYear(); var hoursNum = date.getHours(); var minuteNum = date.getMinutes(); var monthText = fifa.vocManager.translateAbbr('fifa.month_' + monthNum); match.fullDateFormatted = dayNum + ' ' + monthText + ' ' + yearNum; if (hoursNum != 0) { match.kickOffTime = hoursNum.twoDigits() + ':' + minuteNum.twoDigits(); } match.daymonth = dayNum + '' + monthNum.twoDigits(); var clientDt = new Date(match.dateUtc); if (match.kickOffTime && match.kickOffTime !== '-:-' && match.dateUtc && !isNaN(clientDt.getTime()) && !match.isAbandoned) { match.kickOffTimeClient = [clientDt.getHours().twoDigits(), clientDt.getMinutes().twoDigits()].join(':'); } else { match.kickOffTimeClient = '-:-'; } } else { match.kickOffTime = '-:-'; } }; /* Manage Scorer From Event */ $scope.MatchScorerManageFromEventsList = function (match) { match.listScorerHome = []; match.listScorerAway = []; var _eventsGoal = _.filter(match.events, function (ev) { if (ev.eventCode == 3) { return ev; } }); _eventsGoal = _eventsGoal.reverse(); for (var e = 0; e < _eventsGoal.length; e++) { var _event = _eventsGoal[e]; var _player = {}; var _plEvent; if (_event.idTeam == match.externalTeamHomeId) { var _existingPlayer = _.find(match.listScorerHome, function (pl) { if (pl.idPlayer == _event.idPlayer) { return pl; } }); if (_existingPlayer) { _player = _existingPlayer; _plEvent = {}; _plEvent.eventCode = _event.eventCode; _plEvent.minute = _event.minute; _plEvent.subKindCode = _event.subKindCode; _player.events.push(_plEvent); } else { if (_event.playerName) { _player.idPlayer = _event.idPlayer; _player.personName = _event.playerName; _player.events = []; _plEvent = {}; _plEvent.eventCode = _event.eventCode; _plEvent.minute = _event.minute; _plEvent.subKindCode = _event.subKindCode; _player.events.push(_plEvent); match.listScorerHome.push(_player); } } } if (_event.idTeam == match.externalTeamAwayId) { var _existingPlayer = _.find(match.listScorerAway, function (pl) { if (pl.idPlayer == _event.idPlayer) { return pl; } }); if (_existingPlayer) { _player = _existingPlayer; _plEvent = {}; _plEvent.eventCode = _event.eventCode; _plEvent.minute = _event.minute; _plEvent.subKindCode = _event.subKindCode; _player.events.push(_plEvent); } else { if (_event.playerName) { _player.idPlayer = _event.idPlayer; _player.personName = _event.playerName; _player.events = []; _plEvent = {}; _plEvent.eventCode = _event.eventCode; _plEvent.minute = _event.minute; _plEvent.subKindCode = _event.subKindCode; _player.events.push(_plEvent); match.listScorerAway.push(_player); } } } } }; /* Manage Scorer From Lineup */ $scope.MatchScorerManage = function (match) { var _lineupHome = match.lineups.teams.home; var _lineupAway = match.lineups.teams.away; var _substitutes = match.lineups.teams.substitutes; match.listScorerHome = []; match.listScorerAway = []; var _eventsGoal = _.filter(match.events, function (ev) { if (ev.eventCode == 3) { return ev; } }); _eventsGoal = _eventsGoal.reverse(); for (var e = 0; e < _eventsGoal.length; e++) { var _event = _eventsGoal[e]; for (var i = 0; i < _lineupHome.length; i++) { if (_event.idPlayer == _lineupHome[i].externalId) { if (_event.subKindCode == 'O') { var _existingAwayScorer = _.filter(match.listScorerAway, function (el) { if (el.externalId == _lineupHome[i].externalId) { return el; } }); if (_existingAwayScorer.length == 0) { match.listScorerAway.push(_lineupHome[i]); } } else { var _existingHomeScorer = _.filter(match.listScorerHome, function (el) { if (el.externalId == _lineupHome[i].externalId) { return el; } }); if (_existingHomeScorer.length == 0) { match.listScorerHome.push(_lineupHome[i]); } } } } for (var i = 0; i < _lineupAway.length; i++) { if (_event.idPlayer == _lineupAway[i].externalId) { if (_event.subKindCode == 'O') { var _existingHomeScorer = _.filter(match.listScorerHome, function (el) { if (el.externalId == _lineupAway[i].externalId) { return el; } }); if (_existingHomeScorer.length == 0) { match.listScorerHome.push(_lineupAway[i]); } } else { var _existingAwayScorer = _.filter(match.listScorerAway, function (el) { if (el.externalId == _lineupAway[i].externalId) { return el; } }); if (_existingAwayScorer.length == 0) { match.listScorerAway.push(_lineupAway[i]); } } } } for (var s = 0; s < _substitutes.length; s++) { var subsHome = _substitutes[s].homePlayer; var subsAway = _substitutes[s].awayPlayer; if (subsHome && _event.idPlayer == subsHome.externalId) { if (_event.subKindCode == 'O') { var _existingAwayScorer = _.filter(match.listScorerAway, function (el) { if (el.externalId == subsHome.externalId) { return el; } }); if (_existingAwayScorer.length == 0) { match.listScorerAway.push(subsHome); } } else { var _existingHomeScorer = _.filter(match.listScorerHome, function (el) { if (el.externalId == subsHome.externalId) { return el; } }); if (_existingHomeScorer.length == 0) { match.listScorerHome.push(subsHome); } } } if (subsAway && _event.idPlayer == subsAway.externalId) { if (_event.subKindCode == 'O') { var _existingHomeScorer = _.filter(match.listScorerHome, function (el) { if (el.externalId == subsAway.externalId) { return el; } }); if (_existingHomeScorer.length == 0) { match.listScorerHome.push(subsAway); } } else { var _existingAwayScorer = _.filter(match.listScorerAway, function (el) { if (el.externalId == subsAway.externalId) { return el; } }); if (_existingAwayScorer.length == 0) { match.listScorerAway.push(subsAway); } } } } } }; }]).directive('lsMatchHeader', ['matchDataManage', function (matchDataManage) { return { restrict: 'A', scope: true, link: { post: function ($scope, element, $attr) { var basepath = (function () { var pathname = window.location.pathname; if (pathname.indexOf('.htm') === -1) { if (pathname[pathname.length - 1] !== '/') { pathname += '/'; } } else { pathname = pathname.substring(0, pathname.lastIndexOf('/') + 1); } return pathname; }()); var teamNameKern = fifa.is_mobile ? 11 : 17; var teamMarkupGet = function (idTeam, teamName, teamCountryCode, teamClass, isClubCompetition, teamLink, showTeamLink) { var html_buf = []; html_buf.push('
    '); if (showTeamLink) { html_buf.push(''); } if (isClubCompetition) { html_buf.push('
    '); html_buf.push(''); html_buf.push('', teamName, ''); html_buf.push('
    '); } else { html_buf.push('
    ', teamName, '
    '); } html_buf.push('
    '); html_buf.push('', teamName, ''); html_buf.push('', teamName, ''); html_buf.push('
    '); if (showTeamLink) { html_buf.push('
    '); } html_buf.push('
    '); return html_buf.join(''); }, matchScoreMarkupGet = function (match) { var html_buf = []; html_buf.push('
    '); /* Match Status*/ html_buf.push('
    '); if (match.isSuspended) { html_buf.push('', fifa.vocManager.translate('fifa.suspendedstatus'), ''); } else { if (match.minuteFormatted && (match.minuteFormatted.length > 0 || match.minuteFormatted > 0)) { html_buf.push('', match.minuteFormatted, ''); if (match.minuteFormatted > 0) { html_buf.push("'"); } } if (match.showext) { html_buf.push('+'); } } html_buf.push('
    '); html_buf.push('
    '); if (match.minuteFormatted && (match.minuteFormatted.length > 0 || match.minuteFormatted > 0)) { html_buf.push('', match.minuteFormatted, ''); if (match.minuteFormatted > 0) { html_buf.push("'"); } } if (match.showext) { html_buf.push('+'); } html_buf.push('
    '); /* End Match Status */ /* Match Score / KickOff Time */ html_buf.push('
    '); if (match.isLive || match.isFinished || match.isAbandoned) { var lang = "en"; if (lang.toLowerCase() !== 'ar') { html_buf.push('', match.scoreHome, '-', match.scoreAway, ''); } else { html_buf.push('', match.scoreAway, '-', match.scoreHome, ''); } } else { html_buf.push('', match.kickOffTimeClient, ''); } html_buf.push('
    '); /* End Match Score / KickOff Time */ html_buf.push('
    '); return html_buf.join(''); }, matchReasonWinMarkupGet = function (winReasonText, winReasonTextAbbr) { var html_buf = []; html_buf.push('
    ', winReasonText, '
    '); html_buf.push('
    ', winReasonTextAbbr, '
    '); return html_buf.join(''); }, matchScorerMarkupGet = function (scorerList, teamClass, teamId) { var html_buf = []; html_buf.push('
    '); if (scorerList && scorerList.length > 0) { html_buf.push(''); } html_buf.push('
    '); return html_buf.join(''); }, matchHeaderMenuMarkupGet = function () { var html_buf = []; var _matchesElement = document.getElementById('matches-list'); var _photosElement = document.getElementById('photos'); var _standingsElement = document.getElementById('standings'); var _commentsElement = document.getElementById('comments'); var _lineupsElement = document.getElementById('lineups'); var _playbyplayElement = document.getElementById('playbyplay'); html_buf.push(''); return html_buf.join(''); }, matchHeaderTemplate = function (match) { var html_buf = []; match = $scope.matchdata || match; if (!match) { return; } var $mhRow = angular.element(element[0].querySelector('.mh-row')); if (!$mhRow.length) { /*Container + mh-row*/ html_buf.push('
    '); } /*Col-xs-12*/ html_buf.push('
    '); /*Header Wrap*/ html_buf.push('

    '); var _competitionName = match.competition; if (match.areaIdName) { _competitionName = match.areaIdName; } if (match.competitionUrl) { var _referrer = document.referrer; var _currentlocation = window.location.toString(); var _smartLink = smartLinkManager.getSmartLink(_currentlocation, _referrer, window.backlinks); var _finalLink = ""; var _spanValue = ""; if (_smartLink && _smartLink.link) { _finalLink = _smartLink.link; _spanValue = fifa.vocManager.translate(_smartLink.vocabulary); } else { _finalLink = match.competitionUrl; _spanValue = _competitionName; } html_buf.push('', _spanValue, ''); } else { html_buf.push('', _competitionName, ''); } html_buf.push('

    '); /*End Header Wrap*/ /*Match Header*/ var headerStatusClass = "fixture"; if (match.isFinished) { headerStatusClass = "result"; } if (match.isLive) { headerStatusClass = "live"; } html_buf.push('
    '); /*Match Info*/ html_buf.push('
    '); if (match.stadium && match.stadium !== 'UNKNOWN') { html_buf.push('', match.stadium, ''); } if (match.city && match.city !== 'TBA') { if (match.cityCountryCode && match.cityCountryCode !== 'UNK') { html_buf.push('', match.city, ' (', match.cityCountryCode, ')'); } else { html_buf.push('', match.city, ''); } } /*Match Date/Kick-Off Time*/ html_buf.push('
    '); if (match.fullDateFormatted && match.fullDateFormatted.length > 0) { html_buf.push('', match.fullDateFormatted, ''); } if (match.dateLocal && match.kickOffTime && match.kickOffTime.length > 0) { html_buf.push('-', match.kickOffTime, '', $scope.localTimeLabel, ''); } html_buf.push('
    '); /*End Match Date/Kick-Off Time*/ /*Match Round and Group*/ var round = match.competitionPhase ? fifa.vocManager.translate("fifa.".concat(match.competitionPhase)) : ""; round = round.indexOf('fifa.') === -1 ? round : ""; var group = match.hasGroups && match.seasonPhase ? match.seasonPhase : ""; group = group.length === 1 ? fifa.vocManager.translate('fifa.group').format(group) : group; var roundAndPhase = round === "" && group === "" ? "" : round !== "" && group !== "" ? fifa.vocManager.translate('fifa.maTitle').format(round, group) : round.concat(group); if (roundAndPhase !== "") { html_buf.push('
    ', roundAndPhase, '
    '); } /*End Match Round and Group*/ html_buf.push('
    '); /*End Match Info*/ /*Match Header teams/Result*/ html_buf.push('
    '); html_buf.push(teamMarkupGet(match.teamHomeId, match.teamHomeName, match.homeCountryCode, 'home', match.isClubCompetition, match.homeTeamLink, match.ShowTeamLink)); html_buf.push(teamMarkupGet(match.teamAwayId, match.teamAwayName, match.awayCountryCode, 'away', match.isClubCompetition, match.awayTeamLink, match.ShowTeamLink)); html_buf.push(matchScoreMarkupGet(match)); if (match.reasonWinCode && match.reasonWinCode > 1) { html_buf.push(matchReasonWinMarkupGet(match.winReasonText, match.winReasonTextAbbr)); } html_buf.push(matchScorerMarkupGet(match.listScorerHome, 'home', match.externalTeamHomeId)); html_buf.push(matchScorerMarkupGet(match.listScorerAway, 'away', match.externalTeamAwayId)); html_buf.push('
    '); /*End Match Header teams/Result*/ html_buf.push('
    '); /*End Match Header*/ html_buf.push('
    '); /*End col-xs-12*/ if (!$mhRow.length) { html_buf.push('
    '); /*End mh-row*/ /* Match Header Menu */ if ($scope.locals && $scope.locals.isMobile == false) { html_buf.push(matchHeaderMenuMarkupGet()); } /* End Match Header Menu */ html_buf.push('
    '); /*End container*/ } ($mhRow.length ? $mhRow : element).html(html_buf.join('')); fifa.dispatcher.trigger('menu:view:ajaxSearchItems'); }; matchHeaderTemplate(); var _watchMatchData = $scope.$watch($attr.lsMatchHeader, function (newValue, oldValue) { if ((window.fifa && window.fifa.vocManager && window.fifa.vocManager.vocabularies.length > 0) && _.isEqual(newValue, oldValue)) { return; } if (!newValue) { return; } if (newValue && oldValue) { fifa.dispatcher.trigger('analytics:customPageView', { dataupdates: true }); } matchHeaderTemplate(newValue); if (!fifa.get$PageHeader().length) { fifa.set$PageHeader(); } }, true); element.on('$destroy', function () { _watchMatchData(); }); } } }; }]); ;MatchPageApp.controller('matchListController', ['$scope', '$rootScope', 'middlewareMatchCalls', '$location', '$timeout', '$http', 'matchDataManage', 'utilityManager', function ($scope, $rootScope, middlewareMatchCalls, $location, $timeout, $http, matchDataManage, utilityManager) { $scope.textAllMatches = undefined; $scope.locals = undefined; $scope.matchesDataNoBind = {}; $scope.IdMatch = undefined; $scope.enablePollingFeed = true; $scope.matchType = undefined; $rootScope.controllerToLoad = $rootScope.controllerToLoad + 1; var initialize = function () { $scope.idMatch = angular.element(document.querySelector("div[ng-controller='matchHeaderController']")).attr("data-idcontext"); $scope.locals = { isMobile: fifa.is_mobile }; $scope.localTimeLabel = fifa.vocManager.translate('fifa.localtime'); /*Phase Match*/ $scope.lineupLabel = fifa.vocManager.translate('fifa.lineups'); $scope.halfTimeLabel = fifa.vocManager.translate('fifa.half-time'); $scope.endSecondHalfLabel = fifa.vocManager.translate('fifa.end2ndhalf'); $scope.endFirstExtraLabel = fifa.vocManager.translate('fifa.endfirstextra'); $scope.endSecondExtraLabel = fifa.vocManager.translate('fifa.endsecondextra'); $scope.penaltyLabel = fifa.vocManager.translate('fifa.penaltiesphase'); $scope.fullTimeLabel = fifa.vocManager.translate('fifa.full-time'); $scope.abandonedLabel = fifa.vocManager.translate('fifa.abandonedStatus'); $scope.abandonedLabelAbbr = fifa.vocManager.translateAbbr('fifa.abandonedStatus'); $scope.forfeitedLabelAbbr = fifa.vocManager.translateAbbr('fifa.forfeited'); $scope.forfeitedLabel = fifa.vocManager.translate('fifa.forfeited'); $scope.lineupLabelAbbr = fifa.vocManager.translateAbbr('fifa.lineups'); $scope.halfTimeLabelAbbr = fifa.vocManager.translateAbbr('fifa.half-time'); $scope.endSecondHalfLabelAbbr = fifa.vocManager.translateAbbr('fifa.end2ndhalf'); $scope.endFirstExtraLabelAbbr = fifa.vocManager.translateAbbr('fifa.endfirstextra'); $scope.endSecondExtraLabelAbbr = fifa.vocManager.translateAbbr('fifa.endsecondextra'); $scope.penaltyLabelAbbr = fifa.vocManager.translateAbbr('fifa.penaltiesphase'); $scope.fullTimeLabelAbbr = fifa.vocManager.translateAbbr('fifa.full-time'); $rootScope.$emit('app.controllerLoaderManage'); utilityManager.replaceMoreUrl("match", "/matches", ".ls-matches-link"); }; $rootScope.$on('match.matchListLoaded', function (event, data) { $scope.loadMatches(data); }); $scope.loadMatches = function (data) { for (var i = 0; i < data.matches.length; i++) { matchDataManage.matchDataCreate(data.matches[i], $scope); } $scope.matches = data.matches; if ($scope.enablePollingFeed) { $scope.loadLiveMatches(); $scope.timedLoadLiveInfo(); } }; $scope.loadLiveMatches = function (matchLive) { middlewareMatchCalls.getLiveMatches(function (data) { var i = 0, l = $scope.matches.length; for (i; i < l; i++) { var _match = $.extend({}, $scope.matches[i]); var _seasonMatch = data[_match.idCupSeason]; if (_seasonMatch) { var _matchLiveData = _.find(_seasonMatch.matchlist, function (match) { return match.id == _match.idMatch; }); if (_matchLiveData) { matchDataManage.LiveMatchDataMerge(_match, _matchLiveData, $scope); $scope.matches[i] = _match; } } } }, $http); }; var _live_info_promise = null; $scope.timedLoadLiveInfo = function () { if (_live_info_promise) { $timeout.cancel(_live_info_promise); $scope.loadLiveMatches(); } _live_info_promise = $timeout($scope.timedLoadLiveInfo, '10000'.withRandomShift()); }; $rootScope.$on('FinishLoadFifaConfigMatchApp', function () { initialize(); }); $scope.GetTeamLogo = function (team, type, size) { return matchDataManage.getTeamImage(team, type, size); }; }]); ;/*global fifa : false*/ /*global _ : false*/ /*global MatchPageApp : false*/ MatchPageApp.controller('playByPlayController', ['$scope', '$rootScope', function ($scope, $rootScope) { $scope.matchevents = undefined; $scope.limitEventDisplay = 5; $scope.clickMore = false; $rootScope.controllerToLoad = $rootScope.controllerToLoad + 1; $scope.match = undefined; $scope.textProvisionalMatch = undefined; $scope.locals = undefined; var initialize = function () { $scope.moreLabel = fifa.vocManager.translate('fifa.more'); $scope.closeLabel = fifa.vocManager.translate('fifa.close'); $scope.textProvisionalMatch = fifa.vocManager.translate('fifa.provisionalMatch'); $rootScope.$emit('app.controllerLoaderManage'); }; $scope.moreClick = function ($event) { if ($scope.clickMore) { $scope.clickMore = false; $scope.limitEventDisplay = 5; if ($scope.moreButtonOffsetTop) { window.scrollTo(0, $scope.moreButtonOffsetTop); } $scope.checkDisplayPlayByPlay($scope.match); } else { $scope.clickMore = true; $scope.moreButtonOffsetTop = $event.currentTarget.offsetTop; $scope.limitEventDisplay = $scope.match.events.length; $scope.checkDisplayPlayByPlay($scope.match); } }; $scope.translateEvent = function (event) { var eventTranslate = fifa.vocManager.translate(event.tag); /* var player = _.filter($scope.match.lineups.teams.home.concat($scope.match.lineups.teams.away), function (el) { return el.externalId == event.idPlayer; }); if (player.length === 0) { var _pl = _.filter($scope.match.lineups.teams.substitutes, function (el) { return el.homePlayer.externalId == event.idPlayer; }); if (_pl.length > 0) { player.push(_pl[0].homePlayer); } else { _pl = _.filter($scope.match.lineups.teams.substitutes, function (el) { return el.awayPlayer.externalId == event.idPlayer; }); if (_pl.length > 0) { player.push(_pl[0].awayPlayer); } } } if (player.length) { eventTranslate = $scope.replaceEventPlaceHolder(player[0], eventTranslate, event.eventCode); }*/ eventTranslate = $scope.replaceEventPlaceHolder(event, eventTranslate, event.eventCode); if (event.eventCode == 5 && event.phase == 5) { var text_direction = "en" == 'ar' ? 'rtl' : 'ltr'; var pso_goals = ['(']; pso_goals.push(event.homeGoals, ' - ', event.awayGoals); pso_goals.push(')'); eventTranslate = pso_goals.join('') + ' ' + eventTranslate; } return eventTranslate; }; $rootScope.$on('match.matchInfoLoaded', function (event, data) { if (data.match.hasFullCoverage) { $scope.match = data.match; $scope.locals = { isMatchFinished: data.match.isFinished, hasMatchReport: data.match.hasReport }; $scope.checkDisplayPlayByPlay(data.match); } else { angular.element(document.getElementById('playbyplay')).remove(); } }); $rootScope.$on('match.reloadPlayByPlay', function (event, match) { $scope.match = match; $scope.checkDisplayPlayByPlay(match); }); $rootScope.$on('FinishLoadFifaConfigMatchApp', function () { initialize(); }); $scope.checkDisplayPlayByPlay = function (match) { if (!match.hasLineup) { var pbp = document.getElementById("playbyplay"); if (pbp) { angular.element(pbp).remove(); } return; } if (match.isLive || match.isFinished) { if (match.events.length > 0) { $scope.EventAddClassIcon(match.events); $scope.matchevents = []; if ($scope.limitEventDisplay < match.events.length) { for (var e = 0; e < $scope.limitEventDisplay; e++) { if (match.events[e]) { $scope.matchevents.push(match.events[e]); } } } else { $scope.matchevents = match.events; } angular.element(document.getElementById("leaderboard")).remove(); angular.element(document.getElementById("playbyplay")).removeClass('hidden'); angular.element(document.querySelector("div[id='playbyplay'] > div")).removeClass('hidden'); } } }; $scope.replaceEventPlaceHolder = function (event, eventText, eventCode) { var _t = eventText; if (eventCode == 4) { _t = _t.replace('@@player1', event.playerToName); _t = _t.replace('@@player2', event.playerName); } else { _t = _t.replace('@@player1', event.playerName); } _t = _t.replace('@@team1', event.teamName); _t = _t.replace('@@teamID', event.teamName); return _t; }; $scope.EventAddClassIcon = function (events) { for (var i = 0; i < events.length; i++) { $scope.EventIconClassSet(events[i]); } }; $scope.EventIconClassSet = function (event) { var iconClass = 'event-icon'; event.showMinute = true; switch (event.eventCode) { case 3: if (event.subKindCode == 'P') { iconClass = iconClass + ' goal-penalty'; } else if (event.subKindCode == 'O') { iconClass = iconClass + ' goal-own'; } else { iconClass = iconClass + ' goal'; } break; case 1: iconClass = iconClass + ' yellow-card'; break; case 2: if (event.subKindCode == 'P') { iconClass = iconClass + ' yellow-card-second'; } iconClass = iconClass + ' red-card'; break; case 4: iconClass = iconClass + ' substitution-in-out'; break; case 5: if (event.subKindCode == 'D') { if (event.phase == 5) { iconClass = iconClass + ' penalty'; } else { iconClass = iconClass + ' goal-penalty'; } } else { iconClass = iconClass + ' penalty-wrong'; } break; case 13: event.showMinute = false; if (event.phase == 1 || event.phase == 3) { iconClass = iconClass + ' first-start'; } else if (event.phase == 2 || event.phase == 4) { iconClass = iconClass + ' second-start'; } break; case 14: event.showMinute = false; if (event.phase == 1 || event.phase == 3) { iconClass = iconClass + ' first-end'; } else if (event.phase == 2 || event.phase == 4) { iconClass = iconClass + ' second-end'; } break; } event.iconClass = iconClass; }; }]).directive('lsMatchEventList', function () { return { restrict: 'A', scope: true, link: { post: function ($scope, element, $attr) { var matchEventListTemplate = function (eventList) { var html_buf = []; eventList = $scope.matchevents || eventList; if (!eventList) { return; } html_buf.push('
    '); for (var e = 0; e < eventList.length; e++) { var event = eventList[e]; if (event.tag) { html_buf.push('
    '); if (event.showMinute && (event.minute && event.minute.length > 0)) { html_buf.push('', event.minute, ''); } html_buf.push(''); html_buf.push('', $scope.translateEvent(event), ''); html_buf.push('
    '); } else { fifa.warn('no tag found for', event); } } html_buf.push('
    '); element.html(html_buf.join('')); }; var _watchMatchEventListData = $scope.$watch($attr.lsMatchEventList, function (newValue, oldValue) { if ((window.fifa && window.fifa.vocManager && window.fifa.vocManager.vocabularies.length > 0) && _.isEqual(newValue, oldValue)) { return; } if (!newValue) { return; } matchEventListTemplate(); }, true); element.on('$destroy', function () { _watchMatchEventListData(); }); } } }; }); ;/*global fifa : false*/ /*global _ : false*/ /*global MatchPageApp : false*/ MatchPageApp.controller('lineupController', ['$scope', '$rootScope', 'matchDataManage', function ($scope, $rootScope, matchDataManage) { $scope.match = undefined; $scope.substitutesLabel = undefined; $scope.coachLabel = undefined; $scope.capitanAbbr = undefined; $scope.goalKeeperAbbr = undefined; $scope.capitanGoalKeeperAbbr = undefined; $scope.yellowCardLabel = undefined; $scope.redCardLabel = undefined; $scope.secondYellowLabel = undefined; $scope.ownGoalLabel = undefined; $scope.penaltyGoalLabel = undefined; $scope.goalLabel = undefined; $scope.playerInLabel = undefined; $scope.playerOutLabel = undefined; $scope.halfTimeAbbr = undefined; $rootScope.controllerToLoad = $rootScope.controllerToLoad + 1; var initialize = function () { $scope.substitutesLabel = fifa.vocManager.translate('fifa.substitutes'); $scope.coachLabel = fifa.vocManager.translate('fifa.coach'); $scope.officialLabel = fifa.vocManager.translate('fifa.officials'); $scope.capitanAbbr = fifa.vocManager.translate('fifa.mcCaptain'); $scope.goalKeeperAbbr = fifa.vocManager.translate('fifa.mcGoalKeeper'); $scope.capitanGoalKeeperAbbr = fifa.vocManager.translate('fifa.mcGK_C'); $scope.yellowCardLabel = fifa.vocManager.translate('fifa.yellowCard'); $scope.redCardLabel = fifa.vocManager.translate('fifa.redCard'); $scope.secondYellowLabel = fifa.vocManager.translate('fifa.2yellowCards'); $scope.ownGoalLabel = fifa.vocManager.translate('fifa.ownGoal'); $scope.penaltyGoalLabel = fifa.vocManager.translate('fifa.penalty'); $scope.goalLabel = fifa.vocManager.translate('fifa.goal'); $scope.playerInLabel = fifa.vocManager.translate('fifa.in'); $scope.playerOutLabel = fifa.vocManager.translate('fifa.out'); $scope.halfTimeAbbr = fifa.vocManager.translateAbbr('fifa.half-time'); $rootScope.$emit('app.controllerLoaderManage'); }; $rootScope.$on('match.matchInfoLoaded', function (event, data) { if (data.match.hasFullCoverage) { $scope.match = data.match; checkDisplayLinuep($scope.match); } }); $rootScope.$on('match.reloadLineup', function (event, match) { $scope.match = match; checkDisplayLinuep($scope.match); }); $rootScope.$on('FinishLoadFifaConfigMatchApp', function () { initialize(); }); $scope.GetTeamLogo = function (team, type) { return matchDataManage.getTeamImage(team, type); }; }]); function checkDisplayLinuep(match) { if (match.hasFullCoverage) { var _linuepHome = _.filter(match.lineups.teams.home, function (el) { if (el.startingLineUp) { return el; } }); var _linuepAway = _.filter(match.lineups.teams.away, function (el) { if (el.startingLineUp) { return el; } }); var _lineupHomePlayers = _.filter(_linuepHome, function (pl) { return pl.personKind !== -1; }); var _lineupAwayPlayers = _.filter(_linuepHome, function (pl) { return pl.personKind !== -1; }); if (_lineupHomePlayers.length === 11 && _lineupAwayPlayers.length === 11 && match.hasLineup) { angular.element(document.getElementById('lineups')).removeClass('hidden'); } } } ;MatchPageApp.controller('standingController', ['$scope', '$rootScope', 'StandingService', 'standingsManager', 'utilityManager', 'matchDataManage', function ($scope, $rootScope, StandingService, standingsManager, utilityManager, matchDataManage) { $scope.match = undefined; $scope.teamsLabel = undefined; $scope.clubsLabel = undefined; $scope.matchPlayedLabel = undefined; $scope.matchPlayedLabelAbbr = undefined; $scope.matchWonLabel = undefined; $scope.matchWonLabelAbbr = undefined; $scope.matchDrawLabel = undefined; $scope.matchDrawLabelAbbr = undefined; $scope.matchLoseLabel = undefined; $scope.matchLoseLabelAbbr = undefined; $scope.matchGoalForLabel = undefined; $scope.matchGoalForLabelAbbr = undefined; $scope.matchGoalAgainstLabel = undefined; $scope.matchGoalAgainstLabelAbbr = undefined; $scope.matchGoalDiffLabel = undefined; $scope.matchGoalDiffLabelAbbr = undefined; $scope.pointsLabel = undefined; $scope.pointsLabelAbbr = undefined; $scope.standingsData = undefined; $scope.limitEventDisplay = 5; $scope.locals = undefined; $rootScope.controllerToLoad = $rootScope.controllerToLoad + 1; var initialize = function () { $scope.locals = { isMobile: fifa.is_mobile }; $scope.teamsLabel = fifa.vocManager.translate('fifa.teams'); $scope.clubsLabel = fifa.vocManager.translate('fifa.clubs'); $scope.matchPlayedLabel = fifa.vocManager.translate('fifa.groupStanding.played'); $scope.matchPlayedLabelAbbr = fifa.vocManager.translateAbbr('fifa.groupStanding.played'); $scope.matchWinLabel = fifa.vocManager.translate('fifa.groupStanding.win'); $scope.matchWinLabelAbbr = fifa.vocManager.translateAbbr('fifa.groupStanding.win'); $scope.matchDrawLabel = fifa.vocManager.translate('fifa.groupStanding.draw'); $scope.matchDrawLabelAbbr = fifa.vocManager.translateAbbr('fifa.groupStanding.draw'); $scope.matchLoseLabel = fifa.vocManager.translate('fifa.groupStanding.loss'); $scope.matchLoseLabelAbbr = fifa.vocManager.translateAbbr('fifa.groupStanding.loss'); $scope.matchGoalForLabel = fifa.vocManager.translate('fifa.groupStanding.goalFor'); $scope.matchGoalForLabelAbbr = fifa.vocManager.translateAbbr('fifa.groupStanding.goalFor'); $scope.matchGoalAgainstLabel = fifa.vocManager.translate('fifa.groupStanding.goalAgainst'); $scope.matchGoalAgainstLabelAbbr = fifa.vocManager.translateAbbr('fifa.groupStanding.goalAgainst'); $scope.matchGoalDiffLabel = fifa.vocManager.translate('fifa.groupStandingsGoalDiff'); $scope.matchGoalDiffLabelAbbr = fifa.vocManager.translateAbbr('fifa.groupStandingsGoalDiff'); $scope.pointsLabel = fifa.vocManager.translate('fifa.groupStanding.points'); $scope.pointsLabelAbbr = fifa.vocManager.translateAbbr('fifa.groupStanding.points'); $rootScope.$emit('app.controllerLoaderManage'); utilityManager.replaceMoreUrl("match", "/matches", ".ls-standings-link"); }; $scope.GetStandingsData = function () { StandingService.GetCompetitionStandings(function (data) { $scope.standingsData = data.standing; $scope.checkDisplayStandings(); }, $scope.match.seasonPhaseId); }; $rootScope.$on('FinishLoadFifaConfigMatchApp', function () { initialize(); }); $rootScope.$on('match.matchInfoLoaded', function (event, data) { if (data.match) { $scope.match = data.match; } $scope.GetStandingsData(); }); $rootScope.$on('match.reloadStandings', function (event, match) { if (match) { $scope.match = match; } $scope.GetStandingsData(); }); $scope.GetTeamLogo = function (team, type, size) { return matchDataManage.getTeamImage(team, type, size); }; $scope.checkDisplayStandings = function() { if ($scope.standingsData.length > 0) { angular.element(document.querySelector("div[id='standings']")).removeClass('hidden'); angular.element(document.querySelector("div[id='standings'] > div")).removeClass('hidden'); } fifa.dispatcher.trigger('menu:view:ajaxDiscoverHideableItems'); }; }]);