UNPKG

@cevo/angular-gte

Version:

Angular Libraries for communicating with the Gfinity API v2

1 lines 14.3 kB
"use strict";"format amd";!function(){module.exports=function(t,e,r,n){return t.module("cevo.gte",["ngResource","ngStorage","cevo.util"]).provider("gte",function(){var t={};return{$get:function(){return t}}}),"cevo.gte"}(require("angular"),require("angular-resource"),require("ngstorage"),require("@cevo/angular-util"))}();var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};angular.module("cevo.gte").factory("Article",["$http","$q","$sce","cevo","Logger",function(t,e,r,n,o){function a(e){var o={id:e,getUrl:function(t){return n.endpoint+"news/"+this.id+(t?"/"+t:"")},$get:function(e){e&&(o.id=e);var n={};return t({method:"GET",url:o.getUrl(),params:n}).then(function(t){if(t){var e=t.data.news;return e.content=r.trustAsHtml(e.content),angular.extend(o,e)}})},$comments:function(){var e={};return t({method:"GET",url:o.getUrl("comments"),params:e}).then(function(t){return o.comments=t.data.comments,o.comments})}};return"object"===(void 0===e?"undefined":_typeof(e))&&(angular.extend(o,e),o.id="object"===_typeof(o.id)?0:o.id),o}return a}]);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};angular.module("cevo.gte").factory("FranchiseLeaderboard",["$http","$q","cevo","Logger",function(t,e,r,n){function o(e){var n={id:e,leaderboard:[],getUrl:function(t){return r.endpoint+"franchiseLeaderboards/"+this.id+(t?"/"+t:"")},$get:function(e){e&&(n.id=e);var r={};return t({method:"GET",url:n.getUrl(),params:r}).then(function(t){var e=t.data.leaderboard;return n.leaderboard=e,n.leaderboard})}};return"object"===(void 0===e?"undefined":_typeof(e))&&(angular.extend(n,e),n.id="object"===_typeof(n.id)?0:n.id),n}return o}]);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};angular.module("cevo.gte").factory("Match",["$http","$q","cevo","Logger",function(t,e,r,n){function o(e){var n={id:e,getUrl:function(t){return r.endpoint+"matches/"+this.id+(t?"/"+t:"")},$get:function(e){e&&(n.id=e);var r={};return t({method:"GET",url:n.getUrl(),params:r}).then(function(t){if(t)return angular.extend(n,t.data.match),t.data.match})},$vods:function(e){e&&(n.id=e);var r={};return t({method:"GET",url:n.getUrl("vods"),params:r}).then(function(t){if(t)return angular.extend(n,t.data.vods),t.data.vods})}};return"object"===(void 0===e?"undefined":_typeof(e))&&(angular.extend(n,e),n.id="object"===_typeof(n.id)?0:n.id),n}return o}]);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};angular.module("cevo.gte").factory("Member",["$http","$q","cevo","Logger",function(t,e,r,n){function o(e){var n={id:e,getUrl:function(t){return r.endpoint+"profile/"+this.id+(t?"/"+t:"")},$get:function(e){e&&(n.id=e);var r={};return t({method:"GET",url:n.getUrl(),params:r}).then(function(t){if(t)return angular.extend(n,t.data.user),t.data.user})},$teams:function(){var e={};return t({method:"GET",url:n.getUrl("teams"),params:e}).then(function(t){if(t)return angular.extend(n,t.data),t.data})}};return"object"===(void 0===e?"undefined":_typeof(e))&&(angular.extend(n,e),n.id="object"===_typeof(n.id)?0:n.id),n}return o}]);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};angular.module("cevo.gte").factory("Realsport",["$http","$q","$sce","cevo","Logger",function(t,e,r,n,o){function a(t){return"object"===(void 0===t?"undefined":_typeof(t))&&(angular.extend(obj,t),obj.id="object"===_typeof(obj.id)?0:obj.id),obj}return a}]);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};angular.module("cevo.gte").factory("Season",["$http","$q","cevo","Logger","Team",function(t,e,r,n,o){function a(e){var n={id:e,getUrl:function(t){return r.endpoint+"seasons/"+this.id+(t?"/"+t:"")},$get:function(e){e&&(n.id=e);var r={};return t({method:"GET",url:n.getUrl(),params:r}).then(function(t){if(t)return angular.extend(n,t.data.season),t.data.season})},$team:function(e){var a={};return t({method:"GET",url:n.getUrl("teams/"+e),params:a}).then(function(t){return n.team=r.util.objectify(t.data,o),n.team.team})},$teams:function(){var e={};return t({method:"GET",url:n.getUrl("teams"),params:e}).then(function(t){return n.teams=r.util.objectify(t.data.teams,o),n.teams})}};return"object"===(void 0===e?"undefined":_typeof(e))&&(angular.extend(n,e),n.id="object"===_typeof(n.id)?0:n.id),n}return a}]);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};angular.module("cevo.gte").factory("Team",["$http","$q","cevo","Logger","Member",function(t,e,r,n,o){function a(e){var a={id:e,players:{},getUrl:function(t){return r.endpoint+"teams"+(t?"/"+t:"")},$get:function(e){e&&(a.id=e);var r={};return t({method:"GET",url:a.getUrl(a.id),params:r}).then(function(t){n.debug("team get",t),a=angular.extend(a,t.data.team)})},$players:function(e){var n={};return t({method:"GET",url:r.endpoint+"seasons/"+e+"/teams/"+a.id+"/players",params:n}).then(function(t){return r.util.objectify(t.data.players,o)})}};return"object"===(void 0===e?"undefined":_typeof(e))&&(angular.extend(a,e),a.id="object"===_typeof(a.id)?0:a.id),a}return a}]);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};angular.module("cevo.gte").factory("Tournament",["$http","$q","cevo","Logger","Match","Team",function(t,e,r,n,o,a){function u(e){var n={id:e,matches:{all:[],round:[],upcoming:[],past:[]},getUrl:function(t){return r.endpoint+"tournaments/"+this.id+(t?"/"+t:"")},$get:function(e){e&&(n.id=e);var r={};return t({method:"GET",url:n.getUrl(),params:r}).then(function(t){if(t)return angular.extend(n,t.data.tournament),n})},$matches:function(){var e={};return t({method:"GET",url:n.getUrl("matches"),params:e}).then(function(t){return n.matches.all=r.util.objectify(t.data.matches,o),n.matches.all})},$pastMatches:function(){var e={};return t({method:"GET",url:n.getUrl("matches/results"),params:e}).then(function(t){return n.matches.past=r.util.objectify(t.data.matches,o),n.matches.past})},$placements:function(){var e={};return t({method:"GET",url:n.getUrl("placements"),params:e}).then(function(t){return n.placements=t.data.placements,n.placements})},$roundMatches:function(e){var a={};return t({method:"GET",url:n.getUrl("matches/round/"+e),params:a}).then(function(t){return n.matches.round[e]=r.util.objectify(t.data.matches,o),n.matches.round[e]})},$standings:function(){var e={};return t({method:"GET",url:n.getUrl("table"),params:e}).then(function(t){return n.standings=t.data.table,n.standings})},$teams:function(e){var o={};return t({method:"GET",url:n.getUrl("teams"+(e?"/"+e:"")),params:o}).then(function(t){return n.teams=r.util.objectify(t.data.teams,a),n.teams})},$team:function(e){var r={},o=e;return t({method:"GET",url:n.getUrl("teams"),params:r}).then(function(t){var e=t.data.teams.filter(function(t){return t.id===o});return angular.extend(n,e[0])})},$upcomingMatches:function(){var e={};return t({method:"GET",url:n.getUrl("matches/fixtures"),params:e}).then(function(t){return n.matches.upcoming=r.util.objectify(t.data.matches,o),n.matches.upcoming})}};return"object"===(void 0===e?"undefined":_typeof(e))&&(angular.extend(n,e),n.id="object"===_typeof(n.id)?0:n.id),n}return u}]);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};angular.module("cevo.gte").factory("VOD",["$http","$q","cevo","Logger",function(t,e,r,n){function o(e){var n={id:e,getUrl:function(t){return r.endpoint+"liveTv/vod/"+this.id+(t?"/"+t:"")},$get:function(e){e&&(n.id=e);var r={};return t({method:"GET",url:n.getUrl(),params:r}).then(function(t){if(t)return angular.extend(n,t.data.vod),t.data.vod})}};return"object"===(void 0===e?"undefined":_typeof(e))&&(angular.extend(n,e),n.id="object"===_typeof(n.id)?0:n.id),n}return o}]),angular.module("cevo.gte").provider("settings",function(){var t={origin:"",token:"",tokenType:""};return{setOrigin:function(e){t.origin=e},setToken:function(e){t.token=e},setTokenType:function(e){t.tokenType=e},$get:function(){return t}}}),angular.module("cevo.gte").service("FranchiseLeaderboards",["$rootScope","$http","Logger","cevo","FranchiseLeaderboard",function(t,e,r,n,o){var a=this;return a.list=[],a.$list=function(t){return e({method:"GET",url:n.endpoint+"franchiseLeaderboards"}).then(function(t){return a.list=n.util.objectify(t.data.leaderboards,o),a.list})},a}]),angular.module("cevo.gte").service("LiveTV",["$rootScope","$http","Logger","cevo","VOD",function(t,e,r,n,o){var a=this;return a.$vods=function(t,r,a){return e({method:"GET",url:n.endpoint+"liveTv/vod"+(t?"/tags/"+t:""),params:{pageSize:r,page:a}}).then(function(t){return n.util.objectify(t.data.vods,o)})},a.$channels=function(){return e({method:"GET",url:n.endpoint+"liveTv/channels"}).then(function(t){return t.data.channels})},a}]),angular.module("cevo.gte").service("News",["$rootScope","$http","Logger","cevo","Article",function(t,e,r,n,o){var a=this;return a.$list=function(t,r,a,u,i){var c={page_size:r,page:a};return u&&(c.is_featured=u),i&&(c.category_id=i),e({method:"GET",url:n.endpoint+"news"+(t?"/tags/"+t:""),params:c}).then(function(t){return{meta:t.data.meta,news:n.util.objectify(t.data.news,o)}})},a.$getByCategory=function(t,r,a,u,i){var c={category_id:t,page_size:r,page:a};if(u){switch(i){case"before":case"after":break;default:i="after"}c["published_"+i]=u}return e({method:"GET",url:n.endpoint+"news",params:c}).then(function(t){return{meta:t.data.meta,news:n.util.objectify(t.data.news,o)}})},a.$categories=function(){var t={page_size:50,page:1};return e({method:"GET",url:n.endpoint+"news/categories",params:t}).then(function(t){return t.data.categories})},a}]),angular.module("cevo.gte").service("RealsportFeed",["$rootScope","$http","Logger","cevo","Realsport",function(t,e,r,n,o){var a=this;return a.$list=function(t){return e({method:"GET",url:"https://realsport101.com/wp-json/wp/v2/posts",params:{per_page:t,_embed:!0},skip:!0}).then(function(t){return t.data})},a}]),angular.module("cevo.gte").service("Seasons",["$rootScope","$http","Logger","cevo","Season",function(t,e,r,n,o){var a=this;return a.$list=function(t,r,a){return e({method:"GET",url:n.endpoint+"seasons",params:{pageSize:r,page:a}}).then(function(t){return n.util.objectify(t.data.news,o)})},a}]),angular.module("cevo.gte").service("Sort",["$http","cevo","Logger","$sce",function(t,e,r,n){var o=this;return o.sortArrayOfObjects=function(){var t=arguments,e=this;return function(r,n){for(var o=0,a=0,u=t.length;0===a&&o<u;)a=e.sortArrayOfObjectsByProperty(t[o])(r,n),o++;return a}},o.sortArrayOfObjectsByProperty=function(t){var e=1;return"-"===t[0]&&(e=-1,t=t.substr(1)),function(r,n){var o=r[t],a=n[t],u=parseInt(o),i=parseInt(a);return o==u&&a==i&&(o=u,a=i),(o<a?-1:o>a?1:0)*e}},o}]),angular.module("cevo.gte").service("Tournaments",["$rootScope","$http","Logger","cevo","Tournament",function(t,e,r,n,o){var a=this;return a.list=[],a.$list=function(t){return e({method:"GET",url:n.endpoint+"tournaments"+(t?"/"+t:"")}).then(function(t){return a.list=n.util.objectify(t.data.tournaments,o),a.list})},a}]),angular.module("cevo.gte").service("Twitter",["$http","cevo","Logger","$sce",function(t,e,r,n){var o=this;return o.$search=function(e,r){return t({method:"GET",url:"https://api.cevo.com/1.0/twitter/search/",params:{search:e,count:r}}).then(function(t){return t.data.data.results})},o.$fromUser=function(e,n){return r.debug("fetching twitter results from user ",e,n),t({method:"GET",url:"https://api.cevo.com/1.0/twitter/fromuser/",params:{user:e,count:n}}).then(function(t){return r.debug("twitter fromuser saw data",t),t.data.data.results})},o.ProcessText=function(t){t.text=t.full_text.substr(t.display_text_range[0],t.display_text_range[1])},o.ProcessURLs=function(t){var e=t.entities.urls;if(!e||e.length<=0)return!0;r.debug("twitter","Processing URLs for post",t,e);for(var o in e)t.text=t.text.replace(RegExp(e[o].url,"g"),n.trustAsUrl('<a href="'+e[o].expanded_url+'" target="_blank">'+e[o].url+"</a>"))},o.ProcessHashtags=function(t){var e=t.entities.hashtags;if(!e||e.length<=0)return!0;r.debug("twitter","Processing hashtags for post",t,e);for(var o in e)t.text=t.text.replace(RegExp("#"+e[o].text,"g"),n.trustAsUrl('<a href="https://twitter.com/search?q=%23'+e[o].text+'" target="_blank">#'+e[o].text+"</a>"))},o.ProcessMentions=function(t){var e=t.entities.user_mentions;if(!e||e.length<=0)return!0;r.debug("twitter","Processing mentions for post",t,e);for(var o in e)t.text=t.text.replace(RegExp("@"+e[o].screen_name,"g"),n.trustAsUrl('<a href="https://twitter.com/'+e[o].screen_name+'" target="_blank">@'+e[o].screen_name+"</a>"))},o.ProcessMedia=function(t){var e=t.entities.media;if(!e||e.length<=0)return!0;r.debug("twitter","Processing media for post",t,e);for(var n in e)t.text=t.text.replace(RegExp(e[n].url,"g"),""),t.image=e[n]},o}]),angular.module("cevo.gte").service("VODs",["$rootScope","$http","Logger","cevo","VOD",function(t,e,r,n,o){var a=this;return a.$list=function(t,r,a){return e({method:"GET",url:n.endpoint+"liveTv/vod"+(t?"/tags/"+t:""),params:{pageSize:r,page:a}}).then(function(t){return n.util.objectify(t.data.vods,o)})},a}]);