competition.b9678d434b86a6680437.js
4.41 KB
(window.webpackJsonp=window.webpackJsonp||[]).push([["529f"],{kkUF:function(e,t,a){"use strict";a.r(t);a("QlAx"),a("P+Gd");var n=function(e,t){return{restrict:"A",replace:!0,scope:{stages:"="},templateUrl:"stage-select",link:function(a,n,r){a.season=t.season,a.tree=t.currentStage.tree.split(","),a.order=function(e){return"group"==e.type?e.name:e.meta.startDate},function(){a.currentStageName=function e(a){var n="";return t.stages[a.parent]&&(n=e(t.stages[a.parent]),n+=" - "),n+a.name}(t.currentStage),a.currentStageName==t.season.name&&(a.currentStageName="All Stages")}(),n.bind("click",function(){a.clicked=1}),e.bind("click",function(){a.clicked||(a.show=!1,a.$apply()),a.clicked=0})}}};n.$inject=["$document","$rootScope"];var r=n,c=a("KHs0");angular.module("footyroom").requires.push("fr.matchViewHelper","fr.datepicker",c.a),angular.module("footyroom").controller("ExtraContentCtrl",["$scope","$element","$timeout",function(e,t,a){e.onClick=function(){e.$broadcast("ec.interacted")},a(function(){t.find(".simple-tab:visible a").first().triggerHandler("click")},0)}]).controller("leagueCalendarCtrl",["$scope","$window","$http","$filter",function(e,t,a,n){var r;function c(t){e.matchesCount=0;var a={};e.matchesByDate=_(t).reduce(function(t,n){return a[n.date]||(a[n.date]={date:n.date,matches:[]},t.push(a[n.date])),a[n.date].matches.push(n),e.matchesCount++,t},[])}function s(e,t){r=e;var n={};t||(n["Cache-Control"]="no-cache"),$(".calendar-fixtures").litelay({spinner:!0}),a.get("/matches.json",{params:e,headers:n}).then(function(t){r==e&&(c(t.data),$(".calendar-fixtures").litelay({off:!0}))})}e.datepickerCtrl={},e.datepickerOptions={dates:_(t.DataStore.matchDays.days).map(function(e){return new Date(e)}),currentDay:new Date(t.DataStore.matchDays.currentDay),weekly:!0,onChange:function(e,a){e=new Date(n("date")(e,"yyyy-MM-dd")+"T00:00:00Z"),a&&(a=new Date(n("date")(a,"yyyy-MM-dd")+"T23:59:59Z"));s({stageTree:t.DataStore.currentStage.tree,date:a?void 0:e.getTime()/1e3,minDate:a?e.getTime()/1e3:void 0,maxDate:a?a.getTime()/1e3:void 0},!0)},ctrl:e.datepickerCtrl},c(t.DataStore.matches),e.$on("ec.interacted",function(){e.interacted=!0}),e.reload=function(){r?s(r):e.datepickerCtrl.scope.notifyDateChange()}}]).controller("TablesController",["$scope","$filter",function(e,t){function a(e){var t=new Date,n=_.sortBy(e,function(e){if(!e.haveTables&&!e.childrenHaveTables)return 99999999999999;var a=e.meta.startDate-t,n=e.meta.endDate-t;return Math.min(Math.abs(a),Math.abs(n))})[0];return n.childrenAreGroups||n.haveTables?n:a(n.children)}function n(t){var a=t.name;return e.stages[t.parent]&&(a=n(e.stages[t.parent])+" - "+a),a}e.tables=DataStore.tables,e.isGroups=e.tables.length>1,e.sortie="adjustedRank",e.reversed=!1,e.activeTableStage=function t(n){if("group"===n.type&&n.haveTables)return e.stages[n.parent]||e.season;if(n.haveTables)return n;if(n.childrenHaveTables)return a(n.children);if(e.stages[n.parent])return t(e.stages[n.parent]);return a(e.data.stages)}(e.currentStage),e.activeTableName=n(e.activeTableStage),e.tables.forEach(function(e){var t=e.participants,a=e.spots;if(!a)return;Object.values(a).forEach(function(e){e.first&&(e.ranks=_.range(1,e.first+1)),e.last&&(e.ranks=_.range(t.length-e.last+1,t.length+1)),function(e,t){e.forEach(function(e){-1!==t.ranks.indexOf(e.rank)&&(e.spots=e.spots||[],e.spots.push(t.code))})}(t,e)}),e.legend=Object.values(a).sort(function(e,t){return e.ranks[0]-t.ranks[0]})}),e.setActive=function(t){e.activeTableStage=t,e.activeTableName=n(t),e.show=!1},e.treeName=function(e,t){return e?e+" - "+t:t},e.goalDifference=function(e){if(e.data)return((e.data.goalsfor||{}).value||0)-((e.data.goalsagainst||{}).value||0)},_.each(e.tables,function(a,n){var r=t("orderBy")(e.tables[n].participants,["-rank",e.goalDifference,"data.goalsfor.value","-name"],!0);_.each(a.participants,function(t,a){e.tables[n].participants[a].adjustedRank=r.indexOf(t)+1})}),e.sortBy=function(e,t){this.sortie===e?this.reversed=!this.reversed:(this.sortie=e,this.reversed="asc"!==t)}}]).directive("frCaMatch",["matchViewHelper",function(e){return{restrict:"A",link:function(t,a,n){t.match=t.$eval(n.frCaMatch),e.setScore(t.match),e.setMinutes(t.match),e.setMainIncidents(t.match),t.onClick=function(){t.match.incidents.length>0&&(t.opened=!t.opened)}}}}]).directive("statCard",function(){return{restrict:"A",replace:!0,scope:{type:"@",title:"@cardTitle",data:"="},templateUrl:"league-stats-table-template"}}).directive("stageSelect",r)}},[["kkUF","d41d","ef19","c50d"]]]);