Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.videoQaulities = '';
- angular
- .module('tw-factory',[])
- .factory('ChannelFcy', ChannelFcy)
- .factory('HomeInit', HomeInit)
- .factory('SearchFcy', SearchFcy)
- .factory('ProgramFcy', ProgramFcy)
- .factory('SecurityFcy', SecurityFcy)
- .factory('SliderFcy', SliderFcy)
- .factory('EpisodeFcy', EpisodeFcy)
- .factory('ProgressBarFcy', ProgressBarFcy)
- .factory('GeneralInit', GeneralInit)
- .factory('UtilityFcy', UtilityFcy)
- .factory('ArtistFcy', ArtistFcy)
- .factory('GeneralFunctions', GeneralFunctions)
- .factory('FavoriteListFcy', FavoriteListFcy)
- .factory('ImageUploadFcy', ImageUploadFcy)
- .factory('AdsFcy', AdsFcy)
- .factory('VasFcy', VasFcy)
- .factory('TagFcy', TagFcy)
- .factory('TagPageFcy', TagPageFcy)
- .factory('UserFcy', UserFcy)
- .factory('PromotionFcy', PromotionFcy)
- .factory('AdBankFcy', AdBankFcy)
- .factory('HourlyArchiveFcy', HourlyArchiveFcy);
- HomeInit.$inject = ['SliderFcy','EpisodeFcy','$q'];
- GeneralFunctions.$inject = ['$q'];
- GeneralInit.$inject = ['UserSrv','$q','$location','ProgressBarFcy','RoutingSrv','Configs','$rootScope'];
- SliderFcy.$inject= ['$http','$q','Configs','CacheFactory'];
- ChannelFcy.$inject= ['$http','$q','Configs'];
- ProgramFcy.$inject= ['$http','$q','Configs'];
- EpisodeFcy.$inject= ['$http','$q','Configs','ChannelFcy','GeneralFunctions'];
- UserFcy.$inject= ['$http','$q','Configs'];
- SecurityFcy.$inject= ['$http','$q','Configs','CacheFactory','UtilityFcy','$rootScope','Messages'];
- SearchFcy.$inject= ['$http','$q','Configs'];
- ArtistFcy.$inject= ['$http','$q','Configs'];
- TagFcy.$inject= ['$http','$q','Configs'];
- TagPageFcy.$inject= ['$http','$q','Configs'];
- AdsFcy.$inject= ['$http','$q','Configs'];
- AdsFcy.$inject= ['$http','$q','Configs'];
- PromotionFcy.$inject= ['$http','$q','Configs'];
- AdBankFcy.$inject= ['$http','$q','Configs'];
- HourlyArchiveFcy.$inject= ['$http','$q','Configs'];
- ImageUploadFcy.$inject= ['$http','$q','Configs'];
- FavoriteListFcy.$inject= ['$http','$q','Configs'];
- VasFcy.$inject= ['$http','$q','Configs'];
- UtilityFcy.$inject= [];
- function HomeInit(SliderFcy,EpisodeFcy,$q){
- return function() {
- var Sliders = SliderFcy.getSliders();
- /*var Movies= EpisodeFcy.getMovies();
- var OurRecommendation= EpisodeFcy.getOurRecommendations();
- var UserRecommendations=EpisodeFcy.getUserRecommendations();
- var TvShows=EpisodeFcy.getTvShows();
- var Kids=EpisodeFcy.getKids();*/
- return $q.all([Sliders/*,OurRecommendation,Movies,UserRecommendations,TvShows,Kids*/]).then(function(results){
- return {
- Sliders: results[0]
- /*,
- OurRecommendation: results[1],
- Movies: results[2],
- UserRecommendations: results[3],
- TvShows: results[4],
- Kids: results[5]*/
- };
- });
- }
- }
- function GeneralFunctions($q){
- var factory = {
- is_in_array: In_array
- };
- return factory;
- function In_array(item,array){
- for(var i=0;i<=array.length-1;i++){
- if(array[i]==item){
- return true;
- }
- }
- return false;
- }
- }
- function GeneralInit(UserSrv,$q,$location,ProgressBarFcy,RoutingSrv,Configs,$rootScope){
- return function() {
- /*ProgressBarFcy.plus(0.1);*/
- var User = {};
- /*UserSrv.getUser().then(function(UserInfo){
- $rootScope.User=UserInfo;
- $rootScope.$broadcast("UserData");
- });*/
- debuger.info("Master admin webservice server is : " + Configs.MasterAdminWebserviceUrl)
- var Route = Cookie.Read("Route");
- if(typeof Route!='undefined' && Route!=null && Route!='' && Route!='nullcookie'){
- Configs.MasterWebserviceUrl = Route;
- var routeArray = Route.split("/");
- Configs.VodSmilServerUrl = routeArray[0]+'//'+routeArray[2]+'/smil';
- debuger.info("Smil vod server was set to : " + Configs.VodSmilServerUrl)
- }
- RoutingSrv.getRoute().then(function(RoutingResult){
- Configs.MasterWebserviceUrl = RoutingResult;
- debuger.info("Master webservice server was set to : " + Configs.MasterWebserviceUrl)
- Cookie.Delete("Route");
- Cookie.Create("Route",RoutingResult,1);
- var routeArray = RoutingResult.split("/");
- Configs.VodSmilServerUrl = routeArray[0]+'//'+routeArray[2]+'/smil';
- });
- var PageLocation=$location.path().split('/');
- var Culture= (PageLocation[1])?PageLocation[1]:'fa';
- return $q.all([User,Culture]).then(function(results){
- return {
- User: results[0],
- Culture:results[1]
- };
- });
- }
- }
- function SliderFcy($http,$q,Configs) {
- var Sliders={};
- var factory = {
- getSliders: Get,
- getRamezan95: Get_Ramezan,
- getleague: Get_League,
- getMovies: Get_Movies,
- getSeries: Get_Series,
- getTags: Get_Tags,
- getShademaneh: Get_Shademaneh,
- getKids: Get_Kids,
- getOlympics: Get_Olympics,
- getEuropeLeagues: Get_EuropeLeagues
- };
- return factory;
- function Get() {
- var deferred = $q.defer();
- var url='/sliders.json?&nginxcache';
- $http.get(url)
- .success(function (data, status, headers, config) {
- Sliders = data;
- deferred.resolve(Sliders);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Get_Movies() {
- var deferred = $q.defer();
- var url='/movies.json?&nginxcache';
- $http.get(url)
- .success(function (data, status, headers, config) {
- Sliders = data;
- deferred.resolve(Sliders);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Get_EuropeLeagues() {
- var deferred = $q.defer();
- var url='/europeleagues.json?&nginxcache';
- $http.get(url)
- .success(function (data, status, headers, config) {
- Sliders = data;
- deferred.resolve(Sliders);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Get_Series() {
- var deferred = $q.defer();
- var url='/series.json?&nginxcache';
- $http.get(url)
- .success(function (data, status, headers, config) {
- Sliders = data;
- deferred.resolve(Sliders);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Get_Tags() {
- var deferred = $q.defer();
- var url='/tags.json?&nginxcache';
- $http.get(url)
- .success(function (data, status, headers, config) {
- Sliders = data;
- deferred.resolve(Sliders);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Get_Ramezan() {
- var deferred = $q.defer();
- var url='/ramezan.json?&nginxcache';
- $http.get(url)
- .success(function (data, status, headers, config) {
- Sliders = data;
- deferred.resolve(Sliders);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Get_League() {
- var deferred = $q.defer();
- var url='/ligebartar.json?&nginxcache';
- $http.get(url)
- .success(function (data, status, headers, config) {
- Sliders = data;
- deferred.resolve(Sliders);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Get_Olympics() {
- var deferred = $q.defer();
- var url='/olympics.json?&nginxcache';
- $http.get(url)
- .success(function (data, status, headers, config) {
- Sliders = data;
- deferred.resolve(Sliders);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Get_Shademaneh() {
- var deferred = $q.defer();
- var url='/shademaneh.json?&nginxcache';
- $http.get(url)
- .success(function (data, status, headers, config) {
- Sliders = data;
- deferred.resolve(Sliders);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Get_Kids() {
- var deferred = $q.defer();
- var url='/kids.json?&nginxcache';
- $http.get(url)
- .success(function (data, status, headers, config) {
- Sliders = data;
- deferred.resolve(Sliders);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function SearchFcy($http,$q,Configs){
- var Episodes={};
- var Programs={};
- var factory = {
- getEpisodes: SearchEpisodes,
- getPrograms: SearchPrograms
- };
- return factory;
- function SearchEpisodes(Context,offset,limit){
- var url=Configs.MasterWebserviceUrl+Configs.SearchEpisodeWebserviceURL+'&SearchQuery='+Context+"&offset="+offset+'&limit='+limit+"&thumb_size=120"+"&nginxcache";
- var deferred = $q.defer();
- $http.get(url)
- .success(function(data, status, headers, config) {
- Episodes = data;
- deferred.resolve(Episodes);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function SearchPrograms(Context,offset,limit){
- var url=Configs.MasterWebserviceUrl+Configs.SearchProgramWebserviceURL+'&SearchQuery='+Context+"&offset="+offset+'&limit='+limit+"&thumb_size=240" +"&nginxcache";
- var deferred = $q.defer();
- $http.get(url)
- .success(function(data, status, headers, config) {
- Programs = data;
- deferred.resolve(Programs);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function ChannelFcy($http,$q,Configs) {
- var Channels={};
- var Channel='';
- var factory = {
- getChannels: Get,
- getChannelNameFromDescriptor: GetChannelNameFromDescriptor,
- getChannelDescriptorList: GetChannelDescriptorList
- };
- return factory;
- function Get() {
- var url='/mock/channel.json'+"?nginxcache";/*Configs.MasterWebserviceUrl+'/ops?action=getChannels';*/
- var deferred = $q.defer();
- $http.get(url)
- .success(function(data, status, headers, config) {
- Channels = data;
- deferred.resolve(Channels);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetChannelNameFromDescriptor(descriptor){
- var deferred = $q.defer();
- switch (descriptor){
- case "tv1":
- Channel=1;
- break;
- case "tv2":
- Channel=2;
- break;
- case "omid":
- Channel=45;
- break;
- case "tv3":
- Channel=3;
- break;
- case "hd":
- Channel=43;
- break;
- case "tv4":
- Channel=4;
- break;
- case "tehran":
- Channel=5;
- break;
- case "irinn":
- Channel=6;
- break;
- case "amouzesh":
- Channel=7;
- break;
- case "pooya":
- Channel=8;
- break;
- case "ifilm":
- Channel=9;
- break;
- case "namayesh":
- Channel=10;
- break;
- case "jjtv1":
- Channel=12;
- break;
- case "varzesh":
- Channel=13;
- break;
- case "mostanad":
- Channel=19;
- break;
- case "quran":
- Channel=20;
- break;
- case "salamat":
- Channel=21;
- break;
- case "shoma":
- Channel=24;
- break;
- case "bazar":
- Channel=25;
- break;
- case "ifilmEn":
- Channel=29;
- break;
- case "esfahan":
- Channel=30;
- break;
- case "sahand":
- Channel=31;
- break;
- case "fars":
- Channel=32;
- break;
- case "channel9":
- Channel=33;
- break;
- case "baran":
- Channel=34;
- break;
- case "semnan":
- Channel=36;
- break;
- case "aftab":
- Channel=37;
- break;
- case "aflak":
- Channel=38;
- break;
- case "kordestan":
- Channel=39;
- break;
- case "khalijefars":
- Channel=40;
- break;
- case "nasim":
- Channel=41;
- break;
- case "ofogh":
- Channel=42;
- break;
- }
- deferred.resolve(Channel);
- return deferred.promise;
- }
- function GetChannelDescriptorList(){
- var ChannelDescriptorList = ['tv1','tv2','tv3','tv4','tehran','irinn','hd','nasim','ifilm','pooya','varzes','namayesh','amouzesh','jjtv1','mostanad','quran','salamat','shoma','bazar','ifilmEn','esfahan','sahand','fars','channel9','baran','semnan','aftab','aflak','kordestan','khalijefars','ofogh'];
- return ChannelDescriptorList;
- }
- }
- function HourlyArchiveFcy($http,$q,Configs){
- var HourlyArchiveItems = {};
- var factory = {
- getProgramsByChannel:GetProgramsByChannel
- }
- return factory;
- function GetProgramsByChannel(channelId,today) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'' +'/epg/getEpg?channel_id='+channelId+'&start_time='+today+' 00:00:00&end_time='+today+' 23:59:59')
- .success(function(data, status, headers, config) {
- HourlyArchiveItems = data;
- deferred.resolve(HourlyArchiveItems);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function AdBankFcy($http,$q,Configs){
- var adBank = {};
- var factory = {
- getAdBankList:GetAdBankList,
- getAdBankById:GetAdBankById
- }
- return factory;
- function GetAdBankList(limit,offset,token){
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl+'' +'/op?action=getModelList&model=adbank&offset='+offset+'&limit='+limit+'&token='+token)
- .success(function(data, status, headers, config) {
- adBank = data;
- deferred.resolve(adBank);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetAdBankById(Id,token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl + '/?action=getModel&model=adbank&id=' + Id + "&token=" + token)
- .success(function (data, status, headers, config) {
- adBank = data;
- deferred.resolve(adBank);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- //$window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- }
- function UserFcy($http,$q,Configs){
- var UsersList = {};
- var User = {};
- var factory = {
- getUsers:GetUsers,
- getUserByEmail:GetUserByEmail,
- getUserById: GetUserById
- }
- return factory;
- function GetUserById(Id, token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl + '/?action=getModel&model=user&id=' + Id + "&token=" + token)
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function GetUsers(limit,offset,token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl+'' +'/op?action=getModelList&model=user&offset='+offset+'&limit='+limit+'&token='+token)
- .success(function(data, status, headers, config) {
- UsersList = data;
- deferred.resolve(UsersList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetUserByEmail(email,phone,token) {
- var deferred = $q.defer();
- if(email==null && phone!=null) {
- $http.get(Configs.MasterAdminWebserviceUrl + '' + '/op?action=getModelList&model=user&offset=0&limit=100&token=' + token + '&mobile=' + phone)
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }else if(phone==null && email != null){
- $http.get(Configs.MasterAdminWebserviceUrl + '' + '/op?action=getModelList&model=user&offset=0&limit=100&token=' + token + '&email=' + email)
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }else{
- $http.get(Configs.MasterAdminWebserviceUrl + '' + '/op?action=getModelList&model=user&offset=0&limit=100&token=' + token + '&email=' + email + '&mobile=' + phone)
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- }
- function EpisodeFcy($http,$q,Configs,ChannelFcy,GeneralFunctions) {
- var OurRecommendations={};
- var AutoRequest = true;
- var Movies={};
- var TvShows={};
- var Kids={};
- var Newest={};
- var UserRecommendations={};
- var EpisodeByDateAndChannel={};
- var Episodes = {};
- var EpisodeList = {};
- var sortedLinks = {};
- var HourlyArchives = {};
- var factory = {
- getOurRecommendations: GetOurRecommendations,
- getMovies: GetMovies,
- getUserRecommendations:GetUserRecommendations,
- getTvShows:GetTvShows,
- getKids:GetKids,
- getEpisodeLists:GetEpisodeLists,
- getChannelNewestEpisodes:GetChannelNewestEpisodes,
- getNewestEpisodes:GetNewest,
- getCategoryEpisodes:GetCategoryEpisodes,
- getSortedMobileListByQuality: SortMobileLinkListByQuality,
- getHourlyArchiveByChannel:GetHourlyArchiveByChannel,
- getCustom:GetCustom,
- getEpisodeByDateAndChannel:GetEpisodeByDateAndChannel,
- getEpisodesByCategoryId:GetEpisodesByCategoryId,
- getEpisodeMoments:GetEpisodeMoments
- };
- var Custom = {};
- return factory;
- function GetEpisodeByDateAndChannel(date,channel_id,offset,limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'' +'/op?action=getContentArchivePrograms&offset='+offset+'&limit='+limit+'&channel_id='+channel_id+'&date='+date+'')
- .success(function(data, status, headers, config) {
- EpisodeByDateAndChannel = data;
- deferred.resolve(EpisodeByDateAndChannel);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetEpisodeLists(limit,offset,token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl+'' +'/op?action=getModelList&model=episode&offset='+offset+'&limit='+limit+'&token='+token)
- .success(function(data, status, headers, config) {
- EpisodeList = data;
- deferred.resolve(EpisodeList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetCategoryEpisodes(Category,offset,limit){
- var deferred = $q.defer();
- var URL = null;
- switch (true){
- case (parseInt(Category) <= 55):
- URL = Configs.MasterWebserviceUrl+'/op?action=getNewestPrograms&channel_id='+Category+'&offset='+offset+'&limit='+limit+"&thumb_size=240"+"&nginxcache";
- break;
- case (parseInt(Category) == 110):
- URL = Configs.MasterWebserviceUrl+'/op?action=getFeaturedPrograms&offset='+offset+'&limit='+limit+"&thumb_size=240"+"&nginxcache";
- break;
- case (parseInt(Category) == 111):
- URL = Configs.MasterWebserviceUrl+'/op?action=getEpisodesByCategoryGenre&category_id=8,9&offset='+offset+'&limit='+limit+'&order_type=newest&thumb_size=240'+"&nginxcache";
- break;
- case (parseInt(Category) == 112):
- URL = Configs.MasterWebserviceUrl+'/op?action=getNewestPrograms&offset='+offset+'&limit='+limit+"&thumb_size=240"+"&nginxcache";
- break;
- case (parseInt(Category) == 113):
- URL = Configs.MasterWebserviceUrl+'/op?action=getProgramsByCategoryGenre&category_id=10,11&offset='+offset+'&limit='+limit+'&order_type=newest'+"&thumb_size=240"+"&nginxcache";
- break;
- case (parseInt(Category) == 114):
- URL = Configs.MasterWebserviceUrl+'/op?action=getMostViewedPrograms&offset='+offset+'&order_type=newest&limit='+limit+"&thumb_size=240&type=4";
- break;
- case (parseInt(Category) == 115):
- URL = Configs.MasterWebserviceUrl+'/op?action=getProgramsByCategoryGenre&category_id=12&offset='+offset+'&limit='+limit+'&order_type=most_viewed&thumb_size=240&nginxcache';
- break;
- case (parseInt(Category) == 117):
- URL = Configs.MasterWebserviceUrl+'/op?action=getFeaturedPrograms&favorite_list_id=372372&offset='+offset+'&limit='+limit+"&thumb_size=240"+"&nginxcache";
- break;
- case (parseInt(Category) > 1000):
- URL = Configs.MasterWebserviceUrl+'/op?action=getOtherEpisodes&offset='+offset+'&limit='+limit+'&thumb_size=240&program_id='+Category+"&nginxcache";
- break;
- default:
- URL = Configs.MasterWebserviceUrl+'/op?action=getFeaturedPrograms&offset='+offset+'&limit='+limit+"&thumb_size=240"+"&nginxcache";
- break;
- }
- $http.get(URL+"&nginxcache")
- .success(function(data, status, headers, config) {
- Episodes = data;
- deferred.resolve(Episodes);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetOurRecommendations(offset,limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getFeaturedPrograms&offset='+offset+'&limit='+limit+"&thumb_size=240"+"&nginxcache")
- .success(function(data, status, headers, config) {
- OurRecommendations = data;
- deferred.resolve(OurRecommendations);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetEpisodesByCategoryId(offset,limit,category_id) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl.replace("/op","")+'/v2/programs/getEpisodesByCategoryGenre?category_id='+category_id+'&offset='+offset+'&limit='+limit+'&order_type=newest')
- .success(function(data, status, headers, config) {
- OurRecommendations = data;
- deferred.resolve(OurRecommendations);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetMovies(offset,limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getEpisodesByCategoryGenre&category_id=8,9&offset='+offset+'&limit='+limit+'&order_type=newest&thumb_size=240'+"&nginxcache")
- .success(function(data, status, headers, config) {
- Movies = data;
- deferred.resolve(Movies);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetUserRecommendations(offset,limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getMostViewedPrograms&offset='+offset+'&limit='+limit+"&thumb_size=120&type=4"+"&nginxcache")
- .success(function(data, status, headers, config) {
- UserRecommendations = data;
- deferred.resolve(UserRecommendations);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetTvShows(offset,limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getProgramsByCategoryGenre&category_id=10,11&offset='+offset+'&limit='+limit+'&order_type=newest'+"&thumb_size=240"+"&nginxcache")
- .success(function(data, status, headers, config) {
- TvShows = data;
- deferred.resolve(TvShows);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetKids(offset,limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getByCategoryGenre&category_id=12&offset='+offset+'&limit='+limit+'&order_type=most_viewed'+"&thumb_size=240"+"&nginxcache")
- .success(function(data, status, headers, config) {
- Kids = data;
- deferred.resolve(Kids);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetNewest(offset,limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getNewestPrograms&offset='+offset+'&limit='+limit+"&thumb_size=120"+"&nginxcache")
- .success(function(data, status, headers, config) {
- Newest = data;
- deferred.resolve(Newest);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetChannelNewestEpisodes(channel,offset,limit){
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getNewestPrograms&channel_id='+channel+'&offset='+offset+'&limit='+limit+"&thumb_size=240"+"&nginxcache")
- .success(function(data, status, headers, config) {
- Newest = data;
- deferred.resolve(Newest);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function SortMobileLinkListByQuality(list){
- var tempItem=null;
- var deferred = $q.defer();
- for(var i=0;i<=list.length-1;i++){
- if(list[i].title==Configs.DefaultBitrate.Mobile.Vod){
- tempItem=i;
- }
- }
- if(tempItem!==null && tempItem!=0){
- var tempArray=list[tempItem];
- list.splice(tempItem,1);
- list.unshift(tempArray);
- }
- deferred.resolve(list);
- return deferred.promise;
- }
- function GetHourlyArchiveByChannel(date,channel){
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+"/op?action=getHourlyArchivePrograms&channel_id="+channel+"&date="+date+"&nginxcache")
- .success(function(data, status, headers, config) {
- HourlyArchives = data;
- deferred.resolve(HourlyArchives);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetCustom(Type,offset,limit){
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getFeaturedPrograms&favorite_list_id='+Type+'&offset='+offset+'&limit='+limit+"&thumb_size=120"+"&nginxcache")
- .success(function(data, status, headers, config) {
- Custom = data;
- deferred.resolve(Custom);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetEpisodeMoments(Episode){
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/programs/getEpisodeMoments?episode_id='+Episode+"&nginxcache")
- .success(function(data, status, headers, config) {
- Custom = data;
- deferred.resolve(Custom);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function UtilityFcy() {
- var factory = {
- in_array: InArray
- };
- return factory;
- function InArray(needle, haystack) {
- var length = haystack.length;
- for(var i = 0; i < length-1; i++) {
- if(haystack[i] == needle) return true;
- }
- return false;
- }
- }
- function SecurityFcy($http,$q,Configs,CacheFactory,UtilityFcy,$rootScope,Messages){
- var TokenData={};
- var Links=[];
- var factory = {
- getToken: GetToken,
- generateVodSmilLink:GenerateVodSmilLink,
- generateValidVodSource:GenerateValidVodSource,
- generateVodNdLink:GenerateVodNdLink,
- getDefaultLiveLink:GetDefaultLiveLink,
- getDownloadToken: GetDownloadToken,
- setCookieByToken: SetCookieByToken,
- getUserToken: GetUserToken,
- userHasPermission: UserHasPermission,
- getAdvertisement: GetAdvertisement,
- parsVas2: ParsVas2
- };
- return factory;
- function GetDownloadToken(){
- var deferred = $q.defer();
- deferred.resolve(Cookie.Read("tw-status").substring(44)?Cookie.Read("tw-status").substring(44):'not-log-in');
- return deferred.promise;
- }
- function GetToken(){
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getSecurityToken',{cache: CacheFactory.get('AuthenticationCache')})
- .success(function(data, status, headers, config) {
- TokenData = data;
- deferred.resolve(TokenData);
- });
- return deferred.promise;
- }
- function ParsVas2(xmlAd){
- output={};
- var deferred = $q.defer();
- xmlDoc = $.parseXML(xmlAd),
- $xml = $( xmlDoc ),
- $mediaFiles = $xml.find("MediaFile");
- $clicks = $xml.find("VideoClicks");
- $events = $xml.find("Tracking");
- if (typeof $mediaFiles[0] != "undefined" && $mediaFiles[0] != "undefined" && typeof $mediaFiles[0]["textContent"]!="undefined" && $mediaFiles[0]["textContent"]!=''){
- output.src=$mediaFiles[0]["textContent"].trim();
- output.onClick=$clicks[0]["textContent"].trim();
- output.onComplete=$events[3]["textContent"].trim();
- output.onStart=$events[0]["textContent"].trim();
- }
- deferred.resolve(output);
- return deferred.promise;
- }
- function GetUserToken(){
- var deferred = $q.defer();
- var token=Cookie.Read("tw-status")!==''?Cookie.Read("tw-status"):'not-log-in';
- deferred.resolve(token);
- return deferred.promise;
- }
- function GenerateVodSmilLink(links,episodeId,type,secureToken){
- var SmilLinks=[];
- type = typeof type !== 'undefined' ? type : 'JwPlayer';
- secureToken = typeof secureToken !== 'undefined' ? secureToken : GetToken();
- var deferred = $q.defer();
- for(var i=0;i<links.length;i++){
- if(type=='JwPlayer'){
- SmilLinks.push(Configs.VodSmilServerUrl+'/'+ episodeId +'.smil?filepath=' + links[i]+"&ext=.smil");
- }
- else if(type == 'OsmfPlayer'){
- SmilLinks.push(Configs.VodSmilServerUrl+'/'+ episodeId +'.m3u8?filepath=' + links[i]+"&m3u8=1&format=smil&secure_token="+secureToken+";ext=.m3u8");
- }
- }
- deferred.resolve(SmilLinks);
- return deferred.promise;
- }
- function GenerateValidVodSource(rawLinks){
- var deferred = $q.defer();
- for (var i=0;i<rawLinks.length;i++) {
- Links.push(rawLinks[i].link);
- }
- deferred.resolve(Links);
- return deferred.promise;
- }
- function GenerateVodNdLink(rawLinks){
- var deferred = $q.defer();
- var ndLinks=[];
- var Links=[];
- for(var i=0;i<rawLinks.length;i++){
- var tempLink=rawLinks[i].link;
- var tempArrayLink=tempLink.split('/');
- var getDomain= tempArrayLink[2].split(':');
- tempLink="http://nd."+getDomain[0]+'/'+tempArrayLink[5]+'/'+'/'+tempArrayLink[6]+'/'+tempArrayLink[7]+'/'+tempArrayLink[8]+'/'+tempArrayLink[9]+'/'+tempArrayLink[10]+'/'+tempArrayLink[11];
- ndLinks.push(tempLink);
- rawLinks[i].link=tempLink;
- }
- Links.push(rawLinks);
- Links.push(ndLinks);
- deferred.resolve(Links);
- return deferred.promise;
- }
- function GetDefaultLiveLink(Links){
- var Link={};
- if(Links.length==1 && Links[0]['title']=='copyright'){
- NgNote.Error(Messages.Fa.CopyrightErrorLive,30);
- }
- var deferred = $q.defer();
- for(var i=0;i<Links.length;i++){
- if(Links[i].isDefault==true){
- Link.Link=Links[i].link;
- Link.Index=i;
- }
- }
- deferred.resolve(Link);
- return deferred.promise;
- }
- function SetCookieByToken(token){
- Cookie.Create("tw-status",token,10);
- }
- function UserHasPermission(Permission) {
- var deferred = $q.defer();
- for(var i = 0; i<=Permission.length; i++){
- if(typeof $rootScope.User !='undefined' && typeof $rootScope.User.credentials !='undefined'){
- deferred.resolve(UtilityFcy.in_array(Permission[i],$rootScope.User.credentials));
- return deferred.promise;
- }
- }
- return deferred.promise;
- }
- function GetAdvertisement(type,target) {
- var device;
- if(type=="mobile"){
- device="mobile";
- }
- else{
- device="desktop";
- }
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+"/ads/serveAds?device="+device+"&target="+target,{cache: CacheFactory.get('PreroleAd')})
- .success(function(data, status, headers, config) {
- TokenData = data;
- deferred.resolve(TokenData);
- });
- return deferred.promise;
- }
- }
- function ProgramFcy($http,$q,Configs) {
- var OtherEpisodes = {};
- var ProgramWithFilter = {};
- var factory = {
- getKids:GetKids,
- getTvShows:GetTvShows,
- getProgramList:GetProgramList,
- getProgramWithFilter:GetProgramWithFilter,
- getOtherEpisodesOfThisProgram: GetOtherEpisodesOfThisProgram,
- searchByName: SearchByName,
- searchCountryByName:SearchCountryByName
- };
- return factory;
- function SearchByName(context, token, offset, limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl+ '/op?action=getModelItemListByContext&model=program'+'&search_context='+context+'&offset='+offset+'&limit='+limit+"&token="+token)
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function SearchCountryByName(context, token, offset, limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl+ '/op?action=getModelItemListByContext&model=country'+'&search_context='+context+'&offset='+offset+'&limit='+limit+"&token="+token)
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetProgramList(offset,limit,token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl + '/op?action=getModelList&model=program&offset='+offset+'&limit='+limit+'&token='+token+'')
- .success(function (data, status, headers, config) {
- OtherEpisodes = data;
- deferred.resolve(OtherEpisodes);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetProgramWithFilter(offset,limit,token,channel_id,from_date,to_date,status,singleton,title) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl + '/op?action=getModelList&model=program&offset='+offset+
- '&limit='+limit+'&token='+token+'&channel_id='+channel_id+'&from_date='+from_date+'&to_date='+to_date+'&signleton='+singleton+'&status='+status+'&title='+title)
- .success(function (data, status, headers, config) {
- ProgramWithFilter = data;
- deferred.resolve(ProgramWithFilter);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetOtherEpisodesOfThisProgram(offset, limit, programId) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl + '/op?action=getOtherEpisodes&offset=' + offset + '&limit=' + limit + "&thumb_size=240&program_id="+programId+"&nginxcache")
- .success(function (data, status, headers, config) {
- OtherEpisodes = data;
- deferred.resolve(OtherEpisodes);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetKids(offset,limit) {
- var Kids={};
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getProgramsByCategoryGenre&category_id=12&offset='+offset+'&limit='+limit+'&order_type=newest'+"&thumb_size=240"+"&nginxcache")
- .success(function(data, status, headers, config) {
- Kids = data;
- deferred.resolve(Kids);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetTvShows(offset,limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getProgramsByCategoryGenre&category_id=10,11&offset='+offset+'&limit='+limit+'&order_type=newest'+"&thumb_size=240"+"&nginxcache")
- .success(function(data, status, headers, config) {
- TvShows = data;
- deferred.resolve(TvShows);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function ProgressBarFcy(){
- var Bar={};
- var factory = {
- getStatus:Get,
- plus:Plus,
- setDone:Done,
- setStatus:Set
- };
- return factory;
- function Get(){
- return Bar.Status;
- }
- function Plus(Amount){
- Bar.Status+=Amount;
- Set(Bar.Status);
- }
- function Done(){
- NProgress.done();
- }
- function Set(Amount){
- Bar.Status=NProgress.set(Amount).status;
- if(Bar.Status>0.95)
- {
- Done();
- }
- }
- }
- function ArtistFcy($http,$q,Configs) {
- var factory = {
- searchByName: SearchByName
- };
- return factory;
- function SearchByName(context, token, offset, limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+ 'op?action=getModelItemListByContext&model=artist'+'&search_context='+context+'&offset='+offset+'&limit='+limit+"&token="+token)
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function FavoriteListFcy($http,$q,Configs) {
- var factory = {
- searchByName: SearchByName,
- getList: GetList,
- deleteList: Delete,
- getEpisodeList: GetEpisodes
- };
- return factory;
- function SearchByName(context, token, offset, limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl +'/?action=getModelItemListByContext&model=favorite_list'+'&search_context='+context+'&offset='+offset+'&limit='+limit+"&token="+token)
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetList(offset, limit, id, token) {
- var deferred = $q.defer();
- if(typeof id == 'undefined' || id == 0){
- id=0;
- }
- $http.get(Configs.MasterAdminWebserviceUrl +'/?action=getModelList&model=favorite_list&offset='+offset+'&limit='+limit+'&id='+id+'&token='+token)
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetEpisodes(id, offset, limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl +'/op?action=getFavoritListEpisodes&favorite_list_id='+id+'&offset='+offset+'&limit='+limit)
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Delete(id, token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl +'/?action=deleteModel&model=favorite_list&id='+id+'&token='+token)
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function TagPageFcy($http,$q,Configs) {
- var tagItems = {Programs:{},Episodes:{}};
- var factory = {
- getTagPrograms:GetTagPrograms,
- getTagEpisodes:GetTagEpisodes
- }
- return factory;
- function GetTagPrograms(limit,offset,name) {
- var deferred = $q.defer();
- $http.get((Configs.MasterWebserviceUrl).replace("/op","")+ '/v2/tags/getTagProgram?offset='+offset+'&limit='+limit+'&tag='+name+'')
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetTagEpisodes(limit,offset,name) {
- var deferred = $q.defer();
- $http.get((Configs.MasterWebserviceUrl).replace("/op","")+ '/v2/tags/getTagEpisodes?offset='+offset+'&limit='+limit+'&tag='+name+'')
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function TagFcy($http,$q,Configs) {
- var factory = {
- searchByName: SearchByName
- };
- return factory;
- function SearchByName(context, token, offset, limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl +'/op?action=getModelItemListByContext&model=tag'+'&search_context='+context+'&offset='+offset+'&limit='+limit+"&token="+token)
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function ImageUploadFcy($http,$q,Configs) {
- var factory = {
- upload: Upload
- };
- return factory;
- function Upload(data,model, token, id, type){
- var deferred = $q.defer();
- $http({
- method: 'POST',
- url: Configs.MasterAdminWebserviceUrl + '/?action=uploadImage&model='+model+"&token="+token+"&id="+id+"&type="+type,
- headers: {
- 'Access-Control-Allow-Headers': 'Content-Type',
- 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
- 'Access-Control-Allow-Origin': '*'
- },
- data: {image: data}
- }).then(function(result){
- deferred.resolve(result);
- }, function(result){
- deferred.resolve(result);
- });
- return deferred.promise;
- }
- }
- function PromotionFcy($http,$q,Configs) {
- var Promotions = {};
- var factory = {
- getPromotions:GetPromotions,
- getPromotionById:GetPromotionById
- }
- return factory;
- function GetPromotionById(token, id) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl +'/op?action=getModel&model=promotion&id='+id+'&token='+token)
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetPromotions(offset,limit,token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl +'/?action=getModelList&model=promotion&offset='+offset+'&limit='+limit+'&token='+token).success(function (data) {
- deferred.resolve(data);
- return deferred.promise;
- }).error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function AdsFcy($http,$q,Configs) {
- var factory = {
- getAll: GetAll
- };
- return factory;
- function GetAll(token, offset, limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl +'/op?action=getModel&model=ads'+'&offset='+offset+'&limit='+limit+"&token="+token)
- .success(function(data, status, headers, config) {
- deferred.resolve(data);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function VasFcy($http,$q,Configs) {
- var factory = {
- checkStatus: CheckStatus
- };
- return factory;
- function CheckStatus(checkURL) {
- var deferred = $q.defer();
- $http.get(checkURL, {timeout: 3000})
- .success(function(data, status, headers, config) {
- deferred.resolve(true);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- deferred.resolve(false);
- return deferred.promise;
- })
- return deferred.promise;
- }
- }
- angular
- .module('tw-service',[])
- .service('ChannelSrv', ChannelSrv)
- .service('UserSrv', UserSrv)
- .service('EpisodeSrv', EpisodeSrv)
- .service('ProgramSrv', ProgramSrv)
- .service('ArtistSrv', ArtistSrv)
- .service('FavoriteListSrv', FavoriteListSrv)
- .service('AdsSrv', AdsSrv)
- .service('PromotionsSrv', PromotionsSrv)
- .service('RoutingSrv', RoutingSrv)
- .service('AdBankSrv', AdBankSrv);
- UserSrv.$inject = ['$http','$q','md5','Configs','CacheFactory'];
- ChannelSrv.$inject = ['$http','$q','Configs'];
- EpisodeSrv.$inject = ['$http','$q','Configs','$window','$rootScope'];
- ProgramSrv.$inject = ['$http','$q','Configs','$window'];
- RoutingSrv.$inject = ['$http','$q','Configs'];
- ArtistSrv.$inject = ['$http','$q','Configs'];
- AdsSrv.$inject = ['$http','$q','Configs'];
- PromotionsSrv.$inject = ['$http','$q','Configs'];
- AdBankSrv.$inject = ['$http','$q','Configs','$window'];
- FavoriteListSrv.$inject = ['$http','$q','Configs'];
- function UserSrv($http,$q,md5,Configs,CacheFactory) {
- var User={};
- var deletedUser = {};
- var service = {
- getUser: Get,
- updateUser: Update,
- registerUser: Register,
- logoutUser: Logout,
- loginUser: Login,
- deleteUser: DeleteUser,
- VerifyRegistration: Verify,
- forgotPasswordUser:ForgotPassword,
- resendVerificationEmail:ResendVerificationEmail,
- validateResetPasswordToken: ValidateResetPasswordToken,
- resetPassword: ResetPassword,
- unsubscribe: Unsubscribe
- };
- return service;
- function DeleteUser(id,token) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/op?action=deleteModel&model=user&id='+id+'&token='+token)
- .success(function(data, status, headers, config) {
- deletedUser=data;
- deferred.resolve(deletedUser);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function Get() {
- try{
- CacheFactory('AuthenticationCache', {
- maxAge: 180 * 60 * 1000,cacheFlushInterval: 120 * 60 * 1000, deleteOnExpire: 'aggressive'
- });
- CacheFactory('PreroleAd', {
- maxAge: 100,cacheFlushInterval: 100, deleteOnExpire: 'aggressive'
- });
- }catch(e){
- }
- var deferred = $q.defer();
- /*$http.get(Configs.MasterWebserviceUrl+'/ops?action=getCredentials',{cache: CacheFactory.get('AuthenticationCache')})*/
- var token=Cookie.Read("tw-status");
- $http.get(Configs.MasterWebserviceUrl+'/user/getUserInfo?token='+quote(token), {cache: CacheFactory.get('AuthenticationCache')})
- .success(function(data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Update(Id,fname,gender,mobile,status,token) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/op?action=saveModel&model=user&token='+token,{user_id:Id,user_fullname:fname,
- user_gender:gender, user_mobile:mobile, user_status:status})
- .success(function(data, status, headers, config) {
- User=data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- });
- return deferred.promise;
- }
- function Logout() {
- CacheFactory.destroy('AuthenticationCache');
- Cookie.Delete("tw-status");
- }
- function ForgotPassword(Email){
- var deferred = $q.defer();
- if(typeof Email != 'undefined' && Email) {
- $http.post(Configs.MasterWebserviceUrl+'/user/requestResetPassword',{'email': Email} )
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- else
- {
- return false;
- }
- }
- function Login(User) {
- var deferred = $q.defer();
- if(typeof User.Email != 'undefined' && User.Email && User.Password && typeof User.Password != 'undefined') {
- $http.post(Configs.MasterWebserviceUrl+'/user/authenticateUser', {'username': User.Email, 'password': md5.createHash(User.Password || '')})
- .success(function (data, status, headers, config) {
- User = data;
- Cookie.Create("tw-status",User.token,10);
- deferred.resolve(User);
- CacheFactory.destroy('AuthenticationCache');
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- else
- {
- return false;
- }
- }
- function Register(User){
- var deferred = $q.defer();
- if(typeof User.Name != 'undefined' && User.Name && typeof User.Email != 'undefined' && User.Email && typeof User.Password != 'undefined') {
- $http.post(Configs.MasterWebserviceUrl+'/user/registerUser', {'phone':User.phone,'name': User.Name, 'email': User.Email, 'password': md5.createHash(User.Password || '')})
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- else
- {
- return false;
- }
- }
- function Verify(Username,VCode,HCode){
- var deferred = $q.defer();
- $http.post(Configs.MasterWebserviceUrl+'/user/userRegistrationConfirm', {'ue': Username, 'ik': VCode, 'ie': HCode})
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function ResendVerificationEmail(Email){
- var deferred = $q.defer();
- $http.post(Configs.MasterWebserviceUrl+'/user/resendConfirmationEmail', {'email': Email, 'language': "fa"})
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function ValidateResetPasswordToken(Token){
- var deferred = $q.defer();
- $http.post(Configs.MasterWebserviceUrl+'/user/validateResetPassword', {'token': Token})
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function ResetPassword(Token,Password){
- var deferred = $q.defer();
- $http.post(Configs.MasterWebserviceUrl+'/user/resetPassword', {'token': Token, "password": md5.createHash(Password || '')})
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Unsubscribe(Email){
- var deferred = $q.defer();
- $http.post(Configs.MasterWebserviceUrl+'/user/unsubscribe', {'email': Email})
- .success(function (data, status, headers, config) {
- User = data;
- deferred.resolve(User);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- deferred.resolve(false);
- return deferred.promise;
- })
- return deferred.promise;
- }
- }
- function PromotionsSrv($http,$q,Configs) {
- var promotions={};
- var promotion = {};
- var service = {
- createPromotion: CreatePromotion,
- savePromotion: SavePromotion,
- deletePromotion:DeletePromotion
- };
- return service;
- function DeletePromotion(id, token) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/op?action=deleteModel&model=promotion&id='+id+'&token='+token)
- .success(function(data, status, headers, config) {
- promotion=data;
- deferred.resolve(promotion);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function CreatePromotion(promotion_category,promotion_description_fa,promotion_description_en,promotion_link,promotion_type,promotion_title,promotion_play_time,promotion_occasion,promotion_is_mobile,promotion_valid_from,promotion_valid_to,token) {
- var deferred = $q.defer();
- $http({
- method: 'POST',
- url: Configs.MasterAdminWebserviceUrl + '/op?action=createModel&model=promotion&token='+token,
- headers: {
- 'Access-Control-Allow-Headers': 'Content-Type',
- 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
- 'Access-Control-Allow-Origin': '*'
- },
- data: { promotion_category:promotion_category,promotion_description_fa:promotion_description_fa,promotion_description_en:promotion_description_en,promotion_link:promotion_link,
- promotion_type:promotion_type,promotion_title:promotion_title,promotion_play_time:promotion_play_time,promotion_occasion:promotion_occasion,promotion_is_mobile:promotion_is_mobile,
- promotion_valid_from:promotion_valid_from,promotion_valid_to:promotion_valid_to}
- }).then(function(result){
- deferred.resolve(result);
- }, function(result){
- deferred.resolve(result);
- });
- return deferred.promise;
- }
- function SavePromotion(promotion_id,promotion_category,promotion_description_fa,promotion_description_en,promotion_link,promotion_type,promotion_title,promotion_play_time,promotion_occasion,promotion_is_mobile,promotion_valid_from,promotion_valid_to,token) {
- var deferred = $q.defer();
- $http({
- method: 'POST',
- url: Configs.MasterAdminWebserviceUrl + '/op?action=saveModel&model=promotion&token='+token,
- headers: {
- 'Access-Control-Allow-Headers': 'Content-Type',
- 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
- 'Access-Control-Allow-Origin': '*'
- },
- data: {promotion_id:promotion_id, promotion_category:promotion_category,promotion_description_fa:promotion_description_fa,promotion_description_en:promotion_description_en,promotion_link:promotion_link,
- promotion_type:promotion_type,promotion_title:promotion_title,promotion_play_time:promotion_play_time,promotion_occasion:promotion_occasion,promotion_is_mobile:promotion_is_mobile,
- promotion_valid_from:promotion_valid_from,promotion_valid_to:promotion_valid_to}
- }).then(function(result){
- deferred.resolve(result.status);
- }, function(result){
- deferred.resolve(result.status);
- });
- return deferred.promise;
- }
- }
- function ChannelSrv($http,$q,Configs) {
- var Channel={};
- var service = {
- getChannel: Get
- };
- return service;
- function Get(Id,Type, Token) {
- var deferred = $q.defer();
- var protocol=null;
- if(Type=='android' || Type=='iphone' || Type=="ipad"){
- protocol='&protocol=hls';
- }
- else{
- protocol='&smil_link=1';
- }
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getChannelLinks&ChannelID='+Id+protocol+'&secure_token='+Token)
- .success(function(data, status, headers, config) {
- Channel = data;
- deferred.resolve(Channel);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function EpisodeSrv($http,$q,Configs,$window,$rootScope){
- var Episode={};
- var episodeDelete = {};
- var service = {
- getEpisode: Get,
- saveEpisode: Save,
- getEpisodeImageWithCustomSize: GetEpisodeImageWithCustomSize,
- getFullEpisode:GetEpisodeFullData,
- uploadImage: UploadImage,
- deleteEpisode: DeleteEpisode,
- createEpisode: CreateEpisode
- };
- return service;
- function DeleteEpisode(id, token) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/op?action=deleteModel&model=episode&id='+id+'&token='+token)
- .success(function(data, status, headers, config) {
- episodeDelete=data;
- deferred.resolve(episodeDelete);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function CreateEpisode(program_id, show_time, episode_countries,episode_copyright_type, title, title_english, description, keywords, actors, page_description, tags, favLists, token) {
- var deferred = $q.defer();
- $http({
- method: 'POST',
- url: Configs.MasterAdminWebserviceUrl + '/op?action=createModel&model=episode&token='+token,
- headers: {
- 'Access-Control-Allow-Headers': 'Content-Type',
- 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
- 'Access-Control-Allow-Origin': '*'
- },
- data: {program_id: program_id, episode_show_time:show_time, episode_copyright_type:episode_copyright_type,episode_copyright_countries:episode_countries,title:title, title_english:title_english, description: description,
- keywords:keywords, actors:actors, page_description:page_description, tags:tags, favorite_lists:favLists }
- }).then(function(result){
- deferred.resolve(result.status);
- }, function(result){
- deferred.resolve(result.status);
- });
- return deferred.promise;
- }
- function Get(Id,Token,userToken) {
- var deferred = $q.defer();
- var WithDownloadLink= (userToken=='undefined' || userToken=='nullcookie' || userToken=='')?'':'&download_link=1';
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getEpisodeDetails&episode_id='+Id+'&secure_token='+Token+"&user_token="+userToken+WithDownloadLink, { timeout: 7000 })
- .success(function(data, status, headers, config) {
- if(data==null || data=='null' || typeof data=='undefined'){
- if($rootScope.TryCount<1){
- debuger.error("Faild to get Episode from this server -> " + Configs.MasterWebserviceUrl + " now trying to change the server");
- $window.ga('send', 'event', 'webserver', 'episode-error', Configs.MasterWebserviceUrl);
- if($rootScope.InSiteLink){
- Configs.MasterWebserviceUrl = Configs.SlaveWebserviceUrl;
- $rootScope.TryCount++;
- data = Get(Id, Token, userToken);
- deferred.resolve(data);
- return deferred.promise;
- }
- else {
- debuger.error("Faild to get Episode details after all attempts, now redirecting to 404 page, possible invalid Id")
- $window.location.replace('/#!/404');
- }
- }
- else {
- debuger.error("Faild to get Episode details after all attempts, now redirecting to 404 page, possible invalid Id")
- $window.location.replace('/#!/404');
- }
- }
- debuger.info("Episode details arrived from -> " + Configs.MasterWebserviceUrl);
- Episode = data;
- deferred.resolve(Episode);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- debuger.error("Faild to get Episode Details from this server -> " + Configs.MasterWebserviceUrl)
- if($rootScope.TryCount<1) {
- Configs.MasterWebserviceUrl = Configs.SlaveWebserviceUrl;
- debuger.info("Now trying to get Episode data from this server -> " + Configs.MasterWebserviceUrl)
- $rootScope.TryCount++;
- data = Get(Id, Token, userToken);
- deferred.resolve(data);
- return deferred.promise;
- }
- else {
- debuger.error("Faild to get Episode Details after " + ($rootScope.TryCount+1) + "try")
- NgNote.Error("در ارتباط با سرور با مشکل مواجه شدیم، لطفا پس از بررسی اینترنت خود مجدد تلاش کنید", 3);
- }
- })
- return deferred.promise;
- }
- function GetEpisodeImageWithCustomSize(Image,ImageSize,justImage){
- justImage = justImage !== 'undefined' ? justImage : false;
- var SplityImage = Image.split("/");
- var result = ImageSize + SplityImage[SplityImage.length-1].substring(3);
- if(justImage){
- return result;
- }
- else{
- var fullResult = null;
- for(var i = 0; i <= SplityImage.length-1; i++){
- if(i==0){
- fullResult = SplityImage[i];
- }
- else{
- if(i==SplityImage.length-1){
- fullResult = fullResult + "/" + result;
- }
- else{
- fullResult = fullResult+ "/" +SplityImage[i];
- }
- }
- }
- return fullResult;
- }
- }
- function GetEpisodeFullData(Id,token){
- /*Configs.MasterWebserviceUrl='http://www.telewebion.com:'*/
- var deferred = $q.defer();
- // +
- $http.get(Configs.MasterAdminWebserviceUrl + '/?action=getModel&id='+Id+'&model=episode'+"&token="+token)
- .success(function(data, status, headers, config) {
- Episode = data;
- deferred.resolve(Episode);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Save(episode_id, show_time,episode_copyright_type,episode_countries,program_id, title, title_english, description, keywords, actors, page_description, tags, favLists, token){
- var deferred = $q.defer();
- $http({
- method: 'POST',
- url: Configs.MasterAdminWebserviceUrl + '/?action=saveModel'+'&model=episode&token='+token,
- headers: {
- 'Access-Control-Allow-Headers': 'Content-Type',
- 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
- 'Access-Control-Allow-Origin': '*'
- },
- data: {id:episode_id, episode_show_time:show_time, program_id: program_id, title:title,episode_copyright_type:episode_copyright_type,episode_countries:episode_countries, title_english:title_english, description: description,
- keywords:keywords, actors:actors, page_description:page_description, tags:tags, favorite_lists:favLists }
- }).then(function(result){
- deferred.resolve(result.status);
- }, function(result){
- deferred.resolve(result.status);
- });
- return deferred.promise;
- }
- function UploadImage(model, token, id, type) {
- }
- }
- function ProgramSrv($http,$q,Configs,$window){
- var Program = {};
- var programDelete = {};
- var service = {
- getProgram: Get,
- getFullProgram: GetFull,
- saveProgram: Save,
- createProgram:Create,
- deleteProgram:DeleteProgram
- };
- return service;
- function DeleteProgram(id,token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl + '/op?action=deleteModel&model=program&id='+id+'&token='+token)
- .success(function (data, status, headers, config) {
- programDelete = data;
- deferred.resolve(programDelete);
- return deferred.promise;
- })
- .error(function (data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function Get(Id) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getProgramDetails&program_id='+Id+"&nginxcache")
- .success(function(data, status, headers, config) {
- if(data==null || data=='null' || typeof data=='undefined'){
- $window.ga('send', 'event', 'webserver', 'program-error', Configs.MasterWebserviceUrl);
- if($rootScope.ProgramDetailTryCount<1){
- debuger.error("Failed to get Program from this server -> " + Configs.MasterWebserviceUrl + " now trying to change the server")
- if($rootScope.InSiteLink){
- Configs.MasterWebserviceUrl = Configs.SlaveWebserviceUrl;
- $rootScope.ProgramDetailTryCount++;
- data = Get(Id);
- deferred.resolve(data);
- return deferred.promise;
- }
- else {
- debuger.error("Faild to get Program details after all attempts, now redirecting to 404 page, possible invalid Id")
- $window.location.replace('/#!/404');
- }
- }
- }
- Program=data;
- debuger.info("Program details arrived from -> " + Configs.MasterWebserviceUrl)
- deferred.resolve(Program);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function GetFull(Id, token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl+'/?action=getModel&id='+Id+'&model=program&token=' + token)
- .success(function(data, status, headers, config) {
- Program=data;
- deferred.resolve(Program);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function Create(program_id, title, title_english, description_fa, description_en, tags, downloadable, enable,
- is_singleton, keywords_english, page_description, Artists, Directors, Producer, Authors, Others, Genres,
- Categoires, token,program_copyright_type,program_countries,importance) {
- var deferred = $q.defer();
- $http({
- method: 'POST',
- url: Configs.MasterAdminWebserviceUrl + '/?action=createModel'+'&model=program&token='+token,
- headers: {
- 'Access-Control-Allow-Headers': 'Content-Type',
- 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
- 'Access-Control-Allow-Origin': '*'
- },
- data: { program_copyright_type:program_copyright_type,program_countries:program_countries,program_id:program_id, title:title, title_english:title_english, description_fa:description_fa,
- description_en:description_en, tags: tags, downloadable: downloadable, enable: enable, is_singleton: is_singleton,
- keywords_english:keywords_english, page_description: page_description, actors: Artists, directors: Directors,
- authors: Authors, producer: Producer, others:Others, genres: Genres, categories: Categoires,importance:importance
- }
- }).then(function(result){
- deferred.resolve(result.status);
- }, function(result){
- deferred.resolve(result.status);
- });
- return deferred.promise;
- }
- function Save(program_id, title, title_english, description_fa, description_en, tags, downloadable, enable,
- is_singleton, keywords_english, page_description, Artists, Directors, Producer, Authors, Others, Genres,
- Categoires, token,program_copyright_type,program_countries,importance) {
- var deferred = $q.defer();
- $http({
- method: 'POST',
- url: Configs.MasterAdminWebserviceUrl + '/?action=saveModel'+'&model=program&token='+token,
- headers: {
- 'Access-Control-Allow-Headers': 'Content-Type',
- 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
- 'Access-Control-Allow-Origin': '*'
- },
- data: { program_copyright_type:program_copyright_type,program_countries:program_countries,program_id:program_id, title:title, title_english:title_english, description_fa:description_fa,
- description_en:description_en, tags: tags, downloadable: downloadable, enable: enable, is_singleton: is_singleton,
- keywords_english:keywords_english, page_description: page_description, actors: Artists, directors: Directors,
- authors: Authors, producer: Producer, others:Others, genres: Genres, categories: Categoires,importance:importance
- }
- }).then(function(result){
- deferred.resolve(result.status);
- }, function(result){
- deferred.resolve(result.status);
- });
- return deferred.promise;
- }
- }
- function RoutingSrv($http,$q,Configs){
- var Route='';
- var service = {
- getRoute: GetRout
- };
- return service;
- function GetRout() {
- var deferred = $q.defer();
- $http.get(Configs.MasterRoutingServerUrl)
- .success(function(data, status, headers, config) {
- Route = data.split('|')[0];
- deferred.resolve(Route);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- Route = "http://m.pipeline.telewebion.com";
- deferred.resolve(Route);
- return deferred.promise;
- })
- return deferred.promise;
- }
- }
- function ArtistSrv($http,$q,Configs) {
- var Artist = {};
- var service = {
- getArtist: Get,
- updateArtist: Update,
- createArtist: Create
- };
- return service;
- function Get(Id) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getModel&model=artist&artist_id='+Id)
- .success(function(data, status, headers, config) {
- Artist=data;
- deferred.resolve(Artist);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function Update(id, title, nickname, gender, biography, palce, activities) {
- var deferred = $q.defer();
- $http.post(Configs.MasterWebserviceUrl+'/op?action=getModel&model=artist&artist_id='+Id,{artist_id:id,
- artist_title:title, artist_nickname:nickname, artist_gender:gender, artist_biography:biography,
- birth_palce: palce, artist_activities:activities})
- .success(function(data, status, headers, config) {
- Artist=data;
- deferred.resolve(Artist);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function Create(title, nickname, gender, biography, birth_palce, activities) {
- var deferred = $q.defer();
- $http.post(Configs.MasterWebserviceUrl+'/op?action=createModel&model=artist',{artist_title:title,
- artist_nickname:nickname, artist_gender:gender, artist_biography:biography,
- birth_palce: birth_palce, artist_activities:activities})
- .success(function(data, status, headers, config) {
- Artist=data;
- deferred.resolve(Artist);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- }
- function FavoriteListSrv($http,$q,Configs) {
- var FavoriteList = {};
- var service = {
- getFavoriteList: Get,
- updateFavoriteList: Update,
- createFavoriteList: Create,
- getChildList: GetChilds,
- getChildEpisodeList: GetEpisodeChilds,
- getFavoriteListParents: GetFavoriteListParents,
- getFavoriteListByEpisode: GetFavoriteListByEpisode
- };
- return service;
- function Get(Id, token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl+'/?action=getModel&model=favorite_list&favorite_list_id='+Id+"&token="+token)
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function Update(Id, NameFa, NameEn, Parent, Description, token) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/?action=saveModel&model=favorite_list&token='+token+'&favorite_list_id='+Id, {name_en: NameEn, name_fa:NameFa, parent: Parent, child_description: Description})
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Create(NameFa, NameEn, Parent, Description, token) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/?action=createModel&model=favorite_list&token='+token, {name_en: NameEn, name_fa:NameFa, parent:Parent, child_description: Description})
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function GetChilds(Parent, Offset, Limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getFavoriteListChilds&id='+Parent+'&offset='+Offset +'&limit='+Limit)
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetEpisodeChilds(Parent, Offset, Limit) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getFavoritListEpisodes&favorite_list_id='+Parent+'&offset='+Offset +'&limit='+Limit)
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetFavoriteListParents(Parent) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getFavoriteListParents&id='+Parent)
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function GetFavoriteListByEpisode(EpisodeId) {
- var deferred = $q.defer();
- $http.get(Configs.MasterWebserviceUrl+'/op?action=getEpisodeTreeFavoriteList&episode_id='+EpisodeId)
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- }
- function AdBankSrv($http,$q,Configs,$window) {
- var AdBank = {};
- var service = {
- addAdBank:AddAdBank,
- saveAdBank:SaveAdBank,
- deleteAdBank:DeleteAdBank
- }
- return service;
- function AddAdBank(ad_title,ad_tag_url,ad_probability,ad_target,ad_for_iranian,ad_enable,token) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/?action=createModel&model=adbank&token='+token, {ad_title: ad_title,
- ad_tag_url:ad_tag_url, ad_probability:ad_probability, ad_target: ad_target, ad_for_iranian: ad_for_iranian,
- ad_enable:ad_enable})
- .success(function(data, status, headers, config) {
- AdBank=data;
- deferred.resolve(AdBank);
- return deferred.promise;
- });
- return deferred.promise;
- }
- function SaveAdBank(Id,token,ad_title,ad_tag_url,ad_probability,ad_target,ad_for_iranian,ad_enable) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/?action=saveModel&model=adbank&token='+token,
- {ad_title: ad_title,
- ad_id:Id,
- ad_tag_url:ad_tag_url, ad_probability:ad_probability, ad_target: ad_target, ad_for_iranian: ad_for_iranian,
- ad_enable:ad_enable})
- .success(function(data, status, headers, config) {
- AdBank=data;
- deferred.resolve(AdBank);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function DeleteAdBank(id, token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl+'/?action=deleteModel&model=adbank&id='+id+'&token='+token)
- .success(function(data, status, headers, config) {
- AdBank=data;
- deferred.resolve(AdBank);
- return deferred.promise;
- })
- return deferred.promise;
- }
- }
- function AdsSrv($http,$q,Configs) {
- var FavoriteList = {};
- var service = {
- getAd: Get,
- update: Update,
- create: Create,
- deleteAd: Delete
- };
- return service;
- function Get(Id, token) {
- var deferred = $q.defer();
- $http.get(Configs.MasterAdminWebserviceUrl+'/?action=getModel&model=ad&id='+Id+"&token="+token)
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function Update(id, title, mode, link_url, media_path, media_path_static, media_duration, prob, device, target, enable
- , token) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/?action=saveModel&model=ads&token='+token+'&ad_id='+id,
- {ad_id: id, ad_title: title, ad_mode:mode, ad_media_link:link_url,
- ad_media_path: media_path, ad_media_path_static: media_path_static,ad_duration:media_duration,
- ad_probability:prob, ad_device:device, ad_target:target, ad_enable:enable})
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- })
- return deferred.promise;
- }
- function Create(title, mode, link_url, media_path, media_path_static, media_duration, prob, device, target, enable
- , token) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/?action=createModel&model=ads&token='+token, {ad_title: title,
- ad_mode:mode, ad_media_link:link_url, ad_media_path: media_path, ad_media_path_static: media_path_static,
- ad_duration:media_duration, ad_probability:prob, ad_device:device, ad_target:target, ad_enable:enable})
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- function Delete(id, token) {
- var deferred = $q.defer();
- $http.post(Configs.MasterAdminWebserviceUrl+'/?action=deleteModel&model=ad&&token='+token,{ad_id:id})
- .success(function(data, status, headers, config) {
- FavoriteList=data;
- deferred.resolve(FavoriteList);
- return deferred.promise;
- })
- .error(function(data, status, headers, config) {
- // $window.location.replace('/#!/404');
- })
- return deferred.promise;
- }
- }
- angular
- .module('tw-directive',[])
- .directive('compareTo', compareTo)
- .directive('player', Player)
- .controller('PlayerCtrl', PlayerCtrl);
- PlayerCtrl.$inject = ['$scope','SecurityFcy','deviceDetector','Configs','Messages','EpisodeFcy', '$http','$q','$window','$timeout'];
- function PlayerCtrl($scope,SecurityFcy,deviceDetector,Configs,Messages,EpisodeFcy, $http, $q, $window,$timeout){
- var plc = this;
- plc.isLoaded=false;
- plc.IsIphone = function(){
- return !!navigator.userAgent.match(/iPad/i);
- }
- window.ChangeQuality = function (index) {
- var currentTime = window.Player.currentTime();
- window.Player.pause();
- window.Play(index, false);
- window.Player.play();
- window.Player.on('loadeddata', function () {
- if(DeviceDetection.IsIos || DeviceDetection.IsIpad){
- window.Player.currentTime(currentTime);
- }else{
- setTimeout(function () {
- window.Player.currentTime(currentTime);
- },500);
- }
- });
- }
- plc.progressBarUpdate = function () {
- var currentTime = window.Player.currentTime();
- var duration = window.Player.duration();
- var percentage = (currentTime/duration)*100;
- $(".vjs-progress-holder.vjs-slider").attr("aria-valuenow",(percentage));
- }
- plc.ErrorHandler = function () {
- if(window.tryCount<10){
- window.Play(plc.Settings.LastPlayedIndex+1);
- window.tryCount = window.tryCount +1;
- }
- }
- plc.newButtonToggle = function() {
- setTimeout(function () {
- var adaptiveItem = "<div class='videojs-adaptive-button' tabindex='1'> HD </div>";
- var adaptiveQuality = "<div class='videojs-adaptive-container' tabindex='1'><ul>";
- for(var i=0;i<=window.videoQaulities.length-1;i++){
- adaptiveQuality += "<li><span class='selected-quality'><i class='fa fa-circle'></i> </span><button onclick='window.ChangeQuality("+i+")'> "+window.videoQaulities[i].title+" کیفیت </button> "+" </li> ";
- }
- adaptiveQuality += "</ul></div>";
- $(".vjs-control-bar").append(adaptiveItem);
- $(".vjs-control-bar").append(adaptiveQuality);
- },500)
- };
- plc.ConvertToPersianNumber = function(string){
- return persianUtils.toPersianNumber(string);
- };
- plc.IsSmartTV = function() {
- return navigator.userAgent.search(/TV/i) >= 0;
- };
- plc.PlayWithIndex=function(index,goForNext){
- if(Configs.Player.Live.DefaultPlayer=="RadiantPlayer"){
- plc.RadiantPlayWithIndex(index, goForNext);
- }
- else if(Configs.Player.Live.DefaultPlayer=="JwPlayer") {
- if(typeof goForNext!='undefined' && goForNext===true){
- var length=plc.episode.links.length;
- if(index<length-1){
- index++;
- }
- else{
- index=0;
- }
- }
- plc.SetPassiveButton(plc.Settings.LastPlayedIndex);
- plc.SetActiveButton(index);
- plc.Settings.LastPlayedIndex=index;
- if(plc.Settings.TryCount<=30){
- plc.Settings.TryCount++;
- plc.Player(plc.viewPlayLinks[index].link);
- }
- else{
- plc.Stop();
- }
- }
- };
- plc.SetActiveButton=function(index){
- var selectedItem = document.getElementById("SelectLink"+index);
- selectedItem.classList.remove("btn-success");
- selectedItem.classList.add("btn-danger");
- }
- plc.SetPassiveButton=function(index){
- var selectedItem = document.getElementById("SelectLink"+index);
- selectedItem.classList.remove("btn-danger");
- selectedItem.classList.add("btn-success");
- }
- plc.Stop=function(){
- plc.playerInstance.stop();
- }
- plc.Play=function(){
- plc.playerInstance.play();
- }
- window.Play = function (index,withAd) {
- if(withAd){
- window.Player.preroll({
- src:{
- src: window.adUrl,
- type:"video/mp4"},
- href:window.adClickUrl,
- adsOptions: {debug:false}
- });
- }
- debuger.log("Now playing with this link: " + window.VideoLinks[index].link);
- window.Player.src([
- { type: "video/mp4", src: window.VideoLinks[index].link }
- ]);
- };
- plc.generateMobileLinkQualities = function (links, type) {
- var items = [];
- var i;
- if(type=="vod"){
- for(i=0;i<=links.length-1;i++){
- var item = {};
- item.link=links[i].link;
- item.title=links[i].title;
- items.push(item);
- }
- }
- else{
- for(i=0;i<=links.length-1;i++){
- var item = {};
- item.link=links[i].link;
- item.title=links[i].bitrate;
- items.push(item);
- }
- }
- window.videoQaulities = items;
- plc.newButtonToggle();
- }
- plc.Player=function(defaultLink){
- benchmark.start("LiveDesktop");
- PageLoadCounter.startTimer();
- /*plc.SetActiveButton(selectedIndex);*/
- setTimeout(function () {
- plc.playerInstance = jwplayer("EpisodePlayer");
- window.LivePlayerInstance = plc.playerInstance;
- plc.playerInstance.setup({
- file: defaultLink,
- width: Configs.Player.Live.PlayerWidth,
- height: Configs.Player.Live.PlayerHeight
- }).play()
- .on('error',function(e){
- plc.PlayWithIndex(plc.Settings.LastPlayedIndex,true);
- })
- .on('play',function(e){
- var label = window.ChannelId +'#'+ window.ChannelQuality;
- PageLoadCounter.stopTimer();
- ga('send', 'event', 'Play-Live', 'server', label,window.TimerResult.toString());
- var endOfBenchMark=benchmark.end("LiveDesktop");
- debuger.info("It took " + endOfBenchMark+ " ms to play");
- $window.ga('send', 'event', 'play', 'startup-live', endOfBenchMark);
- })
- .on('playlistComplete',function(){
- plc.PlayWithIndex(plc.Settings.LastPlayedIndex,true);
- })
- }, 500);
- }
- /*============================== RP ==========================*/
- plc.RadiantPlayerSetting = { TryCount:0, LastPlayedIndex:0, DebugMode:false, AutoPlay:false,
- IsLive:true, Width:800, Height: 600, PlayerContainerId: "", Ad: {Enabled:true, device: "desktop", target:"live"},
- Ga: { PlayType: 'Play-Live', StartupType: "startup-live", Action: "play"}, Subtitle: {Enabled:false}
- }
- plc.RadiantAddPlayed = false;
- window.RadiantPlayer = function (links) {
- plc.RadiantPlayer(links);
- }
- window.RadiantErrorHandler = function () {
- plc.RadiantErrorHandler();
- }
- plc.RadiantPlayer = function (links) {
- benchmark.start("LiveDesktop");
- var bitrates = {
- hls: links
- };
- adURL = Configs.MasterWebserviceUrl+"/ads/serveAds?"+"&target="+plc.RadiantPlayerSetting.Ad.target+"&device="+plc.RadiantPlayerSetting.Ad.device;
- var settings =
- {
- licenseKey: Configs.Players.RadiantPlayer.License,
- bitrates: bitrates,
- delayToFade: Configs.Players.RadiantPlayer.ControllsAutoHideAfter,
- width: plc.RadiantPlayerSetting.Width/*Configs.Player.Live.PlayerWidth*/,
- height: plc.RadiantPlayerSetting.Height,/*Configs.Player.Live.PlayerHeight,*/
- isLive: plc.RadiantPlayerSetting.IsLive,
- ads: plc.RadiantPlayerSetting.Ad.Enabled,
- debug: false/*plc.RadiantPlayerSetting.DebugMode*/,
- streamDebug: false/*plc.RadiantPlayerSetting.DebugMode*/,
- adLinearHideControls: false,
- autoplay: plc.RadiantPlayerSetting.AutoPlay,
- hlsJSMaxBufferLength: 60,
- hlsJSStopDownloadWhilePaused: false,
- hlsJSEnableCEACaptions: false,
- hlsJSLiveSyncDuration: 30,
- adTagUrl: adURL
- };
- var rmp = new RadiantMP(plc.RadiantPlayerSetting.PlayerContainerId);
- if(window.playerInstance != null) {
- window.playerInstance.destroy();
- }
- rmp.destroy();
- rmp.init(settings);
- var rmpContainer = document.getElementById(plc.RadiantPlayerSetting.PlayerContainerId);
- rmpContainer.addEventListener('error', plc.RadiantErrorHandler);
- /*rmpContainer.addEventListener('play', plc.RadiantPlayEvent);*/
- rmpContainer.addEventListener('adcomplete', plc.RadiantAdCompleteEvent);
- rmpContainer.addEventListener('adstarted', plc.RadiantAdStartedEvent);
- rmpContainer.addEventListener('enterfullscreen', resana.onFullscreenListener);
- rmpContainer.addEventListener('exitfullscreen', resana.onFullscreenListener);
- rmpContainer.addEventListener('timeupdate', resana.onTimeListener);
- rmpContainer.addEventListener('play', function(){
- resana.onPlayListener();
- plc.RadiantPlayEvent();
- });
- rmpContainer.addEventListener('pause', resana.onPauseListener);
- rmpContainer.addEventListener('ended', resana.onCompleteListener);
- rmpContainer.addEventListener('ready', function () {
- /**
- * The first parameter is the type of player. Resana's web SDK currently supports jwplayer, videojs and rmp
- */
- resana.setup('rmp', {container: '#'+plc.RadiantPlayerSetting.PlayerContainerId, restTime: 10, playerObj: rmp});
- /**
- * 10004 is your Resana ID
- * The second parameter is the category/tag of the video. To specify multiple
- * categories, use "-" (dash) to separate them.
- */
- resana.init(10013, 'categories-of-the-video');
- if(plc.RadiantPlayerSetting.Subtitle.Enabled == true){
- resana.start();
- }
- });
- plc.playerInstance = rmp;
- window.playerInstance = rmp;
- };
- plc.RadiantErrorHandler= function () {
- if(plc.RadiantPlayerSetting.TryCount<10){
- if((plc.RadiantPlayerSetting.LastPlayedIndex+1)<plc.viewPlayLinks.length){
- plc.PlayWithIndex(plc.RadiantPlayerSetting.LastPlayedIndex+1);
- }
- else{
- plc.PlayWithIndex(0);
- }
- plc.RadiantPlayerSetting.TryCount +=1;
- errorPlayer.hide();
- }
- };
- plc.RadiantPlayEvent= function () {
- PageLoadCounter.stopTimer();
- var label = window.ChannelId +'#'+ window.ChannelQuality;
- var endOfBenchMark=benchmark.end("LiveDesktop");
- debuger.info("It took " + endOfBenchMark+ " ms to play");
- $window.ga('send', 'event', plc.RadiantPlayerSetting.Ga.PlayType, 'server',label, endOfBenchMark);
- $window.ga('send', 'event', 'play', plc.RadiantPlayerSetting.Ga.StartupType, endOfBenchMark);
- }
- plc.RadiantPlayWithIndex=function(index,goForNext){
- if(typeof goForNext!='undefined' && goForNext===true){
- var length=plc.episode.links.length;
- if(index<length-1){
- index++;
- }
- else{
- index=0;
- }
- }
- plc.SetPassiveButton(plc.RadiantPlayerSetting.LastPlayedIndex);
- plc.SetActiveButton(index);
- plc.RadiantPlayerSetting.LastPlayedIndex=index;
- if(plc.RadiantPlayerSetting.TryCount<=10){
- plc.RadiantPlayerSetting.TryCount++;
- destroyRadiantPlayer.destroy();
- plc.playerInstance.stop();
- plc.playerInstance.destroy();
- plc.RadiantPlayer(plc.viewPlayLinks[index].link);
- }
- else{
- plc.playerInstance.stop();
- }
- };
- plc.RadiantAdCompleteEvent = function () {
- if(plc.RadiantAddPlayed==false){
- ga('send', 'event', 'ads-'+plc.RadiantPlayerSetting.Ad.device, plc.RadiantPlayerSetting.Ad.target , "end");
- }
- else{
- plc.RadiantAddPlayed=true;
- }
- }
- plc.RadiantAdStartedEvent = function () {
- /*ga('send', 'event', 'ads-'+plc.RadiantPlayerSetting.Ad.device, plc.RadiantPlayerSetting.Ad.target, "start");*/
- }
- /*============================= EORP =========================*/
- var flagForOneInit = true;
- $scope.$watch('plc.episode', function() {
- if(typeof plc.episode!='undefined' && plc.episode.id!='undefined' && plc.episode.id!='' && plc.episode.length>0 && (plc.episode.links!='undefined' || plc.episode.vod_link!='undefined')) {
- if(!plc.isLoaded) {
- try {
- plc.Settings={};
- plc.device=deviceDetector.device;
- plc.episode = angular.fromJson(plc.episode);
- plc.isLoaded=true;
- plc.source=[];
- plc.Settings.LastPlayedIndex=0;
- plc.Settings.TryCount=0;
- plc.hlsSource=[];
- if(plc.type=='live'){
- if(plc.device=='android' || plc.device=='iphone' || plc.IsSmartTV() || plc.IsIphone()){
- window.activePlayer = "MobilePlayer";
- window.activePlayerToolbarPlay='FullScreenTheMobileLivePlayer';
- window.playerType = 'VideoJs';
- window.activePlayerToolbarMute = 'VoiceControlMobileLivePlayer';
- SecurityFcy.getDefaultLiveLink(plc.episode.links).then(function(result){
- SecurityFcy.getAdvertisement("mobile","live").then(function (addResult) {
- SecurityFcy.parsVas2(addResult).then(function (FinalAdResult) {
- window.adUrl = FinalAdResult.src;
- window.adClickUrl = FinalAdResult.onClick;
- window.adStart = FinalAdResult.onStart;
- loadingControl.hideLoading();
- window.adCompelete = FinalAdResult.onComplete;
- var adFinished = false;
- window.Player = videojs('MobilePlayer')
- .on('play', function () {
- loadingControl.hideLoading();
- if(adFinished){
- var endOfBenchMark=benchmark.end("LiveMobile");
- debuger.info("It took " + endOfBenchMark+ " ms to play");
- $window.ga('send', 'event', 'play', 'startup-live-mobile', endOfBenchMark);
- $window.ga('send', 'event', 'Play-Live-Mobile', 'server', window.LiveChannelDecriptor, endOfBenchMark);
- }
- })
- .on('adstart', function () {
- controlBar.hideBar();
- bigPlayButton.hideButton();
- loadingControl.showLoading();
- ga('send', 'event', 'ads-mobile',"live", "start");
- $.get(window.adStart);
- })
- .on('adended',function () {
- controlBar.showBar();
- loadingControl.hideLoading();
- $.get(window.adCompelete);
- ga('send', 'event', 'ads-mobile',"live", "end");
- benchmark.start("LiveMobile");
- adFinished=true;
- window.Play(0,false);
- })
- .on('error', function(e) {
- e.stopImmediatePropagation();
- plc.ErrorHandler();
- });
- window.VideoLinks=plc.episode.links;
- plc.generateMobileLinkQualities(plc.episode.links,"live");
- window.Play(0,true);
- });
- });
- })
- }
- else{
- SecurityFcy.getDefaultLiveLink(plc.episode.links).then(function(result){
- if(Configs.Player.Live.DefaultPlayer == "JwPlayer"){
- loadingControl.hideLoading();
- plc.viewPlayLinks=plc.episode.links;
- debuger.log("Live is playing with this link: " + result.Link);
- plc.Settings.LastPlayedIndex=result.Index;
- window.ChannelQuality = plc.episode.links[result.Index].title;
- plc.Player(result.Link);
- }
- else if(Configs.Player.Live.DefaultPlayer == "RadiantPlayer"){
- loadingControl.hideLoading();
- plc.viewPlayLinks=plc.episode.links;
- debuger.log("Live is playing with this link: " + result.Link);
- plc.Settings.LastPlayedIndex=result.Index;
- window.ChannelQuality = plc.episode.links[result.Index].title;
- plc.RadiantPlayerSetting.LastPlayedIndex=result.Index;
- plc.RadiantPlayerSetting.DebugMode=true;
- plc.RadiantPlayerSetting.AutoPlay=true;
- plc.RadiantPlayerSetting.IsLive=true;
- plc.RadiantPlayerSetting.With=Configs.Player.Live.PlayerWidth;
- plc.RadiantPlayerSetting.Height=Configs.Player.Live.PlayerHeight;
- plc.RadiantPlayerSetting.PlayerContainerId="EpisodePlayer";
- plc.RadiantPlayerSetting.Ad.device="desktop";
- plc.RadiantPlayerSetting.Ad.target="live";
- plc.RadiantPlayerSetting.Ad.Enabled=true;
- window.RadiantPlayer(result.Link);
- }
- })
- }
- }
- else if(plc.type=='episode') {
- if (plc.episode.file_path != '' && plc.episode.file_path != 'undefined') {
- plc.source.push(plc.episode.file_path);
- window.IsPlayingVod = true;
- if (plc.device == 'android' || plc.device == 'iphone' || plc.IsSmartTV() || plc.IsIphone()) {
- window.activePlayer = "MobileVodPlayer";
- window.activePlayerToolbarPlay = 'MobileVodPlayerToolbarPlayPause';
- window.playerType = 'VideoJs';
- window.activePlayerToolbarMute = 'VoiceControlMobileVodPlayer';
- if (plc.episode.vod_link !== 'undefined') {
- EpisodeFcy.getSortedMobileListByQuality(plc.episode.vod_link).then(function (result) {
- SecurityFcy.getAdvertisement("mobile","vod").then(function (addResult) {
- SecurityFcy.parsVas2(addResult).then(function (FinalAdResult) {
- window.adUrl = FinalAdResult.src;
- loadingControl.hideLoading();
- window.adClickUrl = FinalAdResult.onClick;
- window.adStart = FinalAdResult.onStart;
- var adFinished = false;
- window.adCompelete = FinalAdResult.onComplete;
- window.Player = videojs('MobilePlayer')
- .on('play', function () {
- loadingControl.hideLoading();
- if(adFinished){
- var endOfBenchMark=benchmark.end("VodMobile");
- debuger.info("It took " + endOfBenchMark+ " ms to play");
- $window.ga('send', 'event', 'play', 'startup-vod','mobile', endOfBenchMark);
- $window.ga('send', 'event', 'Play-Vod-Mobile', 'server', window.EpisodeId, endOfBenchMark);
- }
- })
- .on('adstart', function () {
- controlBar.hideBar();
- bigPlayButton.hideButton();
- $.get(window.adStart);
- ga('send', 'event', 'ads-mobile',"vod", "start");
- })
- .on('adended',function () {
- controlBar.showBar();
- loadingControl.showLoading();
- benchmark.start("VodMobile");
- $.get(window.adCompelete);
- ga('send', 'event', 'ads-mobile',"vod", "end");
- adFinished = true;
- })
- .on('error', function(e) {
- plc.ErrorHandler();
- e.stopImmediatePropagation();
- });
- window.VideoLinks=result;
- plc.generateMobileLinkQualities(plc.episode.vod_link,"vod");
- window.Play(0,true);
- });
- });
- });
- }
- }
- else {
- if (Configs.Player.Vod.DefaultPlayer == 'JwPlayer') {
- SecurityFcy.getToken().then(function(securityToken){
- SecurityFcy.generateVodSmilLink(plc.source, plc.episode.id,'JwPlayer',securityToken).then(function (result) {
- var playerInstance = jwplayer(Configs.Player.Vod.PlayerPlaceId);
- debuger.info("Now playing live with this link: " + result);
- playerInstance.setup({
- file: result,
- image: plc.episode.large_picture_path,
- width: Configs.Player.Vod.PlayerWidth,
- height: Configs.Player.Vod.PlayerHeight
- });
- })
- })
- }
- else if (Configs.Player.Vod.DefaultPlayer == 'OsmfPlayer') {
- SecurityFcy.getToken().then(function(securityToken){
- SecurityFcy.generateVodSmilLink(plc.source, plc.episode.id, 'OsmfPlayer',securityToken).then(function (result) {
- SecurityFcy.getAdvertisement("desktop","vod").then(function (addResult) {
- SecurityFcy.parsVas2(addResult).then(function (FinalAdResult) {
- window.adUrl = FinalAdResult.src;
- window.adClickUrl = FinalAdResult.onClick;
- window.adStart = FinalAdResult.onStart;
- loadingControl.hideLoading();
- window.adCompelete = FinalAdResult.onComplete;
- debuger.log("Now Playing this link: " + result[0]);
- try {
- window.vod_link = result[0];
- } catch (e) {
- }
- ;
- PageLoadCounter.startTimer();
- var flashvars = {
- /*src_preroll: "onJSBridge",*/
- src: escape(result),
- scaleMode: "stretch",
- javascriptCallbackFunction: "onJSBridge"
- };
- var params = {
- allowFullScreen: true,
- allowScriptAccess: "always",
- bgcolor: "#000000",
- wmode: 'opaque'
- };
- var attrs = {
- name: "Player",
- id: "ply"
- };
- swfobject.embedSWF(Configs.Player.Vod.OsfmSWFPath, Configs.Player.Vod.PlayerPlaceId, Configs.Player.Vod.PlayerWidth, Configs.Player.Vod.PlayerHeight, "10.2", null, flashvars, params, attrs);
- })
- })
- })
- })
- }
- else if (Configs.Player.Vod.DefaultPlayer == 'RadiantPlayer'){
- SecurityFcy.getToken().then(function(securityToken){
- SecurityFcy.generateVodSmilLink(plc.source, plc.episode.id, 'OsmfPlayer',securityToken).then(function (result) {
- loadingControl.hideLoading();
- plc.viewPlayLinks=plc.episode.links;
- debuger.log("Vod is playing with this link: " + result);
- plc.RadiantPlayerSetting.DebugMode=true;
- plc.RadiantPlayerSetting.AutoPlay=true;
- plc.RadiantPlayerSetting.IsLive=false;
- plc.RadiantPlayerSetting.Ga.StartupType="startup-vod"
- plc.RadiantPlayerSetting.Ga.PlayType="Play-Vod-Desktop"
- plc.RadiantPlayerSetting.With=Configs.Player.Live.PlayerWidth;
- plc.RadiantPlayerSetting.Height=Configs.Player.Live.PlayerHeight;
- plc.RadiantPlayerSetting.PlayerContainerId="EpisodePlayer";
- plc.RadiantPlayerSetting.Ad.device="desktop";
- plc.RadiantPlayerSetting.Ad.target="vod";
- plc.RadiantPlayerSetting.Ad.Enabled=true;
- window.RadiantPlayer(result);
- })
- })
- }
- }
- }
- else{
- if(plc.episode.has_video=='-1'){
- NgNote.Error(Messages.Fa.CopyrightError,30);
- }
- else if(plc.episode.has_video=='0'){
- NgNote.Error(Messages.Fa.FileNotFoundError,30);
- }
- }
- }
- }
- catch (e) {
- }
- }
- }
- }
- );
- }
- function compareTo(){
- return {
- require: "ngModel",
- scope: {
- otherModelValue: "=compareTo"
- },
- link: function(scope, element, attributes, ngModel) {
- ngModel.$validators.compareTo = function(modelValue) {
- return modelValue == scope.otherModelValue;
- };
- scope.$watch("otherModelValue", function() {
- ngModel.$validate();
- });
- }
- };
- }
- /*
- * Description: Player directive which renders and replace a player with directive (player) as attribute
- * Developed by: Masoud motallebipour ( masoud.motallebipour@gmail.com )
- * Develop date: 2015-08-12
- * Last update date: 2015-08-15
- * Parameters: take two input parameters ( src for video source and img for image source )
- * */
- function Player(){
- var directive = {
- restrict: 'A',
- templateUrl: '/rstatic/ntwv114/nginxcache/template/directive/player.html',
- scope: {
- episode: '@eps',
- type: '@typ'
- },
- link: linkFunc,
- controller: PlayerCtrl,
- replace:false,
- controllerAs: 'plc',
- bindToController: true // because the scope is isolated
- };
- return directive;
- function linkFunc(scope, el, attr, ctrl) {
- }
- }
- var player;
- var isStartedPlaying = false;
- var initialBufferTime = 0.1;
- var bufferTime = 4;
- window.prerollShown = false;
- var expandedBufferTime = 1800;
- window.VodIsPlayed = false;
- function getVodServer(vod_link, callback) {
- if (window.vod_server != "")
- return callback(window.vod_server);
- try {
- jQuery.ajax({
- 'url': vod_link,
- 'success': function (data) {
- var res = /.*:1935/.exec(data);
- window.vod_server = res[0];
- callback(window.vod_server);
- }
- });
- }
- catch(err) { window.vod_server = 'server-not-found'; callback(window.vod_server);};
- };
- function onJSBridge(playerId, event, data) {
- playerId = "ply";/*typeof playerId !== 'undefined' ? playerId : 'EpisodePlayer';*/
- switch(event) {
- case "onJavaScriptBridgeCreated":
- player = document.getElementById(playerId);
- player.addEventListener("bufferingChange", "onBufferChange");
- player.addEventListener("mediaError", "onMediaError");
- window.vod_server = "";
- break;
- // player state change
- case "ready":
- playAd();
- case "loading":
- isStartedPlaying = false;
- player.setBufferTime(initialBufferTime);
- break;
- case "playing":
- if(window.IsPlayingVod){
- jQuery("#EpisodeMomentsHolder").show();
- }
- var label = window.EpisodeId;
- PageLoadCounter.stopTimer();
- if(!window.VodIsPlayed){
- window.VodIsPlayed = true;
- ga('send', 'event', 'Play-Vod-Desktop', 'server', label,window.TimerResult.toString());
- }
- isStartedPlaying = true;
- //ga('send', 'event', 'play', 'link', window.ip);
- break;
- case "paused":
- //ga('send', 'event', 'pause', 'link', window.ip);
- break;
- case "buffering":
- if (player.getCurrentTime == undefined)
- break;
- var pos = player.getCurrentTime();
- if (pos > 10) {
- window.num_vod_buffered += 1;
- };
- if (window.num_vod_buffered > 5) {
- getVodServer(window.vod_link, function (data) {
- ga('send', 'event', 'Vod-buffer', window.vod_server);
- })
- };
- break;
- // other events
- case "mediaSize":
- case "seeking":
- player.setBufferTime(initialBufferTime);
- case "seeked":
- case "volumeChange":
- case "durationChange":
- case "timeChange":
- case "progress": // for progressive download only
- case "complete":
- window.prerollShown=true;
- case "advertisement":
- if(data==''){
- player.play2();
- }
- break;
- default:
- // console.log(event, data);
- break;
- }
- };
- function playAd() {
- if (true) {
- player.displayAd({
- url: window.adUrl,
- isAdvertisement:true,
- hideScrubBarWhilePlayingAd: true,
- pauseMainMediaWhilePlayingAd: true,
- resumePlaybackAfterAd: true,
- clickUrl: window.adClickUrl,
- closable: false,
- onStart: sendAdEvent("start")
- });
- }
- }
- function sendAdEvent(event) {
- if(event=="start"){
- $.get(window.adStart);
- window.prerollShown = true;
- ga('send', 'event', 'ads-desktop',"vod", "start");
- debuger.info("Ad start playing");
- setTimeout(function () {
- sendAdEvent("finished");
- },6000)
- }
- else if(event=="finished"){
- $.get(window.adCompelete);
- ga('send', 'event', 'ads-desktop',"vod", "end");
- }
- }
- function onMediaError(code, message, detail, playerId) {
- window.vod_server = getVodServer(window.vod_link, function (data) {
- ga('send', 'event', 'Vod-Error-Desktop:', code + ':' + message, data);
- });
- }
- function onBufferChange(buffering) {
- if (!isStartedPlaying) return;
- if (buffering) {
- player.setBufferTime(bufferTime);
- } else {
- player.setBufferTime(expandedBufferTime);
- }
- }
- angular
- .module('tw-constant',[])
- .constant('Configs', {
- MasterWebserviceUrl: "http://m.telewebion.com/op",
- MasterAdminWebserviceUrl: "http://m.pipeline.telewebion.com/op/admin",
- SlaveWebserviceUrl: "http://m.telewebion.com/op",
- MasterRoutingServerUrl: "http://m.telewebion.com/route",
- VodSmilServerUrl: "http://m.telewebion.com/smil",
- JwPlayer6LicenceKey: "JMYgt8cchkUi0xnrOhd21d9j8myk22cellFfZA==",
- JwPlayer7LicenceKey: "S85cXpLUgXen47MbCLHqBUhPKnJkyh4KOOr3Rw==",
- JwPlayer6LibraryPath: "/scripts/jwPlayer6/jwplayer.js",
- JwPlayer7LibraryPath: "/scripts/jwPlayer/jwplayer.js",
- SearchEpisodeWebserviceURL: "/op?action=getSearchEpisodes",
- SearchProgramWebserviceURL: "/op?action=getSearchPrograms",
- IsVodAdvertisementEnabled: true,
- Players: {
- JwPlayer:{License:"S85cXpLUgXen47MbCLHqBUhPKnJkyh4KOOr3Rw=="},
- OsmfPlayer:{License:""},
- RadiantPlayer:{
- License:"Kl8lN3ZjdjR2K3NlazJ5ZWk/cm9tNWRhc2lzMzBkYjBBJV8q",
- ControllsAutoHideAfter: 3000
- },
- VideoJs:{License:""}
- },
- Player : {
- Vod: {
- DefaultPlayer: "RadiantPlayer",
- PlayerPlaceId: "EpisodePlayer",
- OsfmSWFPath: "/media/js/osmfPlayer/GrindPlayer.swf",
- PlayerWidth: 900,
- PlayerHeight: 500
- },
- Live: {
- DefaultPlayer: "RadiantPlayer",
- PlayerWidth: 900,
- PlayerHeight: 500
- },
- LiveMobile: {
- DefaultPlayer: "VideoJs",
- PlayerWidth: 500,
- PlayerHeight: 400
- }
- },
- DefaultBitrate:{
- Mobile: {
- Vod: '256K',
- Live: ''
- },
- Desktop: {
- Vod: '',
- Live: ''
- }
- }
- })
- .constant('SiteConstants', {
- En:{
- PageTitle:{
- HomePage:'TV Show|Movies|TV Series|Entertainment',
- ForgotPassword:"Forgot password",
- Login:"Login to user account",
- Register:"Open a user account",
- Search: "Looking for : "
- },
- Description:{
- "HomePage": ""
- },
- Keywords:{"HomePage": ""}
- },
- Fa:{
- PageTitle:{
- HomePage:"تلوبیون | مرجع پخش زنده و دانلود فیلم ، سریال و سایر برنامه های تلویزیون",
- ForgotPassword:"فراموشی کلمه عبور",
- Login:"ورود به حساب کاربری",
- Register:"ایجاد حساب کاربری",
- Search:"جستجو برای واژه: ",
- JobOpportunity: "موقعیت های شغلی",
- Partners: "شرکای تجاری تلوبیون",
- ConfirmRegistration: "تکمیل ثبت نام",
- ramezan95: "ویژه ماه رمضان ۹۵ - تلوبیون",
- ResendActivationEmail: "ارسال مجدد ایمیل فعال سازی",
- ResetPassword: "بازیابی رمز عبور",
- LigeBartar95: "فوتبال لیگ برتر ایران فصل ۹۵-۹۶",
- TagsPage: "لیست قسمت برنامه های این برچسب",
- MainAdminPage: "دسترسی سریع به بخشهای مدیریتی",
- MoviesPage: "لیست فیلم ها",
- ShademanehPage: "همیشه به خنده",
- OlympicRioPage: "صفحه ویژه المپیک ریو ۲۰۱۶",
- EuropeLeaguesPage: "صفحه ویژه لیگ های اروپایی",
- KidsPage: "صفحه ویژه کودکان"
- },
- Description:{
- "HomePage": "دانلود فیلم,دانلود سریال,دانلود فیلم ایرانی,دانلود سریال ایرانی,دانلود برنامه تلویزیون,پخش زنده شبکه ها,پخش زنده فوتبال,پخش زنده ورزش,پخش زنده تلویزیون,پخش شبکه سه"
- },
- Keywords:{"HomePage":'پخش زنده شبکه های تلویزیون ایران,آرشیو تلویزیون ایران,پخش زنده شبکه 3 و ورزش و پویا,پخش زنده فوتبال و بسکتبال و والیبال,Iran TV Channels,Iran Live TV,Iran Live Television,Iran TV Archive,Online Streaming,Watch Iran Online Video,Iran TV Live Streaming Show,Live Iran Sport Football,Persian TV Serie,Persian-Farsi TV Online Streaming تلوبیون,تلوبیون'}
- }
- })
- .constant("Messages", {
- En:{
- "SuccessfulRegistration":"Dear user, your registration was successful",
- "DuplicatedEmailRegistration":"Dear user, your email already exists in our database",
- "FailedRegistration":"Dear user, there was a problem in registration process, please try later",
- "SuccessfulLogin": "Login Successful",
- "FailedLogin": "Bad username or password",
- "CopyrightError": "Dear user, this video is restricted in your aria because of Copyright issues, if your using proxy please disable that and try again",
- "FileNotFoundError": "Dear user, this video is restricted in your aria because of Copyright issues, if your using proxy please disable that and try again"
- },
- Fa:{
- "SuccessfulRegistration":"کاربر گرامی، ثبت نام شما با موفقیت انجام پذیرفت، لطفا جهت فعال سازی حساب کاربری بر روی لینک فعال سازی بر روی ایمیل خود کلیک کنید",
- "DuplicatedEmailRegistration":"کاربر گرامی، ایمیل شما قبلا در سیستم ثبت شده",
- "FailedRegistration":"کاربر گرامی، در پروسه ثبت نام با مشکلی مواجح شدیم، لطفا مجددا تلاش فرمایید",
- "SuccessfulLogin": "ورود موفقیت آمیز",
- "FailedLogin": "ایمیل یا کلمه عبور صحیح نمی باشد یا حساب کاربری شما هنوز فعال نشده",
- "CopyrightError": "کاربر گرامی به دلیل قوانین کپی رایت این ویدئو در منطقه جغرافیایی شما قابل مشاهده نیست. در صورتی که از ویپیان یا پروکسی استفاده میکنید، آن را خاموش کنید و مجددا تلاش کنید.",
- "FileNotFoundError": "کاربر گرامی، فایل این ویدیو در حال حاضر آماده استفاده نمی باشد، لطفا مجددا تلاش فرمایید",
- "CopyrightErrorLive": "کاربر گرامی، با توجه به قوانین کپی رایت از پخش زنده این مسابقه معذوریم",
- "LoginBadUsernameOrPassword": "ایمیل یا کلمه عبور شما صحیح نمی باشد",
- "LoginSuccessful": "ورود موفق به حساب کاربری",
- "LogoutSuccessful": "خروج موفق از حساب کاربری",
- "NotAllowedToDownload": "جهت دانلود این ویدیو باید وارد حساب کاربری شده باشید",
- "AccountVerificationSuccess": "حساب کاربری شما با موفقیت فعال شد",
- "AccountVerificationFailed": "لینک وارد شده معتبر نیست و یا حساب کاربری شما قبلا فعال شده است",
- "RobotError": "لطفا من روبات نیستم رو تایید کنید.",
- "ConfirmRegistrationResend": "ایمیل فعال سازی مجددا برای شما ارسال گردید"
- }
- });
- angular
- .module('tw',['tw-factory','tw-service','tw-directive','tw-constant','ngRoute','ng.deviceDetector','ngMd5','angular-cache','satellizer','toastr','ImageCropper','noCAPTCHA'])
- .config(config)
- .controller('HomeCtrl', HomeCtrl)
- .controller('LoginCtrl', LoginCtrl)
- .controller('GeneralCtrl', GeneralCtrl)
- .controller('RegisterCtrl', RegisterCtrl)
- .controller('PromotionsListCtrl', PromotionsListCtrl)
- .controller('PromotionsAddCtrl', PromotionsAddCtrl)
- .controller('PromotionsEditCtrl', PromotionsEditCtrl)
- .controller('UnsubscribeCtrl', UnsubscribeCtrl)
- .controller('SearchCtrl', SearchCtrl)
- .controller('LiveCtrl', LiveCtrl)
- .controller('ChannelArchiveCtrl', ChannelArchiveCtrl)
- .controller('ChannelArchiveOldCtrl', ChannelArchiveOldCtrl)
- .controller('TestCtrl', TestCtrl)
- .controller('ForgotPasswordCtrl', ForgotPasswordCtrl)
- .controller('ResetPasswordCtrl', ResetPasswordCtrl)
- .controller('EpisodeCtrl', EpisodeCtrl)
- .controller('ProgramCtrl', ProgramCtrl)
- .controller('ListOfProgramCtrl', ListOfProgramCtrl)
- .controller('CategoryCtrl', CategoryCtrl)
- .controller('ChannelsCtrl', ChannelsCtrl)
- .controller('ChannelsCtrl', ChannelsCtrl)
- .controller('DmcaCtrl', DmcaCtrl)
- .controller('TermsCtrl', TermsCtrl)
- .controller("PartnerCtrl",PartnerCtrl)
- .controller('ChangeLogCtrl', ChangeLogCtrl)
- .controller('JobOpportunityCtrl', JobOpportunityCtrl)
- .controller('ArchiveCtrl', ArchiveCtrl)
- .controller('VerifyRegistrationCtrl', VerifyRegistrationCtrl)
- .controller('ResendActivationEmailCtrl', ResendActivationEmailCtrl)
- .controller('profileCtrl', profileCtrl)
- .controller('paymentConfirmationCtrl', paymentConfirmationCtrl)
- .controller('fourOfourCtrl', fourOfourCtrl)
- .controller('oauthLoginCtrl', oauthLoginCtrl)
- .controller('EditEpisodeCtrl', EditEpisodeCtrl)
- .controller('AddEpisodeCtrl', AddEpisodeCtrl)
- .controller('ListOfUserCtrl', ListOfUserCtrl)
- .controller('EditUserCtrl', EditUserCtrl)
- .controller('ListAdsCtrl', ListAdsCtrl)
- .controller('AddAdsCtrl', AddAdsCtrl)
- .controller('EditAdsCtrl', EditAdsCtrl)
- .controller('AngularFileUploader', AngularFileUploader)
- .controller('AngularFileCrop', AngularFileCrop)
- .controller('EditArtistCtrl', EditArtistCtrl)
- .controller('EditProgramCtrl', EditProgramCtrl)
- .controller('AddProgramCtrl', AddProgramCtrl)
- .controller('EditFavoriteListCtrl', EditFavoriteListCtrl)
- .controller('AddArtistCtrl', AddArtistCtrl)
- .controller('AddFavoriteListCtrl', AddFavoriteListCtrl)
- .controller('Ramezan95Ctrl', Ramezan95Ctrl)
- .controller('LigeBartarCtrl', LigeBartarCtrl)
- .controller('ListOfEpisodesCtrl', ListOfEpisodesCtrl)
- .controller('ListOfFavListCtrl', ListOfFavListCtrl)
- .controller('MoviesCtrl', MoviesCtrl)
- .controller('EuropeLeaguesCtrl', EuropeLeaguesCtrl)
- .controller('KidsCtrl', KidsCtrl)
- .controller('ShademanehCtrl', ShademanehCtrl)
- .controller('OlympicsCtrl', OlympicsCtrl)
- .controller('MainAdminCtrl', MainAdminCtrl)
- .controller('SeriesCtrl', SeriesCtrl)
- .controller('TagsCtrl', TagsCtrl)
- .controller('TagCtrl', TagCtrl)
- .controller('AdsBankListCtrl', AdsBankListCtrl)
- .controller('AdsBankEditCtrl', AdsBankEditCtrl)
- .controller('AdsBankAddCtrl', AdsBankAddCtrl)
- .run(Runtime);
- Ramezan95Ctrl.$inject = ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy'];
- LigeBartarCtrl.$inject = ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy','FavoriteListSrv','$scope','FavoriteListFcy','$timeout'];
- HomeCtrl.$inject = ['GeneralInit','EpisodeFcy','ChannelFcy','HomeInit','$rootScope','SiteConstants','ProgressBarFcy','$scope','ProgramFcy','$location','Messages','$window','$timeout'];
- EpisodeCtrl.$inject = ['GeneralInit','$rootScope','EpisodeSrv','Messages','$routeParams','SiteConstants','SecurityFcy','ProgressBarFcy','EpisodeFcy','ProgramFcy','$filter','$scope','deviceDetector','ChannelFcy','FavoriteListSrv','$timeout','Configs'];
- ProgramCtrl.$inject = ['GeneralInit','$rootScope','ProgramSrv','Messages','$routeParams','SiteConstants','SecurityFcy','ProgressBarFcy','ProgramFcy','$scope','ChannelFcy','$timeout'];
- GeneralCtrl.$inject = ['$rootScope','EpisodeSrv','$location','$anchorScroll','deviceDetector','GeneralInit','UserSrv','Messages','$timeout','SearchFcy','VasFcy','$window'];
- RegisterCtrl.$inject = ['GeneralInit','UserSrv','Messages','$rootScope','SiteConstants','ProgressBarFcy'];
- LoginCtrl.$inject = ['GeneralInit','UserSrv','Messages','$window','$rootScope','SiteConstants','ProgressBarFcy','$auth','toastr','$scope','$location'];
- LiveCtrl.$inject = ['GeneralInit','ChannelSrv','$routeParams','$rootScope','deviceDetector','ProgressBarFcy','ChannelFcy','EpisodeFcy','Configs','$scope','$timeout','SecurityFcy','HourlyArchiveFcy'];
- ChannelArchiveCtrl.$inject = ['GeneralInit','ChannelSrv','$routeParams','$rootScope','deviceDetector','ProgressBarFcy','ChannelFcy','EpisodeFcy','Configs','$scope','$timeout','SecurityFcy','$location','$route'];
- ChannelArchiveOldCtrl.$inject = ['$window','GeneralInit','ChannelSrv','$routeParams','$rootScope','deviceDetector','ProgressBarFcy','ChannelFcy','EpisodeFcy','Configs','$scope','$timeout','SecurityFcy','$location','$route'];
- CategoryCtrl.$inject = ['GeneralInit','EpisodeFcy','$routeParams','$rootScope','SiteConstants','ProgressBarFcy'];
- SearchCtrl.$inject= ['GeneralInit','$routeParams','SearchFcy','$rootScope','SiteConstants','ProgressBarFcy'];
- ChannelsCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','ChannelFcy'];
- DmcaCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy'];
- TagsCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy','$timeout'];
- MoviesCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy','$timeout'];
- EuropeLeaguesCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy'];
- KidsCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy','$timeout'];
- ShademanehCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy'];
- OlympicsCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy'];
- MainAdminCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy','UserSrv','SecurityFcy','$window'];
- SeriesCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy','$timeout'];
- ArchiveCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','ChannelFcy','EpisodeFcy','$routeParams'];
- JobOpportunityCtrl.$inject= ['$rootScope','SiteConstants','ProgressBarFcy'];
- profileCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy'];
- fourOfourCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','EpisodeFcy'];
- paymentConfirmationCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy'];
- TermsCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy'];
- PartnerCtrl.$inject= ['$rootScope','SiteConstants','ProgressBarFcy'];
- ChangeLogCtrl.$inject= ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy'];
- config.$inject = ['$routeProvider','CacheFactoryProvider','$locationProvider','$authProvider','googleGrecaptchaProvider'];
- Runtime.$inject = ['$http','$location', '$rootScope', '$window','CacheFactory','ProgressBarFcy','$templateCache','UserSrv'];
- VerifyRegistrationCtrl.$inject = ['$rootScope','GeneralInit','UserSrv','Messages','SiteConstants','ProgressBarFcy','$routeParams','$scope'];
- oauthLoginCtrl.$inject = ['$routeParams','SecurityFcy','Messages','$window','ProgressBarFcy'];
- ForgotPasswordCtrl.$inject = ['GeneralInit','UserSrv','Messages','$rootScope','SiteConstants','ProgressBarFcy','$scope'];
- ResetPasswordCtrl.$inject = ['GeneralInit','UserSrv','Messages','$rootScope','SiteConstants','ProgressBarFcy','$routeParams'];
- ResendActivationEmailCtrl.$inject = ['$rootScope','GeneralInit','UserSrv','Messages','SiteConstants','ProgressBarFcy','$routeParams'];
- EditEpisodeCtrl.$inject = ['GeneralInit','UserSrv','$rootScope','SiteConstants','ProgressBarFcy','EpisodeSrv','$routeParams','$window','$http','SecurityFcy','ArtistFcy','TagFcy','FavoriteListFcy','Configs','ProgramFcy'];
- EditUserCtrl.$inject = ['GeneralInit','UserSrv','UserFcy','$rootScope','SiteConstants','ProgressBarFcy','$routeParams','$window','$http','SecurityFcy','Configs'];
- AddEpisodeCtrl.$inject = ['GeneralInit','UserSrv','$rootScope','SiteConstants','ProgressBarFcy','EpisodeSrv','$routeParams','$window','$http','SecurityFcy','ArtistFcy','TagFcy','FavoriteListFcy','Configs','ProgramFcy'];
- ListAdsCtrl.$inject = ['$rootScope','AdsFcy','AdsSrv','ProgressBarFcy','SecurityFcy','UserSrv'];
- AddAdsCtrl.$inject = ['$rootScope','AdsSrv','ProgressBarFcy','SecurityFcy','UserSrv','$window'];
- PromotionsListCtrl.$inject = ['$rootScope','AdsSrv','ProgressBarFcy','SecurityFcy','UserSrv','$window','PromotionFcy','PromotionsSrv'];
- PromotionsAddCtrl.$inject = ['$rootScope','AdsSrv','ProgressBarFcy','SecurityFcy','UserSrv','$window','PromotionFcy','PromotionsSrv'];
- PromotionsEditCtrl.$inject = ['$rootScope','AdsSrv','ProgressBarFcy','SecurityFcy','UserSrv','$window','PromotionFcy','$routeParams','PromotionsSrv'];
- AdsBankListCtrl.$inject = ['$rootScope','AdsFcy','AdsSrv','ProgressBarFcy','SecurityFcy','UserSrv','AdBankFcy','$window','AdBankSrv'];
- AdsBankEditCtrl.$inject = ['$rootScope','AdsFcy','AdsSrv','ProgressBarFcy','SecurityFcy','UserSrv','AdBankFcy','AdBankSrv','$routeParams','$window'];
- AdsBankAddCtrl.$inject = ['$rootScope','AdsSrv','ProgressBarFcy','SecurityFcy','UserSrv','$window','AdBankFcy','AdBankSrv'];
- EditAdsCtrl.$inject = ['$rootScope','AdsSrv','ProgressBarFcy','SecurityFcy','UserSrv','$window','$routeParams'];
- EditArtistCtrl.$inject = ['UserSrv','$rootScope','SiteConstants','ProgressBarFcy','EpisodeSrv','$routeParams','$window','ArtistSrv'];
- EditFavoriteListCtrl.$inject = ['UserSrv','$rootScope','SiteConstants','ProgressBarFcy','EpisodeSrv','$routeParams','$window','FavoriteListSrv','SecurityFcy','FavoriteListFcy','UserSrv'];
- AddArtistCtrl.$inject = ['UserSrv','$rootScope','SiteConstants','ProgressBarFcy','EpisodeSrv','$routeParams','$window','ArtistSrv'];
- AddFavoriteListCtrl.$inject = ['UserSrv','$rootScope','SiteConstants','ProgressBarFcy','EpisodeSrv','$routeParams','$window','FavoriteListSrv','SecurityFcy','FavoriteListFcy'];
- AngularFileUploader.$inject = ['$rootScope','Upload'];
- AngularFileCrop.$inject = ['$rootScope','$scope','ImageUploadFcy','SecurityFcy'];
- UnsubscribeCtrl.$inject = ['GeneralInit','$rootScope','$routeParams','ProgressBarFcy','UserSrv'];
- EditProgramCtrl.$inject = ['UserSrv','$rootScope','SiteConstants','ProgressBarFcy','ProgramSrv','$routeParams','$window','SecurityFcy','ArtistFcy','ProgramFcy'];
- AddProgramCtrl.$inject = ['UserSrv','$rootScope','SiteConstants','ProgressBarFcy','ProgramSrv','$routeParams','$window','SecurityFcy','ArtistFcy','ProgramFcy'];
- ListOfEpisodesCtrl.$inject = ['UserSrv','$rootScope','SiteConstants','ProgressBarFcy','ProgramSrv','$routeParams','$window','SecurityFcy','EpisodeFcy','EpisodeSrv','ChannelFcy','$scope'];
- ListOfProgramCtrl.$inject = ['UserSrv','$rootScope','SiteConstants','ProgressBarFcy','ProgramSrv','ProgramFcy','$window','SecurityFcy','ChannelFcy'];
- ListOfFavListCtrl.$inject = ['UserSrv','$rootScope','SiteConstants','ProgressBarFcy','ProgramSrv','$routeParams','$window','SecurityFcy','FavoriteListFcy'];
- TagsCtrl.$inject = ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy','FavoriteListFcy','$routeParams','FavoriteListSrv','$timeout'];
- TagCtrl.$inject = ['GeneralInit','$rootScope','SiteConstants','ProgressBarFcy','SliderFcy','EpisodeFcy','TagPageFcy','$routeParams','FavoriteListSrv','$timeout'];
- ListOfUserCtrl.$inject = ['GeneralInit','UserSrv','UserFcy','$rootScope','SiteConstants','ProgressBarFcy','$window','$http','SecurityFcy','Configs'];
- function Runtime($http,$location, $rootScope, $window,CacheFactory,ProgressBarFcy,$templateCache,UserSrv){
- $templateCache.put('home.html', 'This is the home template<br><br>');
- /*$http.cache=true;*/
- $rootScope.$on('$routeChangeStart', function (event, current, previous) {
- ProgressBarFcy.setStatus(0.1);
- });
- $rootScope.$on('$routeChangeSuccess', function (event, current, previous) {
- if((typeof previous !='undefined') && (previous.controller=="EpisodeCtrl" || previous.controller=="LiveCtrl") && (DeviceDetection.IsAndroid() || DeviceDetection.IsIos() || DeviceDetection.IsIpad() || DeviceDetection.IsSmartTv())){
- window.Player.dispose();
- }
- /* for Alexa */
- debuger.log("Now you are in :" + $location.path());
- if(typeof previous !='undefined'){
- $rootScope.InSiteLink = true;
- window.VodIsPlayed = false;
- }
- $rootScope.TryCount = 0;
- $rootScope.ProgramDetailTryCount = 0;
- $("html,body").scrollTop(0);
- /*$window.ga('send', 'pageview', { page: $location.path()});*/
- _atrk_opts = { atrk_acct:"qVWKl1a8FRh270", domain:"telewebion.com",dynamic: true};
- (function() { var as = document.createElement('script'); as.type = 'text/javascript'; as.async = true; as.src = "https://d31qbv1cthcecs.cloudfront.net/atrk.js"; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(as, s); })();
- window._atrk_fired = false;
- try {atrk();} catch(err) {};
- /*closeHamburgerMenu();*/
- ProgressBarFcy.plus(0.2);
- _atrk_opts = { atrk_acct:"qVWKl1a8FRh270", domain:"telewebion.com",dynamic: true};
- UserSrv.getUser().then(function(UserInfo){
- $rootScope.User=UserInfo;
- if(typeof UserInfo.user_info!='undefined'){
- $rootScope.UserStatus.IsAuthenticated=true;
- }else{
- $rootScope.UserStatus.IsAuthenticated=false;
- }
- $rootScope.$broadcast("UserData");
- });
- });
- $rootScope.$on('$viewContentLoaded', function(event) {
- $window.ga('send', 'pageview', { page: $location.path()});
- });
- $rootScope.$on('$routeChangeError', function (event, current, previous, error) {
- /*if (error.status === 404) {
- $location.path('/404');
- }*/
- });
- $http.defaults.cache = CacheFactory('defaultCache', {
- maxAge: 30 * 60 * 1000, // Items added to this cache expire after 15 minutes
- cacheFlushInterval: 60 * 60 * 1000, // This cache will clear itself every hour
- deleteOnExpire: 'aggressive' // Items will be deleted from this cache when they expire
- });
- /*$http.defaults.headers.get = { 'Coi' : 'http://m.telewebion.com/' };*/
- $http.defaults.headers.post = { 'Content-Type' : 'text/plain' };
- }
- function config($routeProvider,CacheFactoryProvider,$location,$authProvider,googleGrecaptchaProvider) {
- $location.hashPrefix('!');
- googleGrecaptchaProvider.setLanguage("fa");
- $routeProvider
- .when('/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/home.html',
- controller: 'HomeCtrl',
- controllerAs: 'hmc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- },
- HomeInit: function(HomeInit){
- return HomeInit();
- }
- }
- })
- .when('/main', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/home.html',
- controller: 'HomeCtrl',
- controllerAs: 'hmc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- },
- HomeInit: function(HomeInit){
- return HomeInit();
- }
- }
- })
- .when('/fa', {
- redirectTo: '/'
- })
- .when('/en', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/en/home.html',
- controller: 'HomeCtrl',
- controllerAs: 'hmc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- },
- HomeInit: function(HomeInit){
- return HomeInit();
- }
- }
- })
- .when('/register', {
- redirectTo: '/login'
- })
- .when('/fa/register', {
- redirectTo: '/login'
- })
- .when('/en/register', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/en/register.html',
- controller: 'RegisterCtrl',
- controllerAs: 'urg',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/login', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/register.html',
- controller: 'LoginCtrl',
- controllerAs: 'urg',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/channels', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/channels.html',
- controller: 'ChannelsCtrl',
- controllerAs: 'clc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/login', {
- redirectTo: '/login'
- })
- .when('/fa/channels', {
- redirectTo: '/channels'
- })
- .when('/en/login', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/en/login.html',
- controller: 'LoginCtrl',
- controllerAs: 'uln',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/partners/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/partners.html',
- controller: 'PartnerCtrl',
- controllerAs: 'ptn',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/partners/', {
- redirectTo: '/partners/'
- })
- .when('/forgotpassword', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/forgot_password.html',
- controller: 'ForgotPasswordCtrl',
- controllerAs: 'frp',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/forgotpassword', {
- redirectTo: '/forgotpassword'
- })
- .when('/en/forgotpassword', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/en/forgot_password.html',
- controller: 'ForgotPasswordCtrl',
- controllerAs: 'frp',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/program/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/program.html',
- controller: 'ProgramCtrl',
- controllerAs: 'pgc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/program/:Id/', {
- redirectTo: '/program/:Id/'
- })
- .when('/en/program/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/en/program.html',
- controller: 'ProgramCtrl',
- controllerAs: 'pgc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/episode/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/episode.html',
- controller: 'EpisodeCtrl',
- controllerAs: 'epc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/episode/episode/:Id/', {
- redirectTo: '/episode/:Id/'
- })
- .when('/fa/episode/:Id/', {
- redirectTo: '/episode/:Id/'
- })
- .when('/en/episode/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/en/episode.html',
- controller: 'EpisodeCtrl',
- controllerAs: 'epc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/live/:Id/', {
- redirectTo: '/live/:Id/'
- })
- .when('/live/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/live.html',
- controller: 'LiveCtrl',
- controllerAs: 'lic',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/archive/:Id', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/channel_archive_old.html',
- controller: 'ChannelArchiveOldCtrl',
- controllerAs: 'coc',
- reloadOnSearch: false,
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/archive/:Id/:date', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/channel_archive.html',
- controller: 'ChannelArchiveCtrl',
- controllerAs: 'cac',
- reloadOnSearch: false,
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/category/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/category.html',
- controller: 'CategoryCtrl',
- controllerAs: 'ctc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/rio2016', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/olympics.html',
- controller: 'OlympicsCtrl',
- controllerAs: 'orc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/category/:Id/', {
- redirectTo: '/category/:Id/'
- })
- .when('/en/category/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/category.html',
- controller: 'CategoryCtrl',
- controllerAs: 'ctc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/en/live/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/en/live.html',
- controller: 'LiveCtrl',
- controllerAs: 'lic',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/en/search/:SearchContext', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/en/search.html',
- controller: 'SearchCtrl',
- controllerAs: 'src',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/search/:SearchContext', {
- redirectTo: '/search/:Id/'
- })
- .when('/search/:SearchContext', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/search.html',
- controller: 'SearchCtrl',
- controllerAs: 'src',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/test/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/test.html',
- controller: 'TestCtrl',
- controllerAs: 'tst',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/archive_old/:Id/', {
- templateUrl: '/rstatic/ntwv65/nginxcache/template/fa/archive.html',
- controller: 'ArchiveCtrl',
- controllerAs: 'arc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/archive/:Id/', {
- redirectTo: '/archive/:Id/'
- })
- .when('/dmca/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/changeLog2.html',
- controller: 'DmcaCtrl',
- controllerAs: 'dmc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/dmca/', {
- redirectTo: '/dmca/'
- })
- .when('/ResetPassword/:token', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/reset_password.html',
- controller: 'ResetPasswordCtrl',
- controllerAs: 'rpc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/ResetPassword/:token', {
- redirectTo: '/ResetPassword/:token'
- })
- .when('/terms/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/TermsOfServices.html',
- controller: 'TermsCtrl',
- controllerAs: 'tcc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/terms/', {
- redirectTo: '/terms/'
- })
- .when('/changeLog/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/changeLog.html',
- controller: 'ChangeLogCtrl',
- controllerAs: 'clc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/changeLog/', {
- redirectTo: '/changeLog/'
- })
- .when('/jobs/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/job_opportunity.html',
- controller: 'JobOpportunityCtrl',
- controllerAs: 'joc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/jobOpportunity/', {
- redirectTo: '/jobOpportunity/'
- })
- .when('/fa/VerifyRegistration/:VCode/:HMail/:Username', {
- redirectTo: '/VerifyRegistration/:VCode/:HMail/:Username'
- })
- .when('/VerifyRegistration/:VCode/:HMail/:Username', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/verify_registration.html',
- controller: 'VerifyRegistrationCtrl',
- controllerAs: 'vrc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/fa/ResendActivationEmail/', {
- redirectTo: '/ResendActivationEmailCtrl'
- })
- .when('/404', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/404.html',
- controller: 'fourOfourCtrl',
- controllerAs: 'foc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/profile', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/profile.html',
- controller: 'profileCtrl',
- controllerAs: 'prc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/paymentConfirmation', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/paymentConfirmation.html',
- controller: 'paymentConfirmationCtrl',
- controllerAs: 'pmc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/oauthLogin/:token', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/oauthLogin.html',
- controller: 'oauthLoginCtrl',
- controllerAs: 'oac',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/episode/edit/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/episode_edit.html',
- controller: 'EditEpisodeCtrl',
- controllerAs: 'eec',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/user/edit/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/user_edit.html',
- controller: 'EditUserCtrl',
- controllerAs: 'euc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/users/list/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/user_list.html',
- controller: 'ListOfUserCtrl',
- controllerAs: 'luc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/episode/add/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/episode_add.html',
- controller: 'AddEpisodeCtrl',
- controllerAs: 'aec',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/artist/edit/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/artist_edit.html',
- controller: 'EditArtistCtrl',
- controllerAs: 'aec',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/artist/add/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/artist_add.html',
- controller: 'AddArtistCtrl',
- controllerAs: 'aac',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/favoritelist/edit/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/favlist_edit.html',
- controller: 'EditFavoriteListCtrl',
- controllerAs: 'fec',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/favoritelist/add/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/favlist_add.html',
- controller: 'AddFavoriteListCtrl',
- controllerAs: 'fac',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/program/edit/:Id/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/program_edit.html',
- controller: 'EditProgramCtrl',
- controllerAs: 'epc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/program/add/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/program_add.html',
- controller: 'AddProgramCtrl',
- controllerAs: 'apc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/episode/list/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/episode_list.html',
- controller: 'ListOfEpisodesCtrl',
- controllerAs: 'lec',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/program/list/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/program_list.html',
- controller: 'ListOfProgramCtrl',
- controllerAs: 'lpc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/favoritelist/list/:Id?', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/favlist_list.html',
- controller: 'ListOfFavListCtrl',
- controllerAs: 'flc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/ads/add', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/ads_add.html',
- controller: 'AddAdsCtrl',
- controllerAs: 'adc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/promotions/list', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/promotion_list.html',
- controller: 'PromotionsListCtrl',
- controllerAs: 'plc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/promotions/add', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/promotion_add.html',
- controller: 'PromotionsAddCtrl',
- controllerAs: 'pac',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/promotions/edit/:Id', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/promotion_edit.html',
- controller: 'PromotionsEditCtrl',
- controllerAs: 'pec',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/ads/edit/:Id', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/ads_edit.html',
- controller: 'EditAdsCtrl',
- controllerAs: 'edc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/ads/list', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/ads_list.html',
- controller: 'ListAdsCtrl',
- controllerAs: 'lac',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/ramezan95/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/ramezan_95.html',
- controller: 'Ramezan95Ctrl',
- controllerAs: 'rmc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/premierleague95-96/', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/ligebartar.html',
- controller: 'LigeBartarCtrl',
- controllerAs: 'lbc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/tags/:Id', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/tags.html',
- controller: 'TagsCtrl',
- controllerAs: 'tgc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/tag/:name', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/tag.html',
- controller: 'TagCtrl',
- controllerAs: 'tac',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/movies', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/movies.html',
- controller: 'MoviesCtrl',
- controllerAs: 'mic',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/europeleagues', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/europeleagues.html',
- controller: 'EuropeLeaguesCtrl',
- controllerAs: 'elc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/kids', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/kids.html',
- controller: 'KidsCtrl',
- controllerAs: 'kdc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/shademaneh', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/shademaneh.html',
- controller: 'ShademanehCtrl',
- controllerAs: 'smc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/actions', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/admin_actions.html',
- controller: 'MainAdminCtrl',
- controllerAs: 'mac',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/series', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/series.html',
- controller: 'SeriesCtrl',
- controllerAs: 'sic',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/user/unsubscribe/:email', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/unsubscribe.html',
- controller: 'UnsubscribeCtrl',
- controllerAs: 'usc',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/adsbank/list', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/adsbank_list.html',
- controller: 'AdsBankListCtrl',
- controllerAs: 'abl',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/adsbank/edit/:Id', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/adsbank_edit.html',
- controller: 'AdsBankEditCtrl',
- controllerAs: 'abe',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .when('/admin/adsbank/add', {
- templateUrl: '/rstatic/ntwv114/nginxcache/template/fa/adsbank_add.html',
- controller: 'AdsBankAddCtrl',
- controllerAs: 'aba',
- resolve: {
- GeneralInit: function(GeneralInit){
- return GeneralInit();
- }}
- })
- .otherwise({
- redirectTo: '/404'
- });
- angular.extend(CacheFactoryProvider.defaults, { maxAge: 15 * 60 * 1000 });
- /*$httpProvider.defaults.cache = $cacheFactory('myCache', {capacity: 20});*/
- $authProvider.facebook({
- clientId: '174996829299681'
- })
- $authProvider.google({
- clientId: '614244115512-lqkipime9i6gohctrbk64i2fu653scpv.apps.googleusercontent.com',
- redirectUri: 'http://www.telewebion.com/op/user/verifyOauth'
- });
- }
- function HomeCtrl(GeneralInit,EpisodeFcy,ChannelFcy,HomeInit,$rootScope,SiteConstants,ProgressBarFcy,$scope,ProgramFcy,$location,Messages,$window,$timeout){
- var hmc= this;
- TopCarousel.initCarousel();
- $(document).on("click",".top-carousel-single-item",function () {
- if(TW.flagForGA) {
- TW.flagForGA = false;
- $window.ga('send', 'event', 'click', 'Above the fold', $(this).find(".top-description-carousel").html());
- $timeout(function () {
- TW.flagForGA = true;
- },3000);
- }
- })
- window.HomeOurRecommendationsTotal=0;
- window.HomeNewestTotal=0;
- window.HomeMoviesTotal=0;
- window.HomeUserRecommendationsTotal=0;
- window.HomeTvShowsTotal=0;
- window.HomeKidsTotal=0;
- window.HomeCustom1Total=0;
- window.HomeOlympicsTotal=0;
- window.HomeChannelsTotal=0;
- var OurRecommendationsScrollBar='';
- $rootScope.User=GeneralInit.User;
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.HomePage;
- $rootScope.Page.Culture=GeneralInit.Culture;
- $rootScope.$broadcast("UserData");
- hmc.Sliders=HomeInit.Sliders;
- $rootScope.Page.Description=SiteConstants.Fa.Description.HomePage;
- $rootScope.Page.Keywords=SiteConstants.Fa.Keywords.HomePage;
- $rootScope.Sliders=hmc.Sliders;
- $(".position-fix-carousel").scroll(function () {
- $(document).scroll()
- })
- $(document).on("click",".slick-next,.slick-prev",function () {
- $(document).scroll()
- setTimeout(function () {
- $(document).scroll()
- },600)
- })
- $timeout(function () {
- $(".ramezan-banners").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },1000)
- hmc.MovieData={Offset:0,Limit:15,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- hmc.OurRecommendationData={Offset:0,Limit:18,UpdateInProgress:true,Episodes:[],Page:0};
- hmc.TvShowData={Offset:0,Limit:15,UpdateInProgress:true,Episodes:[],Page:0};
- hmc.UserRecommendationData={Offset:0,Limit:19,UpdateInProgress:true,Episodes:[],Page:0};
- hmc.KidData={Offset:0,Limit:19,UpdateInProgress:true,Episodes:[],Page:0};
- hmc.NewestData={Offset:0,Limit:19,UpdateInProgress:true,Episodes:[],Page:0};
- hmc.ChannelData={Offset:0,Limit:40,UpdateInProgress:true,Channels:[],Page:1,MaximumPage:0};
- hmc.Custom1={Offset:0,Limit:19,UpdateInProgress:true,Channels:[],Page:0,MaximumPage:0};
- hmc.Olympics={Offset:0,Limit:19,UpdateInProgress:true,Channels:[],Page:0,MaximumPage:0};
- hmc.EuropeLeagues={Offset:0,Limit:19,UpdateInProgress:true,Channels:[],Page:0,MaximumPage:0};
- hmc.Moharram={Offset:0,Limit:19,UpdateInProgress:true,Channels:[],Page:0,MaximumPage:0};
- hmc.CurrentAffair={Offset:0,Limit:30,UpdateInProgress:true,Channels:[],Page:0,MaximumPage:0};
- $timeout(function () {
- $(".carousel-image-container img").each(function () {
- $(this).error(function () {
- if(!$(this).attr("data-replaced"))
- replacePipelineAddress.replace($(this));
- })
- })
- },600);
- hmc.getCustom1=function(){
- EpisodeFcy.getCustom('400390',hmc.Custom1.Offset,hmc.Custom1.Limit).then(function(CustomEpisodes){
- hmc.Custom1.Page++;
- //loaded("OurRecommendations");
- if(hmc.Custom1.Page==1){
- TwoRowsCarousel.CarouselInit("special-content");
- }
- $timeout(function () {
- $("#special-content").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },200)
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(hmc.Custom1.Episodes);
- window.HomeCustom1=CustomEpisodes.length;
- window.HomeCustom1Total+=parseInt(window.HomeCustom1);
- hmc.Custom1.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.Custom1.UpdateInProgress=false;
- if(hmc.Custom1.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- hmc.getMoharram=function(){
- EpisodeFcy.getCustom('404847',hmc.Moharram.Offset,hmc.Moharram.Limit).then(function(CustomEpisodes){
- hmc.Moharram.Page++;
- //loaded("OurRecommendations");
- if(hmc.Moharram.Page==1){
- TwoRowsCarousel.CarouselInit("special-content");
- }
- $timeout(function () {
- $("#special-content").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },200)
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(hmc.Moharram.Episodes);
- window.HomeMoharram=CustomEpisodes.length;
- window.HomeMoharramTotal+=parseInt(window.HomeMoharram);
- hmc.Moharram.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.Moharram.UpdateInProgress=false;
- if(hmc.Moharram.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- hmc.getEuropeLeagues=function(){
- EpisodeFcy.getCustom('404815',hmc.EuropeLeagues.Offset,hmc.EuropeLeagues.Limit).then(function(CustomEpisodes){
- hmc.EuropeLeagues.Page++;
- //loaded("OurRecommendations");
- if(hmc.EuropeLeagues.Page==1){
- TwoRowsCarousel.CarouselInit("europeleagues");
- }
- $timeout(function () {
- $("#europeleagues").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },200)
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(hmc.EuropeLeagues.Episodes);
- window.HomeEuropeLeagues=CustomEpisodes.length;
- window.EuropeLeaguesTotal+=parseInt(window.HomeEuropeLeagues);
- hmc.EuropeLeagues.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.EuropeLeagues.UpdateInProgress=false;
- if(hmc.EuropeLeagues.Page==1){
- }
- });
- }
- hmc.getOlympics=function(){
- EpisodeFcy.getCustom('402047',hmc.Olympics.Offset,hmc.Olympics.Limit).then(function(CustomEpisodes){
- hmc.Olympics.Page++;
- //loaded("OurRecommendations");
- if(hmc.Olympics.Page==1){1
- TwoRowsCarousel.CarouselInit("olympics-carousel");
- }
- $timeout(function () {
- $("#olympics-content").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },200)
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(hmc.Olympics.Episodes);
- window.HomeOlympics=CustomEpisodes.length;
- window.HomeOlympicsTotal+=parseInt(window.HomeOlympics);
- hmc.Olympics.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.Olympics.UpdateInProgress=false;
- });
- }
- hmc.getCurrentAffair=function(){
- EpisodeFcy.getCustom('397931',hmc.CurrentAffair.Offset,hmc.CurrentAffair.Limit).then(function(CustomEpisodes){
- hmc.CurrentAffair.Page++;
- //loaded("OurRecommendations");
- if(hmc.CurrentAffair.Page>=1){
- //TwoRowsCarousel.CarouselInit("special-content");
- // TwoRowsCarousel.CarouselInit("special-news");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(hmc.CurrentAffair.Episodes);
- window.HomeCurrentAffair1=CustomEpisodes.length;
- window.HomeCurrentAffair1Total+=parseInt(window.HomeCurrentAffair1);
- hmc.CurrentAffair.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.CurrentAffair.UpdateInProgress=false;
- if(hmc.CurrentAffair.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- hmc.getOurRecommendations=function(){
- EpisodeFcy.getOurRecommendations(hmc.OurRecommendationData.Offset,hmc.OurRecommendationData.Limit).then(function(OurRecommendations){
- hmc.OurRecommendationData.Page++;
- //loaded("OurRecommendations");
- if(hmc.OurRecommendationData.Page==1){
- TwoRowsCarousel.CarouselInit("OurRecommendation");
- }
- $timeout(function () {
- $("#OurRecommendation").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },200)
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(OurRecommendations);
- tempArray2.push(hmc.OurRecommendationData.Episodes);
- window.HomeOurRecommendations=OurRecommendations.length;
- window.HomeOurRecommendationsTotal+=parseInt(window.HomeOurRecommendations);
- //resizeTrigger("OurRecommendations",window.HomeOurRecommendationsTotal);
- hmc.OurRecommendationData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.OurRecommendationData.UpdateInProgress=false;
- if(hmc.OurRecommendationData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- var variant = cxApi.chooseVariation();
- // var variant = 123;
- $rootScope.newestToShow = true;
- // if($window.location.href.indexOf("main") >=0){
- // $rootScope.newestToShow = false;
- // }
- // if(variant != 0 && $window.location.href.indexOf("main") < 0){
- //
- // setTimeout(function () {
- // window.location.href = "/main";
- // window.variant = 'v'+variant;
- // },1000)
- // }
- if($rootScope.newestToShow == true) {
- hmc.getNewest = function () {
- EpisodeFcy.getNewestEpisodes(hmc.NewestData.Offset, hmc.NewestData.Limit).then(function (Newest) {
- hmc.NewestData.Page++;
- //if(hmc.NewestData.Page==1){
- //loaded("Newest");
- if (hmc.NewestData.Page == 1) {
- TwoRowsCarousel.CarouselInit("Newest");
- }
- $timeout(function () {
- $("#Newest").find("img.lazyload").lazyload({
- threshold: 150,
- effect: "fadeIn",
- });
- }, 200)
- //}
- var tempArray = [];
- var tempArray2 = [];
- window.HomeNewest = Newest.length;
- window.HomeNewestTotal += parseInt(window.HomeNewest);
- tempArray.push(Newest);
- tempArray2.push(hmc.NewestData.Episodes);
- hmc.NewestData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.NewestData.UpdateInProgress = false;
- if (hmc.NewestData.Page == 1) {
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- }
- hmc.getChannels=function(){
- ChannelFcy.getChannels().then(function(Channels){
- /*var tempChannelList=[];*/
- //loaded("LiveChannels");
- if(hmc.ChannelData.Page==1){
- LiveChannelsCarousel.CarouselInit("LiveChannels");
- }
- $timeout(function () {
- $("#LiveChannels").find(".lazyload").lazyload({
- threshold : 150,
- effect:"fadeIn"
- });
- },200)
- window.HomeChannels=Channels.length;
- window.HomeChannelsTotal+=parseInt(window.HomeChannels);
- hmc.ChannelData.Channels=Channels;
- hmc.ChannelData.MaximumPage=Math.ceil(Channels.length/hmc.ChannelData.Limit);
- /*for (var i=1;i<=Channels.length;i++){
- tempChannelList.push(Channels[i-1]);
- if(i%hmc.ChannelData.Limit==0)
- {
- hmc.ChannelData.Channels.push(tempChannelList);
- tempChannelList=[];
- }
- else if(i==Channels.length)
- {
- hmc.ChannelData.Channels.push(tempChannelList);
- }
- }*/
- hmc.ChannelData.UpdateInProgress=false;
- ProgressBarFcy.plus(0.1);
- $rootScope.ChannelData=hmc.ChannelData;
- $rootScope.$broadcast("UserData");
- });
- }
- hmc.getMovies=function(){
- EpisodeFcy.getMovies(hmc.MovieData.Offset,hmc.MovieData.Limit).then(function(Movies){
- hmc.MovieData.Page++;
- //if(hmc.MovieData.Page==1){
- //loaded("Movies");
- if(hmc.MovieData.Page==1){
- OneRowCarousel.CarouselInit("Movies");
- }
- //}
- $timeout(function () {
- $("#Movies").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },200)
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(Movies);
- window.HomeMovies=Movies.length;
- window.HomeMoviesTotal+=parseInt(window.HomeMovies);
- tempArray2.push(hmc.MovieData.Episodes);
- hmc.MovieData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.MovieData.UpdateInProgress=false;
- if(hmc.MovieData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- hmc.getUserRecommendations=function(){
- EpisodeFcy.getUserRecommendations(hmc.UserRecommendationData.Offset,hmc.UserRecommendationData.Limit).then(function(UserRecommendations){
- hmc.UserRecommendationData.Page++;
- //if(hmc.UserRecommendationData.Page==1){
- //loaded("UserRecommendations");
- $timeout(function () {
- $("#UsersRecommendation").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },200)
- if(hmc.OurRecommendationData.Page>=1){
- TwoRowsCarousel.CarouselInit("UsersRecommendation");
- setTimeout(function () {
- TwoRowsCarousel.CarouselInit("UsersRecommendation");
- },1000);
- $timeout(function () {
- replaceBigThumbs.replace();
- },800)
- }
- //}
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(UserRecommendations);
- tempArray2.push(hmc.UserRecommendationData.Episodes);
- window.HomeUserRecommendations=UserRecommendations.length;
- window.HomeUserRecommendationsTotal+=parseInt(window.HomeUserRecommendations);
- hmc.UserRecommendationData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.UserRecommendationData.UpdateInProgress=false;
- if(hmc.UserRecommendationData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- hmc.getTvShows=function(){
- ProgramFcy.getTvShows(hmc.TvShowData.Offset,hmc.TvShowData.Limit).then(function(TvShows){
- hmc.TvShowData.Page++;
- //if(hmc.TvShowData.Page==1){
- //loaded("TvSeries");
- if(hmc.TvShowData.Page==1){
- OneRowCarousel.CarouselInit("Series");
- }
- $timeout(function () {
- $("#Series").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },200)
- //}
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(TvShows);
- tempArray2.push(hmc.TvShowData.Episodes);
- window.HomeTvShows=TvShows.length;
- window.HomeTvShowsTotal+=parseInt(window.HomeTvShows);
- hmc.TvShowData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.TvShowData.UpdateInProgress=false;
- if(hmc.TvShowData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- hmc.getKids=function(){
- ProgramFcy.getKids(hmc.KidData.Offset,hmc.KidData.Limit).then(function(Kids){
- hmc.KidData.Page++;
- //if(hmc.KidData.Page==1){
- //loaded("Kids");
- if(hmc.KidData.Page==1){
- TwoRowsCarousel.CarouselInit("Kids");
- }
- $timeout(function () {
- $("#Kids").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },200)
- //}
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(Kids);
- tempArray2.push(hmc.KidData.Episodes);
- window.HomeKids=Kids.length;
- window.HomeKidsTotal+=parseInt(window.HomeKids);
- hmc.KidData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- hmc.KidData.UpdateInProgress=false;
- if(hmc.KidData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- hmc.getNext=function(type){
- if(type=='Movie'){
- hmc.MovieData.Limit=((hmc.MovieData.Page+1)==1)?50:50;
- hmc.MovieData.Offset=((hmc.MovieData.Page+1)==1)?0:((hmc.MovieData.Page+1)*50)+50;
- hmc.MovieData.UpdateInProgress=true;
- hmc.getMovies();
- /*if((hmc.MovieData.Page+1)>0 && typeof hmc.MovieData.Episodes[hmc.MovieData.Page] == 'undefined'){
- hmc.MovieData.UpdateInProgress=true;
- hmc.getMovies();
- }
- else{
- hmc.MovieData.Page++;
- }*/
- }
- else if(type=='OurRecommendation'){
- hmc.OurRecommendationData.Limit=((hmc.OurRecommendationData.Page+1)==1)?50:50;
- hmc.OurRecommendationData.Offset=((hmc.OurRecommendationData.Page+1)==1)?0:((hmc.OurRecommendationData.Page+1)*50)+50;
- hmc.OurRecommendationData.UpdateInProgress=true;
- hmc.getOurRecommendations();
- /*if(typeof hmc.OurRecommendationData.Episodes[hmc.OurRecommendationData.Page] == 'undefined'){
- hmc.OurRecommendationData.UpdateInProgress=true;
- }
- else{
- hmc.OurRecommendationData.Page++;
- }*/
- }
- else if(type=='UserRecommendations'){
- hmc.UserRecommendationData.Limit=((hmc.UserRecommendationData.Page+1)==1)?50:50;
- hmc.UserRecommendationData.Offset=((hmc.UserRecommendationData.Page+1)==1)?0:((hmc.UserRecommendationData.Page+1)*50)+50;
- hmc.UserRecommendationData.UpdateInProgress=true;
- hmc.getUserRecommendations();
- /*if(hmc.UserRecommendationData.Page+1>0 && typeof hmc.UserRecommendationData.Episodes[hmc.UserRecommendationData.Page] == 'undefined'){
- hmc.UserRecommendationData.UpdateInProgress=true;
- hmc.getUserRecommendations();
- }
- else{
- hmc.UserRecommendationData.Page++;
- }*/
- }
- else if(type=='TvShows'){
- hmc.TvShowData.Limit=((hmc.TvShowData.Page+1)==1)?50:50;
- hmc.TvShowData.Offset=((hmc.TvShowData.Page+1)==1)?0:((hmc.TvShowData.Page+1)*50)+50;
- hmc.TvShowData.UpdateInProgress=true;
- hmc.getTvShows();
- /*if(hmc.TvShowData.Page+1>0 && typeof hmc.TvShowData.Episodes[hmc.TvShowData.Page] == 'undefined'){
- hmc.TvShowData.UpdateInProgress=true;
- hmc.getTvShows();
- }
- else{
- hmc.TvShowData.Page++;
- }*/
- }
- else if(type=='Kids'){
- hmc.KidData.Limit=((hmc.KidData.Page+1)==1)?50:50;
- hmc.KidData.Offset=((hmc.KidData.Page+1)==1)?0:((hmc.KidData.Page+1)*50)+50;
- hmc.KidData.UpdateInProgress=true;
- hmc.getKids();
- /* if(hmc.KidData.Page+1>0 && typeof hmc.KidData.Episodes[hmc.KidData.Page] == 'undefined'){
- hmc.KidData.UpdateInProgress=true;
- hmc.getKids();
- }
- else{*/
- //}
- }
- else if(type=='Channels'){
- hmc.ChannelData.Page++;
- hmc.ChannelData.Limit=(hmc.ChannelData.Page==1)?10:10;
- hmc.ChannelData.Offset=(hmc.ChannelData.Page==1)?0:(hmc.ChannelData.Page*10)+10;
- if(hmc.ChannelData.Page>0 && typeof hmc.ChannelData.Channels[hmc.ChannelData.Page-1] == 'undefined'){
- hmc.ChannelData.UpdateInProgress=true;
- }
- }
- else if(type=='Newest'){
- hmc.NewestData.Limit=((hmc.NewestData.Page+1)==1)?50:50;
- hmc.NewestData.Offset=((hmc.NewestData.Page+1)==1)?0:((hmc.NewestData.Page+1)*50)+50;
- hmc.NewestData.UpdateInProgress=true;
- hmc.getNewest();
- /* if(hmc.KidData.Page+1>0 && typeof hmc.KidData.Episodes[hmc.KidData.Page] == 'undefined'){
- hmc.KidData.UpdateInProgress=true;
- hmc.getKids();
- }
- else{*/
- /*hmc.NewestData.Page++;*/
- }
- }
- window.getNextHome=hmc.getNext;
- hmc.getPrevious=function(type){
- if(type=='Movie'){
- hmc.MovieData.Page>1?--hmc.MovieData.Page:hmc.MovieData.Page;
- hmc.MovieData.Limit=(hmc.MovieData.Page==1)?5:8;
- hmc.MovieData.Offset=(hmc.MovieData.Page==1)?0:(hmc.MovieData.Page*8)+5;
- }
- else if(type=='OurRecommendation'){
- hmc.OurRecommendationData.Page>1?--hmc.OurRecommendationData.Page:hmc.OurRecommendationData.Page;
- hmc.OurRecommendationData.Limit=(hmc.OurRecommendationData.Page==1)?5:8;
- hmc.OurRecommendationData.Offset=(hmc.OurRecommendationData.Page==1)?0:(hmc.OurRecommendationData.Page*8)+5;
- }
- else if(type=='UserRecommendations'){
- hmc.UserRecommendationData.Page>1?--hmc.UserRecommendationData.Page:hmc.UserRecommendationData.Page;
- hmc.UserRecommendationData.Limit=(hmc.UserRecommendationData.Page==1)?5:8;
- hmc.UserRecommendationData.Offset=(hmc.UserRecommendationData.Page==1)?0:(hmc.UserRecommendationData.Page*8)+5;
- }
- else if(type=='TvShows'){
- hmc.TvShowData.Page>1?--hmc.TvShowData.Page:hmc.TvShowData.Page;
- hmc.TvShowData.Limit=(hmc.TvShowData.Page==1)?5:8;
- hmc.TvShowData.Offset=(hmc.TvShowData.Page==1)?0:(hmc.TvShowData.Page*8)+5;
- }
- else if(type=='Kids'){
- hmc.KidData.Page>1?--hmc.KidData.Page:hmc.KidData.Page;
- hmc.KidData.Limit=(hmc.KidData.Page==1)?5:8;
- hmc.KidData.Offset=(hmc.KidData.Page==1)?0:(hmc.KidData.Page*8)+5;
- }
- else if(type=='Channels'){
- hmc.ChannelData.Page>1?--hmc.ChannelData.Page:hmc.ChannelData.Page;
- hmc.ChannelData.Limit=(hmc.ChannelData.Page==1)?8:8;
- hmc.ChannelData.Offset=(hmc.ChannelData.Page==1)?0:(hmc.ChannelData.Page*8)+hmc.ChannelData.Limit;
- }
- }
- hmc.getChannels();
- hmc.getOurRecommendations();
- hmc.getMovies();
- hmc.getUserRecommendations();
- hmc.getTvShows();
- hmc.getKids();
- if($rootScope.newestToShow == true) {
- hmc.getNewest();
- }
- hmc.getCustom1();
- // hmc.getMoharram();
- // hmc.getOlympics();
- hmc.getEuropeLeagues();
- /*hmc.getCurrentAffair();*/
- if(typeof $location.search()['ls']!=='undefined' && $location.search()['ls']=='su'){
- NgNote.Success(Messages.Fa.LoginSuccessful,3);
- $window.location.replace("/#!/");
- }
- }
- function GeneralCtrl($rootScope,EpisodeSrv,$location,$anchorScroll,deviceDetector,GeneralInit,UserSrv,Messages,$timeout,SearchFcy,VasFcy,$window) {
- $rootScope.Page = {};
- /*$rootScope.User={};*/
- $rootScope.Sliders = {};
- $rootScope.UserStatus = {IsAuthenticated: false};
- $rootScope.ChannelData = {};
- $rootScope.DoSearch = function () {
- window.location.href = '/#!/search/' + $rootScope.Page.SearchContext;
- };
- UserSrv.getUser().then(function(UserInfo){
- $rootScope.User=UserInfo;
- if(typeof UserInfo.user_info!='undefined'){
- $rootScope.UserStatus.IsAuthenticated=true;
- }else{
- $rootScope.UserStatus.IsAuthenticated=false;
- }
- $rootScope.$broadcast("UserData");
- });
- $rootScope.deviceInfo = deviceDetector.device;
- $rootScope.isDesktopDetect = function () {
- if (DeviceDetection.IsIos() || DeviceDetection.IsIpad() || DeviceDetection.IsAndroid()) {
- return false;
- } else {
- return true;
- }
- }
- $rootScope.isAndroid = function () {
- if ($rootScope.deviceInfo == "android") {
- return true;
- } else {
- return false;
- }
- }
- $rootScope.setCookieForAndroid = function () {
- Cookie.Create("app", 1, 14);
- };
- $rootScope.checkTheAppCookie = function () {
- if (Cookie.Read("app").length) {
- if (Cookie.Read("app") == 1) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- };
- var MiladiDate = new Date();
- var ShamsiDate = new JDate(MiladiDate);
- var pureDate = ShamsiDate.toLocaleString().split(" ");
- var splittedPureDate = pureDate[0].split("/");
- var year = splittedPureDate[0];
- var month = splittedPureDate[1];
- var day = splittedPureDate[2];
- if (day.indexOf("0") == 0) {
- day = day.charAt(1);
- }
- if (month.indexOf("0") == 0) {
- month = month.charAt(1);
- }
- var fullDate = year + "-" + month + "-" + day;
- $rootScope.fullDateGeneral = fullDate;
- $rootScope.bannerToShow = function () {
- if (!$rootScope.checkTheAppCookie() && $rootScope.isAndroid()) {
- setTimeout(function () {
- $("#android-suggestion").removeClass("display-none");
- }, 200);
- }
- };
- $rootScope.bannerToShow();
- $rootScope.typeAhead = '';
- $rootScope.SearchProgramsUpdateInProgress = false;
- $rootScope.getSearchResult = function (JustEpisodes) {
- $rootScope.SearchProgramsUpdateInProgress = true;
- $rootScope.Context = '';
- $rootScope.Context = $rootScope.Page.SearchContext;
- $rootScope.SearchEpisodes = {Offset: 0, Limit: 10, UpdateInProgress: true, Episodes: [], Page: 0};
- $rootScope.SearchPrograms = {Offset: 0, Limit: 5, UpdateInProgress: true, Page: 0, Programs: []};
- if ($rootScope.Page.SearchContext != undefined) {
- if ($rootScope.Page.SearchContext.length >= 2) {
- $timeout.cancel($rootScope.typeAhead);
- $rootScope.typeAhead = $timeout(function () {
- debuger.log("Searching for keyword: " + $rootScope.Page.SearchContext);
- if (!JustEpisodes) {
- SearchFcy.getPrograms($rootScope.Context, $rootScope.SearchPrograms.Offset, $rootScope.SearchPrograms.Limit).then(function (result) {
- debuger.log("Program serach result arrived with this count: " + result.length);
- $rootScope.SearchPrograms.Page++;
- var tempArray = [];
- var tempArray2 = [];
- tempArray.push(result);
- tempArray2.push($rootScope.SearchPrograms.Programs);
- $rootScope.SearchPrograms.Programs = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- });
- }
- SearchFcy.getEpisodes($rootScope.Context, $rootScope.SearchEpisodes.Offset, $rootScope.SearchEpisodes.Limit).then(function (result) {
- debuger.log("Episode search result arrived with this count: " + result.length);
- $rootScope.SearchEpisodes.Page++;
- var tempArray = [];
- var tempArray2 = [];
- tempArray.push(result);
- tempArray2.push($rootScope.SearchEpisodes.Episodes);
- $rootScope.SearchEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- });
- $rootScope.SearchProgramsUpdateInProgress = false;
- }, 1000);
- } else {
- $rootScope.SearchPrograms = {};
- $rootScope.SearchEpisodes = {};
- $rootScope.SearchProgramsUpdateInProgress = false;
- }
- } else {
- $rootScope.SearchProgramsUpdateInProgress = false;
- }
- }
- $rootScope.$on("UserData", function () {
- });
- $rootScope.MakeURLFriendly = function (Context) {
- var Output;
- Output = Context.replace(/[\._ /,:-]+/g, "-")
- return Output;
- }
- $rootScope.MakeRedirection = function (link) {
- window.location = link;
- }
- $rootScope.getEpisodeImageWithCustomSize = function (Image, Size, JustImage) {
- return EpisodeSrv.getEpisodeImageWithCustomSize(Image, Size, JustImage);
- }
- $rootScope.scrollTo = function (id) {
- $location.hash(id);
- $anchorScroll();
- }
- $rootScope.ConvertToPersianNumber = function (string) {
- if (string != 'undefined' || string) {
- return persianUtils.toPersianNumber(string);
- } else {
- return null
- }
- }
- $rootScope.deviceInfo = deviceDetector.device;
- $rootScope.ChannelIdToName = function (id) {
- switch (id) {
- case 1:
- return "شبکه 1";
- break;
- case 2:
- return "شبکه 2";
- break;
- case 45:
- return "شبکه امید";
- break;
- case 3:
- return "شبکه 3";
- break;
- case 4:
- return "شبکه 4";
- break;
- case 5:
- return "شبکه 5";
- break;
- case 6:
- return "شبکه خبر";
- break;
- case 7:
- return "شبکه آموزش";
- break;
- case 8:
- return "شبکه پویا";
- break;
- case 9:
- return "شبکه IFilm";
- break;
- case 10:
- return "شبکه نمایش";
- break;
- case 11:
- return "شبکه تماشا";
- break;
- case 12:
- return "شبکه جام جم 1";
- break;
- case 13:
- return "شبکه ورزش";
- break;
- case 18:
- return "پرشین تونز";
- break;
- case 19:
- return "شبکه مستند سیما";
- break;
- case 20:
- return "شبکه قرآن";
- break;
- case 21:
- return "شبکه سلامت";
- break;
- case 22:
- return "شبکه جام جم 2";
- break;
- case 23:
- return "شبکه جام جم 3";
- break;
- case 24:
- return "شبکه شما";
- break;
- case 25:
- return "شبکه بازار";
- break;
- case 29:
- return "IFilm English";
- break;
- case 30:
- return "شبکه اصفهان";
- break;
- case 31:
- return "شبکه سهند";
- break;
- case 32:
- return "شبکه فارس";
- break;
- case 33:
- return "شبکه خوزستان";
- break;
- case 34:
- return "شبکه باران";
- break;
- case 35:
- return "سینمای خانگی";
- break;
- case 36:
- return "شبکه سمنان";
- break;
- case 37:
- return "شبکه آفتاب";
- break;
- case 38:
- return "شبکه افلاک";
- break;
- case 39:
- return "شبکه کردستان";
- break;
- case 40:
- return "شبکه خلیج فارس";
- break;
- case 41:
- return "شبکه نسیم";
- break;
- case 42:
- return "شبکه افق";
- break;
- case 43:
- return "شبکه HD";
- break;
- }
- }
- $rootScope.User = GeneralInit.User;
- $rootScope.Logout = function () {
- UserSrv.logoutUser();
- NgNote.Success(Messages.Fa.LogoutSuccessful, 3);
- $rootScope.User = {};
- $rootScope.UserStatus.IsAuthenticated = false;
- }
- $rootScope.InArray = function inArray(needle, haystack) {
- var length = haystack.length;
- for (var i = 0; i < length - 1; i++) {
- if (haystack[i] == needle) return true;
- }
- return false;
- }
- $rootScope.setShowVas = function () {
- Cookie.Create("showVas", 1, 5);
- }
- UserSrv.getUser().then(function (result) {
- var showVas = Cookie.Read("showVas");
- if (!$rootScope.InArray("vas", $window.location.hostname.split("."))) {
- if (typeof result != 'undefined' && typeof result.vas != 'undefined' && typeof result.vas.discover_url != 'undefined' && result.vas.discover_url != '' && result.vas.discover_url != null) {
- VasFcy.checkStatus(result.vas.discover_url).then(function (vـresult) {
- if (vـresult) {
- NgNote.Success("به سرویس تلوبیون بر بستر طرح بینهایت مخابرات استان اصفهان خوش آمدید", 3);
- setTimeout(function () {
- $window.location.replace(result.vas.redirect_url);
- }, 3000);
- }
- else {
- if (typeof showVas == 'undefined' || showVas == null || showVas == '' || showVas == 'nullcookie') {
- NgNotifier.Info("کاربر گرامی. در صورت تهیه طرح بینهایت مخابرات اصفهان، میتوانید این ویدئو و هزاران ویدئو دیگر را بدون مصرف حجم دانلود خود، مشاهده نمایید", 120, "http://20plus.tce.ir/", $rootScope.setShowVas);
- }
- }
- })
- }
- }
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- $rootScope.HasAdminAccess = true;
- debuger.init("debugger-container");
- }
- })
- }
- function ForgotPasswordCtrl(GeneralInit,UserSrv,Messages,$rootScope,SiteConstants,ProgressBarFcy,$scope){
- var frp= this;
- frp.User={};
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.ForgotPassword;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- frp.ForgotPassword={Status:"NoAction"};
- frp.DoRequest=function(){
- var response = $scope.gRecaptchaForgotResponse+"";
- if(response.length>0 && response != "undefined") {
- frp.ForgotPassword.Status = "InProgress";
- UserSrv.forgotPasswordUser(frp.User.Email).then(function (result) {
- if (result.status_code == 1) {
- frp.ForgotPassword.Status = "SuccessfulAction";
- NgNote.Success('لینک تغییر کلمه عبور با موفقیت ارسال شد', 5);
- }
- else {
- frp.ForgotPassword.Status = "NoAction";
- NgNote.Error(result.status_message, 3);
- }
- });
- }else{
- NgNote.Error(Messages.Fa.RobotError, 3);
- }
- }
- }
- function LoginCtrl(GeneralInit,UserSrv,Messages,$window,$rootScope,SiteConstants,ProgressBarFcy,$auth,toastr,$scope, $location){
- var urg= this;
- urg.User={};//GeneralInit.User;
- urg.ResendCount = 0;
- /*(GeneralInit.Culture=="fa")?SiteConstants.Fa.PageTitle.Register:SiteConstants.En.PageTitle.Register;*/
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.Register;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- urg.Registration= {Status: "NoAction"};
- urg.Login= {Status: "NoAction"};
- var regexPhoneNumber = /^\+(?:[\d]*)$/;
- var regexPhoneNumber2 = /^[0-9]*$/;
- urg.phoneNumberStatus = false;
- urg.Register=function(){
- if(regexPhoneNumber.test(urg.User.phone) || regexPhoneNumber2.test(urg.User.phone) || !urg.User.phone) {
- var response = $scope.gRecaptchaRegisterResponse + "";
- if (response.length > 0 && response != "undefined") {
- urg.Registration.Status = "InProgress";
- UserSrv.registerUser(urg.User).then(function (result) {
- if (result.status_code == 1) {
- urg.Registration.Status = "SuccessfulAction";
- NgNote.Success(Messages.Fa.SuccessfulRegistration, 5);
- urg.phoneNumberStatus = false;
- }
- else {
- urg.Registration.Status = "NoAction";
- NgNote.Error(result.status_message, 3);
- urg.phoneNumberStatus = false;
- }
- });
- } else {
- NgNote.Error(Messages.Fa.RobotError, 3);
- }
- }else {
- urg.phoneNumberStatus = true;
- }
- }
- urg.DoLogin=function(){
- var response = $scope.gRecaptchaLoginResponse+"";
- if(response.length > 0 && response !="undefined") {
- urg.Login.Status = "InProgress";
- UserSrv.loginUser(urg.User).then(function (result) {
- if (result && typeof result == 'object') {
- urg.Login.Status = "SuccessfulAction";
- if (result != null && typeof result.token !== 'undefined') {
- NgNote.Success(Messages.Fa.LoginSuccessful, 3);
- setTimeout(function () {
- $window.location.replace("/#!/");
- }, 1000);
- } else {
- urg.Login.Status = "NoAction";
- NgNote.Error(Messages.Fa.FailedLogin, 3);
- }
- }
- else {
- urg.Login.Status = "NoAction";
- urg.Login.ErrorMessage = Messages.Fa.FailedLogin;
- }
- });
- }else{
- NgNote.Error(Messages.Fa.RobotError, 3);
- }
- }
- urg.DoResend= function(){
- if(urg.ResendCount<3){
- ++urg.ResendCount;
- UserSrv.resendVerificationEmail(urg.User.Email).then(function(result){
- if(result.status_code==1){
- NgNote.Success(Messages.Fa.ConfirmRegistrationResend,3);
- }
- else{
- NgNote.Error(result.status_message,3);
- }
- });
- }
- }
- urg.authenticate = function(provider) {
- $auth.authenticate(provider)
- .then(function() {
- toastr.success('You have successfully signed in with ' + provider + '!');
- $location.path('/');
- })
- .catch(function(error) {
- if (error.error) {
- // Popup error - invalid redirect_uri, pressed cancel button, etc.
- toastr.error(error.error);
- } else if (error.data) {
- // HTTP response error from server
- toastr.error(error.data.message, error.status);
- } else {
- toastr.error(error);
- }
- });
- };
- }
- function ChannelArchiveOldCtrl($window,GeneralInit,ChannelSrv,$routeParams,$rootScope,deviceDetector,ProgressBarFcy,ChannelFcy,EpisodeFcy,Configs,$scope,$timeout,SecurityFcy,$location,$route) {
- var id = $routeParams.Id;
- $timeout(function () {
- $window.location.href = "/#!/archive/"+id+"/"+$rootScope.fullDateGeneral;
- },500)
- }
- function ChannelArchiveCtrl(GeneralInit,ChannelSrv,$routeParams,$rootScope,deviceDetector,ProgressBarFcy,ChannelFcy,EpisodeFcy,Configs,$scope,$timeout,SecurityFcy,$location,$route){
- var cac = this;
- var pureDate = $routeParams.date;
- var splittedPureDate = pureDate.split("-");
- var year = splittedPureDate[0];
- var month = splittedPureDate[1];
- var day = splittedPureDate[2];
- var ShamsiDate = new JDate(parseInt(year),parseInt(month)-1,parseInt(day))._date.toString();
- var nameOfDay = ShamsiDate.split(" ")[0];
- var pureDateGenral = $routeParams.date;
- var todayMiladiDate = new Date;
- $scope.todayMiladiDate = new JDate(todayMiladiDate);
- $scope.whetherTodayPassed=false;
- var compareDates = function (selectedDate) {
- $scope.todayMiladiDate = new JDate(todayMiladiDate);
- if($scope.todayMiladiDate > selectedDate){
- $scope.whetherTodayPassed = true;
- } else{
- $scope.whetherTodayPassed = false;
- }
- }
- compareDates(new JDate(parseInt(year),parseInt(month)-1,parseInt(day)+1))
- if(day.indexOf("0")==0){
- day = day.charAt(1);
- }
- if(month.indexOf("0")==0){
- month = month.charAt(1);
- }
- var countNumberOfDays = 0;
- $(document).on("click","#next-day",function () {
- countNumberOfDays--;
- var pureDate = pureDateGenral;
- var splittedPureDate = pureDate.split("-");
- var year = splittedPureDate[0];
- var month = splittedPureDate[1];
- var day = splittedPureDate[2];
- pureDate= new JDate(parseInt(year),parseInt(month)-1,parseInt(day)+1).toLocaleString().split(" ")[0];
- compareDates(new JDate(parseInt(year),parseInt(month)-1,parseInt(day)+2));
- splittedPureDate = pureDate.split("/");
- year = splittedPureDate[0];
- month = splittedPureDate[1];
- day = splittedPureDate[2];
- if(day.indexOf("0")==0){
- day = day.charAt(1);
- }
- if(month.indexOf("0")==0){
- month = month.charAt(1);
- }
- pureDateGenral = year+"-"+month+"-"+day;
- var MiladiDate = new JDate(parseInt(year),parseInt(month)-1,parseInt(day))._date.toString();
- var nameOfDay = MiladiDate.split(" ")[0];
- var fullDate=year+"-"+month+"-"+day;
- var nameOfDayFarsi = cac.nameOfTheDays[nameOfDay];
- $(".date-dropdown-selector > ul li i").addClass("display-none").removeClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+day+"][data-index=3]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+month+"][data-index=2]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+year+"][data-index=1]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li i.actives").each(function () {
- var index = $(this).parent().data("index");
- var parentItem = $(this).parents(".date-selectbox").find(".selected-value");
- var content = $(this).parent().find("span").html();
- parentItem.html(content);
- var content = $(this).parent().find("span").html();
- if(3-index==0)
- $("#date-to-show li").eq(3-index).html(nameOfDayFarsi+content);
- else
- $("#date-to-show li").eq(3-index).html(content);
- });
- cac.ChannelNewestEpisodes = {Offset:0,Limit:150,UpdateInProgress:true,Episodes:[],Page:0};
- window.history.pushState({ url: "/#!/archive/"+cac.ChannelId+"/"+fullDate },null,"/#!/archive/"+cac.ChannelId+"/"+fullDate);
- EpisodeFcy.getEpisodeByDateAndChannel(fullDate,cac.ChannelOriginalId,cac.ChannelNewestEpisodes.Offset,cac.ChannelNewestEpisodes.Limit).then(function(result) {
- if (cac.ChannelNewestEpisodes.Page == 1) {
- TwoRowsCarousel.CarouselInit("ThisChannelsLatest");
- }
- window.LiveChannelLatestEpisodes = result.length;
- window.LiveChannelLatestEpisodesTotal += parseInt(window.LiveChannelLatestEpisodes);
- var tempArray = [];
- var tempArray2 = [];
- tempArray.push(result);
- tempArray2.push(cac.ChannelNewestEpisodes.Episodes);
- cac.ChannelNewestEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- cac.ChannelNewestEpisodes.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- });
- });
- });
- $(document).on("click","#previous-day",function () {
- countNumberOfDays++;
- var pureDate = pureDateGenral;
- var splittedPureDate = pureDate.split("-");
- var year = splittedPureDate[0];
- var month = splittedPureDate[1];
- var day = splittedPureDate[2];
- if(parseInt(day)-1 == 0) {
- pureDate = new JDate(parseInt(year), parseInt(month) - 2, 30).toLocaleString().split(" ")[0];
- splittedPureDate = pureDate.split("/");
- year = splittedPureDate[0];
- month = splittedPureDate[1];
- day = (parseInt(splittedPureDate[2])+1)+"";
- compareDates(new JDate(parseInt(year), parseInt(month) - 2, 31));
- }else {
- pureDate = new JDate(parseInt(year), parseInt(month) - 1, parseInt(day) - 1).toLocaleString().split(" ")[0];
- compareDates(new JDate(parseInt(year), parseInt(month) - 1, parseInt(day) - 1));
- splittedPureDate = pureDate.split("/");
- year = splittedPureDate[0];
- month = splittedPureDate[1];
- day = splittedPureDate[2];
- }
- if(day.indexOf("0")==0){
- day = day.charAt(1);
- }
- if(month.indexOf("0")==0){
- month = month.charAt(1);
- }
- pureDateGenral = year+"-"+month+"-"+day;
- var MiladiDate = new JDate(parseInt(year),parseInt(month)-1,parseInt(day))._date.toString();
- var nameOfDay = MiladiDate.split(" ")[0];
- var fullDate=year+"-"+month+"-"+day;
- var nameOfDayFarsi = cac.nameOfTheDays[nameOfDay];
- $(".date-dropdown-selector > ul li i").addClass("display-none").removeClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+day+"][data-index=3]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+month+"][data-index=2]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+year+"][data-index=1]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li i.actives").each(function () {
- var index = $(this).parent().data("index");
- var parentItem = $(this).parents(".date-selectbox").find(".selected-value");
- var content = $(this).parent().find("span").html();
- parentItem.html(content);
- var content = $(this).parent().find("span").html();
- if(3-index==0)
- $("#date-to-show li").eq(3-index).html(nameOfDayFarsi+content);
- else
- $("#date-to-show li").eq(3-index).html(content);
- });
- cac.ChannelNewestEpisodes = {Offset:0,Limit:150,UpdateInProgress:true,Episodes:[],Page:0};
- window.history.pushState({ url: "/#!/archive/"+cac.ChannelId+"/"+fullDate },null,"/#!/archive/"+cac.ChannelId+"/"+fullDate);
- EpisodeFcy.getEpisodeByDateAndChannel(fullDate,cac.ChannelOriginalId,cac.ChannelNewestEpisodes.Offset,cac.ChannelNewestEpisodes.Limit).then(function(result) {
- if (cac.ChannelNewestEpisodes.Page == 1) {
- TwoRowsCarousel.CarouselInit("ThisChannelsLatest");
- }
- window.LiveChannelLatestEpisodes = result.length;
- window.LiveChannelLatestEpisodesTotal += parseInt(window.LiveChannelLatestEpisodes);
- var tempArray = [];
- var tempArray2 = [];
- tempArray.push(result);
- tempArray2.push(cac.ChannelNewestEpisodes.Episodes);
- cac.ChannelNewestEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- cac.ChannelNewestEpisodes.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- });
- });
- });
- $(document).on("click","#today-convert",function () {
- countNumberOfDays = 0;
- var MiladiDate = new Date();
- var ShamsiDate = new JDate(MiladiDate);
- var pureDate = ShamsiDate.toLocaleString().split(" ");
- var splittedPureDate = pureDate[0].split("/");
- var year = splittedPureDate[0];
- var month = splittedPureDate[1];
- var day = splittedPureDate[2];
- if(day.indexOf("0")==0){
- day = day.charAt(1);
- }
- if(month.indexOf("0")==0){
- month = month.charAt(1);
- }
- $scope.whetherTodayPassed = false;
- pureDateGenral = year+"-"+month+"-"+day;
- var fullDate=year+"-"+month+"-"+day;
- var ShamsiDate2 = new JDate(parseInt(year),parseInt(month)-1,parseInt(day))._date.toString();
- var nameOfDay = ShamsiDate2.split(" ")[0];
- var nameOfDayFarsi = cac.nameOfTheDays[nameOfDay];
- $(".date-dropdown-selector > ul li i").addClass("display-none").removeClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+day+"][data-index=3]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+month+"][data-index=2]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+year+"][data-index=1]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li i.actives").each(function () {
- var index = $(this).parent().data("index");
- var parentItem = $(this).parents(".date-selectbox").find(".selected-value");
- var content = $(this).parent().find("span").html();
- parentItem.html(content);
- var content = $(this).parent().find("span").html();
- if(3-index==0)
- $("#date-to-show li").eq(3-index).html(nameOfDayFarsi+content);
- else
- $("#date-to-show li").eq(3-index).html(content);
- });
- cac.ChannelNewestEpisodes = {Offset:0,Limit:150,UpdateInProgress:true,Episodes:[],Page:0};
- window.history.pushState({ url: "/#!/archive/"+cac.ChannelId+"/"+fullDate },null,"/#!/archive/"+cac.ChannelId+"/"+fullDate);
- EpisodeFcy.getEpisodeByDateAndChannel(fullDate,cac.ChannelOriginalId,cac.ChannelNewestEpisodes.Offset,cac.ChannelNewestEpisodes.Limit).then(function(result) {
- if (cac.ChannelNewestEpisodes.Page == 1) {
- TwoRowsCarousel.CarouselInit("ThisChannelsLatest");
- }
- window.LiveChannelLatestEpisodes = result.length;
- window.LiveChannelLatestEpisodesTotal += parseInt(window.LiveChannelLatestEpisodes);
- var tempArray = [];
- var tempArray2 = [];
- tempArray.push(result);
- tempArray2.push(cac.ChannelNewestEpisodes.Episodes);
- cac.ChannelNewestEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- cac.ChannelNewestEpisodes.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- });
- });
- })
- var fullDate=year+"-"+month+"-"+day;
- cac.ChannelId = $routeParams.Id;
- cac.PersianChannelName = "";
- cac.selectBoxYears = [
- {"id":1395 , "content":"1395"}
- ]
- cac.selectBoxMonths = [
- {"id":1 , "content":"فروردین"},{"id":2 , "content":"اردیبهشت"},{"id":3 , "content":"خرداد"},{"id":4 , "content":"تیر"},{"id":5 , "content":"مرداد"},{"id":6 , "content":"شهریور"},{"id":7 , "content":"مهر"},{"id":8 , "content":"آبان"},{"id":9 , "content":"آذر"},{"id":10 , "content":"دی"},{"id":11 , "content":"بهمن"},{"id":12 , "content":"اسفند"}
- ]
- cac.selectBoxDays = [
- {"id":1 , "content":"1"},{"id":2 , "content":"2"},{"id":3 , "content":"3"},{"id":4 , "content":"4"},{"id":5 , "content":"5"},{"id":6 , "content":"6"},{"id":7 , "content":"7"},{"id":8 , "content":"8"},{"id":9 , "content":"9"},{"id":10 , "content":"10"},{"id":11 , "content":"11"},{"id":12 , "content":"12"},{"id":13 , "content":"13"},{"id":14 , "content":"14"},{"id":15 , "content":"15"},{"id":16 , "content":"16"},{"id":17 , "content":"17"},{"id":18 , "content":"18"},{"id":19 , "content":"19"},{"id":20 , "content":"20"},{"id":21 , "content":"21"},{"id":22 , "content":"22"},{"id":23 , "content":"23"},{"id":24 , "content":"24"},{"id":25 , "content":"25"},{"id":26 , "content":"26"},{"id":27 , "content":"27"},{"id":28 , "content":"28"},{"id":29 , "content":"29"},{"id":30 , "content":"30"},{"id":31 , "content":"31"}
- ]
- cac.nameOfTheDays = [];
- cac.nameOfTheDays["Sat"]= "شنبه";
- cac.nameOfTheDays["Sun"] = "یکشنبه";
- cac.nameOfTheDays["Mon"]="دوشنبه";
- cac.nameOfTheDays["Tue"]="سه شنبه";
- cac.nameOfTheDays["Wed"]="چهارشنبه";
- cac.nameOfTheDays["Thu"]="پنجشنبه";
- cac.nameOfTheDays["Fri"]="جمعه";
- var nameOfDayFarsi = cac.nameOfTheDays[nameOfDay];
- // var nameOfDayFarsi = cac.nameOfTheDays[nameOfDay]
- cac.ChannelData={Offset:0,Limit:50,UpdateInProgress:true,Channels:[],Page:1,MaximumPage:0,tempColumn:0};
- cac.ChannelSettings={Offset:0,Limit:50,UpdateInProgress:true,Channels:[],Page:1,MaximumPage:0,tempColumn:0};
- cac.ChannelNewestEpisodes = {Offset:0,Limit:150,UpdateInProgress:true,Episodes:[],Page:0};
- ChannelFcy.getChannelNameFromDescriptor(cac.ChannelId).then(function(ChannelId){
- SecurityFcy.getToken().then(function (token){
- ChannelSrv.getChannel(ChannelId,deviceDetector.device,token).then(function(result){
- cac.ChannelOriginalId=ChannelId;
- cac.Channel={};
- cac.Channel.links=result;
- $rootScope.Page.Title="آرشیو "+$rootScope.ChannelIdToName(ChannelId);//(GeneralInit.Culture=="fa")?lic.Channel.title:lic.Channel.title_english;
- $rootScope.Page.Description="پخش زنده شبکه " + $rootScope.ChannelIdToName(ChannelId);
- $rootScope.Page.Keywords= "پخش زنده شبکه " + $rootScope.ChannelIdToName(ChannelId);
- $rootScope.$broadcast("UserData");
- window.ChannelId = $routeParams.Id;
- cac.ChannelSettings.UpdateInProgress = false;
- cac.ChannelSettings.IsPlaying = true;
- EpisodeFcy.getEpisodeByDateAndChannel(fullDate,ChannelId,cac.ChannelNewestEpisodes.Offset,cac.ChannelNewestEpisodes.Limit).then(function(result) {
- pureDate = $routeParams.date;
- splittedPureDate = pureDate.split("-");
- year = splittedPureDate[0];
- month = splittedPureDate[1];
- day = splittedPureDate[2];
- if(day.indexOf("0")==0){
- day = day.charAt(1);
- }
- if(month.indexOf("0")==0){
- month = month.charAt(1);
- }
- fullDate=year+"-"+month+"-"+day;
- setTimeout(function () {
- $(".date-dropdown-selector > ul li[data-id="+day+"][data-index=3]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+month+"][data-index=2]").find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul li[data-id="+year+"][data-index=1]").find("i").removeClass("display-none").addClass("actives");
- },200)
- cac.ChannelNewestEpisodes.Page++;
- if (cac.ChannelNewestEpisodes.Page == 1) {
- TwoRowsCarousel.CarouselInit("ThisChannelsLatest");
- }
- window.LiveChannelLatestEpisodes = result.length;
- window.LiveChannelLatestEpisodesTotal += parseInt(window.LiveChannelLatestEpisodes);
- var tempArray = [];
- var tempArray2 = [];
- tempArray.push(result);
- tempArray2.push(cac.ChannelNewestEpisodes.Episodes);
- cac.ChannelNewestEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- cac.ChannelNewestEpisodes.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- });
- });
- $timeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- $(".date-dropdown-selector > ul li i.actives").each(function () {
- var index = $(this).parent().data("index");
- var parentItem = $(this).parents(".date-selectbox").find(".selected-value");
- var content = $(this).parent().find("span").html();
- parentItem.html(content);
- var content = $(this).parent().find("span").html();
- if(3-index==0)
- $("#date-to-show li").eq(3-index).html(nameOfDayFarsi+content);
- else
- $("#date-to-show li").eq(3-index).html(content);
- });
- },1000);
- ProgressBarFcy.plus(0.2);
- });
- });
- });
- var lastRoute = $route.current;
- $scope.$on('$locationChangeSuccess', function(event,next) {
- if(next.toString().indexOf("/archive/")>0){
- $route.current = lastRoute;
- }
- });
- var ChannelIdAfterChange;
- cac.changeState = function (descriptor,Id) {
- $("#list-of-channels-carousel li").removeClass("active-channel");
- $("#list-of-channels-carousel li[data-descriptor="+descriptor+"]").addClass("active-channel");
- $rootScope.Page.Title="آرشیو "+$rootScope.ChannelIdToName(Id);
- cac.ChannelNewestEpisodes = {Offset:0,Limit:150,UpdateInProgress:true,Episodes:[],Page:0};
- ProgressBarFcy.setDone();
- cac.ChannelOriginalId = Id;
- var dateToChange = [];
- $(".date-dropdown-selector > ul li i.actives").each(function () {
- if($(this).parent().attr("data-index")=="3"){
- dateToChange[2] = $(this).parent().attr("data-id")
- }else if($(this).parent().attr("data-index")=="2"){
- dateToChange[1] = $(this).parent().attr("data-id")
- }else{
- dateToChange[0] = $(this).parent().attr("data-id")
- }
- })
- dateToChange = dateToChange.join("-");
- window.history.pushState({ url: "/#!/archive/"+descriptor+"/"+dateToChange },null,"/#!/archive/"+descriptor+"/"+dateToChange);
- cac.ChannelNewestEpisodes.UpdateInProgress = true;
- EpisodeFcy.getEpisodeByDateAndChannel(pureDateGenral,Id,cac.ChannelNewestEpisodes.Offset,cac.ChannelNewestEpisodes.Limit).then(function(result) {
- cac.ChannelNewestEpisodes.Page++;
- if (cac.ChannelNewestEpisodes.Page == 1) {
- TwoRowsCarousel.CarouselInit("ThisChannelsLatest");
- }
- cac.ChannelId = descriptor;
- window.LiveChannelLatestEpisodes = result.length;
- window.LiveChannelLatestEpisodesTotal += parseInt(window.LiveChannelLatestEpisodes);
- var tempArray = [];
- var tempArray2 = [];
- tempArray.push(result);
- tempArray2.push(cac.ChannelNewestEpisodes.Episodes);
- cac.ChannelNewestEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- cac.ChannelNewestEpisodes.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- });
- });
- cac.PersianChannelName =persianUtils.toPersianNumber( " آرشیو "+$rootScope.ChannelIdToName(parseInt($("#list-of-channels-carousel li.active-channel").attr("data-id"))));
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- }
- $(document).on("click",".date-dropdown-selector > ul > li",function () {
- var elem = $(this);
- var ulList = elem.parent().find("li i");
- var content = $(this).find("span").html();
- var parentItem = $(this).parents(".date-selectbox").find(".selected-value");
- var selectedDay;
- var selectedMonth;
- var selectedYear;
- parentItem.html(content);
- ulList.addClass("display-none").removeClass("actives");
- elem.find("i").removeClass("display-none").addClass("actives");
- $(".date-dropdown-selector > ul > li i.actives").each(function () {
- var item = $(this).parent();
- if(item.data("index")==3){
- selectedDay = item.data("id");
- }
- if(item.data("index")==2){
- selectedMonth = item.data("id");
- }
- if(item.data("index")==1){
- selectedYear = item.data("id");
- }
- });
- var fullDate = selectedYear + "-" + selectedMonth + "-" + selectedDay
- ShamsiDate = new JDate(parseInt(selectedYear),parseInt(selectedMonth)-1,parseInt(selectedDay))._date.toString();
- compareDates(new JDate(parseInt(selectedYear),parseInt(selectedMonth)-1,parseInt(selectedDay)));
- pureDateGenral = selectedYear + "-" + selectedMonth + "-" + selectedDay;
- var nameOfDay = ShamsiDate.split(" ")[0];
- var nameOfDayFarsi = cac.nameOfTheDays[nameOfDay];
- window.history.pushState({ url: "/#!/archive/"+cac.ChannelId+"/"+fullDate },null,"/#!/archive/"+cac.ChannelId+"/"+fullDate);
- cac.ChannelNewestEpisodes = {Offset:0,Limit:150,UpdateInProgress:true,Episodes:[],Page:0};
- EpisodeFcy.getEpisodeByDateAndChannel(fullDate,cac.ChannelOriginalId,cac.ChannelNewestEpisodes.Offset,cac.ChannelNewestEpisodes.Limit).then(function(result) {
- if (cac.ChannelNewestEpisodes.Page == 1) {
- TwoRowsCarousel.CarouselInit("ThisChannelsLatest");
- }
- window.LiveChannelLatestEpisodes = result.length;
- window.LiveChannelLatestEpisodesTotal += parseInt(window.LiveChannelLatestEpisodes);
- var tempArray = [];
- var tempArray2 = [];
- tempArray.push(result);
- tempArray2.push(cac.ChannelNewestEpisodes.Episodes);
- cac.ChannelNewestEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- cac.ChannelNewestEpisodes.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- });
- });
- cac.PersianChannelName =persianUtils.toPersianNumber( " آرشیو "+$rootScope.ChannelIdToName(parseInt($("#list-of-channels-carousel li.active-channel").attr("data-id"))));
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- if(elem.attr("data-index")!=2) {
- if (elem.attr("data-index") == 3)
- $("#date-to-show li").eq(3 - parseInt(elem.attr("data-index"))).html(nameOfDayFarsi + " " + $rootScope.ConvertToPersianNumber(elem.attr("data-id")));
- else
- $("#date-to-show li").eq(3 - parseInt(elem.attr("data-index"))).html($rootScope.ConvertToPersianNumber(elem.attr("data-id")));
- }else {
- $("#date-to-show li").eq(3 - parseInt(elem.attr("data-index"))).html(elem.find("span").html());
- $("#date-to-show li").eq(0).html(nameOfDayFarsi + " " + $rootScope.ConvertToPersianNumber(elem.attr("data-id")));
- }
- });
- cac.getNext=function() {
- cac.ChannelNewestEpisodes = {Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0};
- EpisodeFcy.getEpisodeByDateAndChannel(fullDate,cac.ChannelOriginalId,cac.ChannelNewestEpisodes.Offset,cac.ChannelNewestEpisodes.Limit).then(function(result) {
- cac.ChannelNewestEpisodes.Page++;
- if (cac.ChannelNewestEpisodes.Page == 1) {
- TwoRowsCarousel.CarouselInit("ThisChannelsLatest");
- }
- window.LiveChannelLatestEpisodes = result.length;
- window.LiveChannelLatestEpisodesTotal += parseInt(window.LiveChannelLatestEpisodes);
- var tempArray = [];
- var tempArray2 = [];
- tempArray.push(result);
- tempArray2.push(cac.ChannelNewestEpisodes.Episodes);
- cac.ChannelNewestEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- cac.ChannelNewestEpisodes.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- });
- });
- cac.ChannelNewestEpisodes.Limit = ((cac.ChannelNewestEpisodes.Page + 1) == 1) ? 50 : 50;
- cac.ChannelNewestEpisodes.Offset = ((cac.ChannelNewestEpisodes.Page + 1) == 1) ? 0 : ((cac.ChannelNewestEpisodes.Page) * 50);
- cac.ChannelNewestEpisodes.UpdateInProgress = true;
- EpisodeFcy.getEpisodeByDateAndChannel(fullDate,cac.ChannelOriginalId,cac.ChannelNewestEpisodes.Offset,cac.ChannelNewestEpisodes.Limit);
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- }
- cac.getChannels=function(){
- ChannelFcy.getChannels().then(function(Channels){
- LiveChannelsCarousel.CarouselInit("OtherChannels");
- cac.ChannelData.Channels=Channels;
- cac.ChannelData.MaximumPage=Math.ceil(Channels.length/cac.ChannelData.Limit);
- cac.ChannelData.UpdateInProgress=false;
- $rootScope.ChannelData=cac.ChannelData;
- $rootScope.$broadcast("UserData");
- $timeout(function () {
- cac.PersianChannelName =persianUtils.toPersianNumber( " آرشیو "+$rootScope.ChannelIdToName(parseInt($("#list-of-channels-carousel li.active-channel").attr("data-id"))));
- AutoFocus.applyFocus();
- },1000);
- });
- }
- cac.getChannels();
- }
- function LiveCtrl(GeneralInit,ChannelSrv,$routeParams,$rootScope,deviceDetector,ProgressBarFcy,ChannelFcy,EpisodeFcy,Configs,$scope,$timeout,SecurityFcy,HourlyArchiveFcy){
- var lic=this;
- $(".position-fix-carousel").scroll(function () {
- $(document).scroll()
- })
- $(document).on("click",".slick-next,.slick-prev",function () {
- $(document).scroll()
- setTimeout(function () {
- $(document).scroll()
- },600)
- });
- var MiladiDate = new Date();
- var ShamsiDate = new JDate(MiladiDate);
- var pureDate = ShamsiDate.toLocaleString().split(" ");
- var splittedPureDate = pureDate[0].split("/");
- var hours = pureDate[1].split(":")[0];
- var minutes = pureDate[1].split(":")[1];
- var year = splittedPureDate[0];
- var month = splittedPureDate[1];
- var day = splittedPureDate[2];
- if(day.indexOf("0")==0){
- day = day.charAt(1);
- }
- if(month.indexOf("0")==0){
- month = month.charAt(1);
- }
- var fullDate=year+"-"+month+"-"+day;
- lic.fullDate = fullDate;
- TopCarousel.initCarousel();
- var nameOfDays = [];
- nameOfDays["Sat"] = "شنبه";
- nameOfDays["Sun"] = "یکشنبه";
- nameOfDays["Mon"] = "دوشنبه";
- nameOfDays["Tue"] = "سه شنبه";
- nameOfDays["Wed"] = "چهارشنبه";
- nameOfDays["Thu"] = "پنجشنبه";
- nameOfDays["Fri"] = "جمعه";
- nameOfDays[0] = "شنبه";
- nameOfDays[1] = "یکشنبه";
- nameOfDays[2] = "دوشنبه";
- nameOfDays[3] = "سه شنبه";
- nameOfDays[4] = "چهارشنبه";
- nameOfDays[5] = "پنجشنبه";
- nameOfDays[6] = "جمعه";
- var todayIndex = 0;
- if((MiladiDate+"").indexOf("Sat") >=0){
- todayIndex = 0
- }else if((MiladiDate+"").indexOf("Sun") >=0){
- todayIndex = 1;
- }else if((MiladiDate+"").indexOf("Mon") >=0){
- todayIndex = 2;
- }else if((MiladiDate+"").indexOf("Tue") >=0){
- todayIndex = 3;
- }else if((MiladiDate+"").indexOf("Wed") >=0){
- todayIndex = 4;
- }else if((MiladiDate+"").indexOf("Thu") >=0){
- todayIndex = 5;
- }else if((MiladiDate+"").indexOf("Fri") >=0){
- todayIndex = 6;
- }
- var dayName = nameOfDays[ShamsiDate.a.toString().split(" ")[0]];
- fixWidthsOfCarousel.appendDaysToCarousel(nameOfDays,day,month,todayIndex);
- $timeout(function () {
- $(".carousel-image-container img").each(function () {
- $(this).error(function () {
- if(!$(this).attr("data-replaced"))
- replacePipelineAddress.replace($(this));
- })
- })
- },600);
- $timeout(initDates.init(),300);
- $timeout($(window).resize(),300);
- lic.getSelectedImage = function(ImagePath){
- var PathList=ImagePath.split('/');
- return PathList[0]+"/"+PathList[1]+"/"+PathList[2]+"/"+"selected-"+PathList[3];
- };
- $timeout($(window).resize());
- window.LiveChannelLatestEpisodesTotal=0;
- window.LiveChannelHourlyArchiveTotal=0;
- lic.User=GeneralInit.User;
- lic.ChannelId=$routeParams.Id;
- window.LiveChannelDecriptor = $routeParams.Id;
- /*lic.Play = function(){
- window.activePlayer = "MobileLivePlayer";
- window.activePlayerToolbarPlay='MobileLivePlayerToolbarPlayPause';
- window.playerType = 'VideoJs';
- jQuery("#PlayThePlayer2").hide();
- if(DeviceDetection.IsAndroid() || DeviceDetection.IsIos() || DeviceDetection.IsSmartTv()) {
- Player.Play(null, null, true);
- }
- };*/
- lic.foundedResult = true;
- lic.ChannelData={Offset:0,Limit:50,UpdateInProgress:true,Channels:[],Page:1,MaximumPage:0,tempColumn:0};
- lic.ChannelNewestEpisodes = {Offset:0,Limit:19,UpdateInProgress:true,Episodes:[],Page:0};
- lic.ChannelHourlyArchiveEpisodes = {Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0};
- lic.ChannelSettings = {UpdateInProgress:true,IsPlaying:false};
- lic.hourlyArchiveContent = {items:[]};
- $("#loader-hourly").show();
- lic.selectedChannelData = {};
- lic.getChannels=function(){
- ChannelFcy.getChannels().then(function(Channels){
- $timeout(function () {
- $("#OtherChannels").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },200);
- LiveChannelsCarousel.CarouselInit("OtherChannels");
- lic.ChannelData.Channels=Channels;
- lic.ChannelData.MaximumPage=Math.ceil(Channels.length/lic.ChannelData.Limit);
- lic.ChannelData.UpdateInProgress=false;
- $rootScope.ChannelData=lic.ChannelData;
- $rootScope.$broadcast("UserData");
- for(var i=0;i<lic.ChannelData.Channels.length; i++){
- if(lic.ChannelData.Channels[i].descriptor == lic.ChannelId){
- lic.selectedChannelData = lic.ChannelData.Channels[i];
- }
- }
- var today = new Date();
- var dd = today.getDate();
- var mm = today.getMonth()+1; //January is 0!
- var yyyy = today.getFullYear();
- if(dd<10){
- dd='0'+dd;
- }
- if(mm<10){
- mm='0'+mm;
- }
- var today = yyyy+'-'+mm+'-'+dd;
- HourlyArchiveFcy.getProgramsByChannel(lic.selectedChannelData.id,today).then(function (data) {
- lic.hourlyArchiveContent.items = data;
- if(data.length == 0){
- lic.foundedResult = false;
- }else{
- lic.foundedResult = true;
- }
- })
- $timeout(function () {
- var MiladiDate = new Date();
- var ShamsiDate = new JDate(MiladiDate);
- var pureDate = ShamsiDate.toLocaleString().split(" ");
- var splittedPureDate = pureDate[0].split("/");
- var hours = pureDate[1].split(":")[0];
- var minutes = pureDate[1].split(":")[1];
- var year = splittedPureDate[0];
- var month = splittedPureDate[1];
- var day = splittedPureDate[2];
- if(day.indexOf("0")==0){
- day = day.charAt(1);
- }
- if(month.indexOf("0")==0){
- month = month.charAt(1);
- }
- fixClockPointer.fix(hours,minutes);
- fixWidthsOfCarousel.fixRightPosition(hours,minutes);
- fixWidthsOfCarousel.fixCounterAmount(hours);
- fixWidthsOfCarousel.fix();
- },2500);
- });
- };
- $(document).on("click","#days-on-carousel > li",function () {
- $(".day-carousel-new-hourly li > div > div").removeClass("active-days");
- $("#program-lists").hide();
- $(this).find(" > div > div").addClass("active-days");
- lic.updateHourlyArchiveNew($(this).data("date"));
- })
- lic.updateHourlyArchiveNew = function (date) {
- HourlyArchiveFcy.getProgramsByChannel(lic.selectedChannelData.id,date).then(function (data) {
- lic.hourlyArchiveContent.items = data;
- if(data.length == 0){
- lic.foundedResult = false;
- }else{
- lic.foundedResult = true;
- }
- })
- $("#loader-hourly").show();
- $timeout(function () {
- var MiladiDate = new Date();
- var ShamsiDate = new JDate(MiladiDate);
- var pureDate = ShamsiDate.toLocaleString().split(" ");
- var splittedPureDate = pureDate[0].split("/");
- var hours = pureDate[1].split(":")[0];
- var minutes = pureDate[1].split(":")[1];
- var year = splittedPureDate[0];
- var month = splittedPureDate[1];
- var day = splittedPureDate[2];
- if(day.indexOf("0")==0){
- day = day.charAt(1);
- }
- if(month.indexOf("0")==0){
- month = month.charAt(1);
- }
- fixClockPointer.fix(hours,minutes);
- fixWidthsOfCarousel.fixRightPosition(hours,minutes);
- fixWidthsOfCarousel.fixCounterAmount(hours);
- fixWidthsOfCarousel.fix();
- },1000);
- }
- $rootScope.User=GeneralInit.User;
- lic.Device=deviceDetector;
- ProgressBarFcy.plus(0.2);
- lic.getChannels();
- ChannelFcy.getChannelNameFromDescriptor(lic.ChannelId).then(function(ChannelId){
- SecurityFcy.getToken().then(function (token){
- var StreamType = deviceDetector.device;
- if(deviceDetector.device=='android' || deviceDetector.device=='iphone' || deviceDetector.device=="ipad"){
- }
- else{
- if(Configs.Player.Live.DefaultPlayer=="RadiantPlayer"){
- StreamType = "android";
- }
- }
- ChannelSrv.getChannel(ChannelId,StreamType,token).then(function(result){
- lic.ChannelOriginalId=ChannelId;
- lic.Channel={};
- /*loadingControl.hideLoading();*/
- bigPlayButton.hideButton();
- lic.Channel.links=result;
- $rootScope.Page.Title="پخش زنده" +" "+$rootScope.ChannelIdToName(ChannelId);//(GeneralInit.Culture=="fa")?lic.Channel.title:lic.Channel.title_english;
- $rootScope.Page.Description="پخش زنده شبکه " + $rootScope.ChannelIdToName(ChannelId);
- $rootScope.Page.Keywords= "پخش زنده شبکه " + $rootScope.ChannelIdToName(ChannelId);
- debuger.info("Channel" + $rootScope.ChannelIdToName(ChannelId) + "data has arrived");
- $scope.liveChannel = $rootScope.ChannelIdToName(ChannelId);
- $rootScope.$broadcast("UserData");
- window.ChannelId = $routeParams.Id;
- lic.ChannelSettings.UpdateInProgress = false;
- lic.ChannelSettings.IsPlaying = true;
- EpisodeFcy.getChannelNewestEpisodes(ChannelId,lic.ChannelNewestEpisodes.Offset,lic.ChannelNewestEpisodes.Limit).then(function(result){
- lic.ChannelNewestEpisodes.Page++;
- if(lic.ChannelNewestEpisodes.Page==1){
- TwoRowsCarousel.CarouselInit("ThisChannelsLatest");
- }
- $timeout(function () {
- $("#ThisChannelsLatest").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- replaceBigThumbs.replace();
- },200);
- window.LiveChannelLatestEpisodes=result.length;
- window.LiveChannelLatestEpisodesTotal+=parseInt(window.LiveChannelLatestEpisodes);
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(lic.ChannelNewestEpisodes.Episodes);
- lic.ChannelNewestEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- lic.ChannelNewestEpisodes.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- })
- ProgressBarFcy.plus(0.2);
- });
- });
- });
- lic.getChannelHourlyArchiveEpisodes = function(Date,Channel){
- EpisodeFcy.getHourlyArchiveByChannel(Date,Channel).then(function(reuslt){
- lic.ChannelHourlyArchiveEpisodes.Page++;
- window.LiveChannelHourlyArchive=reuslt.length;
- window.LiveChannelHourlyArchiveTotal=parseInt(window.LiveChannelHourlyArchive);
- if(lic.ChannelHourlyArchiveEpisodes.Page>=1){
- TwoRowsCarousel.CarouselInit("HourlyArchive");
- }
- lic.ChannelHourlyArchiveEpisodes.Episodes=reuslt;
- });
- };
- lic.flagForInitHourlyArchive = false;
- lic.timeoutDetectionForHourlyArchive = '';
- $scope.$watch('updateHourlyArchive', function() {
- if(lic.flagForInitHourlyArchive){
- if(lic.timeoutDetectionForHourlyArchive)
- $timeout.cancel(lic.timeoutDetectionForHourlyArchive);
- lic.timeoutDetectionForHourlyArchive = $timeout(function(){
- lic.ChannelNewestEpisodes.UpdateInProgress = true;
- $timeout(function(){lic.ChannelNewestEpisodes.UpdateInProgress = false},3000);
- lic.timeoutDetectionForHourlyArchive = $timeout(function(){
- if(window.innerWidth > 1200){
- DestroySlick.destroy("#HourlyArchive .slick-carousel-apply");
- }
- $timeout(function(){TwoRowsCarousel.CarouselInit("HourlyArchive")},1500);
- lic.getChannelHourlyArchiveEpisodes($scope.updateHourlyArchive, document.getElementById('HourlyArchiveSelect').getAttribute('data-channelId'));
- },1000);
- },1000);
- }
- lic.flagForInitHourlyArchive = true;
- }, true);
- lic.LoadThePlayerWithHourlyArchive = function(link){
- if(DeviceDetection.IsAndroid() || DeviceDetection.IsSmartTv() || DeviceDetection.IsIos() || DeviceDetection.IsIpad()){
- jQuery("#MobileLiveQuality").hide();
- /*Player.Pause("MobileLivePlayer","VideoJs",true);*/
- var LivePlayer = document.getElementById("MobilePlayer_html5_api");
- LivePlayer.src = link;
- LivePlayer.src=link;
- LivePlayer.load();
- LivePlayer.play();
- /*var source = document.createElement('source');
- source.setAttribute('src', link);
- source.setAttribute('type', 'video/mp4');
- LivePlayer.appendChild(source);
- LivePlayer.play();*/
- }
- else {
- window.playerInstance.stop();
- jQuery("#liveQualityBar").hide();
- var flashvars = {
- src: escape(link),
- scaleMode: "stretch",
- javascriptCallbackFunction: "onJSBridge"
- };
- var params = {
- allowFullScreen: true, allowScriptAccess: "always", bgcolor: "#000000", wmode: 'opaque'
- };
- var attrs = {
- name: "Player"
- };
- swfobject.embedSWF(Configs.Player.Vod.OsfmSWFPath, Configs.Player.Vod.PlayerPlaceId, Configs.Player.Vod.PlayerWidth, Configs.Player.Vod.PlayerHeight, "10.2", null, flashvars, params, attrs);
- /*setTimeout(function(){
- window.LivePlayerInstance.play();
- },1000);*/
- }
- }
- $scope.$watch("lic.ChannelSettings.UpdateInProgress",function(){
- if(lic.ChannelSettings.UpdateInProgress==false){
- var MiladiDate = new Date();
- var ShamsiDate = new JDate(MiladiDate);
- ShamsiDate=ShamsiDate.toLocaleString().split(" ")[0].replace("/",'-').replace("/",'-');
- lic.getChannelHourlyArchiveEpisodes(ShamsiDate,lic.ChannelOriginalId);
- }
- });
- }
- function EpisodeCtrl(GeneralInit,$rootScope,EpisodeSrv,Messages,$routeParams,SiteConstants,SecurityFcy,ProgressBarFcy,EpisodeFcy,ProgramFcy,$filter,$scope,deviceDetector,ChannelFcy,FavoriteListSrv,$timeout,Configs){
- var epc= this;
- if(userAgent.isTelegram()){
- window.location = "http://www.telewebion.com/?_escaped_fragment_=/episode/"+$routeParams.Id;
- }
- $(".position-fix-carousel").scroll(function () {
- $(document).scroll()
- })
- $(document).on("click",".slick-next,.slick-prev",function () {
- $(document).scroll()
- setTimeout(function () {
- $(document).scroll()
- },600)
- })
- TopCarousel.initCarousel();
- epc.waitUntilEpisodeDataLoaded = false;
- window.EpisodeEpisodeOurRecommendationsTotal=0;
- window.EpisodeOtherProgramEpisodesTotal=0;
- epc.device=deviceDetector.device;
- epc.HasAdminAccess = false;
- epc.EpisodeFavoriteLists = null;
- epc.OurRecommendationData={Offset:0,Limit:19,UpdateInProgress:true,Episodes:[],Page:0};
- epc.ProgramOtherEpisodes={Offset:0,Limit:19,UpdateInProgress:true,Episodes:[],Page:0};
- epc.EpisodeMoments={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0};
- epc.EpisodeSettings = {UpdateInProgress:true,Valid:true};
- epc.ProgramOtherEpisodes.Episodes=[];
- $timeout(function () {
- $(".carousel-image-container img").each(function () {
- $(this).error(function () {
- if(!$(this).attr("data-replaced"))
- replacePipelineAddress.replace($(this));
- })
- })
- },600);
- epc.getOtherProgramEpisodes=function(){
- ProgramFcy.getOtherEpisodesOfThisProgram(epc.ProgramOtherEpisodes.Offset,epc.ProgramOtherEpisodes.Limit,epc.Episode.program_id).then(function(OtherProgramEpisodes){
- epc.ProgramOtherEpisodes.Page++;
- //loaded("EpisodeProgramOtherEpisodes");
- if(epc.ProgramOtherEpisodes.Page==1) {
- TwoRowsCarousel.CarouselInit("EpisodeOtherEpisodes");
- }
- $timeout(function () {
- $("#EpisodeOtherEpisodes").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- replaceBigThumbs.replace();
- },200);
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(OtherProgramEpisodes);
- tempArray2.push(epc.ProgramOtherEpisodes.Episodes);
- window.EpisodeOtherProgramEpisodes=OtherProgramEpisodes.length;
- window.EpisodeOtherProgramEpisodesTotal+=parseInt(window.EpisodeOtherProgramEpisodes);
- epc.ProgramOtherEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- epc.ProgramOtherEpisodes.UpdateInProgress=false;
- });
- }
- epc.ShowPlayer = function() {
- jQuery("#PlayThePlayer").hide();
- jQuery("#Player").show();
- jQuery('#videoHolder').hide();
- window.activePlayer = "MobileVodPlayer";
- window.activePlayerToolbarPlay='MobileVodPlayerToolbarPlayPause';
- window.playerType = 'VideoJs';
- if((DeviceDetection.IsAndroid() || DeviceDetection.IsIos() || DeviceDetection.IsSmartTv()) && !DeviceDetection.IsIpad()){
- /*Player.Play(null,null,true);*/
- // window.Play(0,true);
- }
- }
- window.EpisodeId = $routeParams.Id;
- epc.showNotAllowedToDownload= function(){
- NgNote.Error(Messages.Fa.NotAllowedToDownload,3);
- }
- epc.getEpisodeMoments = function(){
- EpisodeFcy.getEpisodeMoments($routeParams.Id).then(function(result){
- epc.EpisodeMoments.Episodes=result;
- if(result.length>0){
- if((DeviceDetection.IsAndroid() || DeviceDetection.IsIos() || DeviceDetection.IsSmartTv()) || DeviceDetection.IsIpad()){
- var player = document.getElementById("MobilePlayer");
- player.addEventListener("play", function(){$("#EpisodeMomentsHolder").show();}, false);
- }
- }
- });
- }
- epc.User=GeneralInit.User;
- $rootScope.User=GeneralInit.User;
- epc.CheckIfHasEditPermission = function () {
- SecurityFcy.userHasPermission(['admin','superadmin','operator']).then(function (result) {
- epc.HasAdminAccess = result;
- })
- }
- $rootScope.PlayerPath=GeneralInit.PlayerPath;
- $rootScope.PlayerLicenceKey=GeneralInit.PlayerLicenceKey;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.plus(0.2);
- $scope.showDate = '';
- $scope.showHour = '';
- SecurityFcy.getUserToken().then(function(userToken){
- SecurityFcy.getToken().then(function(token){
- EpisodeSrv.getEpisode($routeParams.Id,token,userToken).then(function(result){
- epc.Episode=result;
- if(result.program_types[0]+"" == "undefined"){
- catId = 13;
- }else{
- catId = result.program_types[0].id;
- }
- EpisodeFcy.getEpisodesByCategoryId(epc.OurRecommendationData.Offset,epc.OurRecommendationData.Limit,catId).then(function(OurRecommendations){
- epc.OurRecommendationData.Page++;
- //loaded("EpisodeOurRecommendations");
- if(epc.OurRecommendationData.Page==1){
- TwoRowsCarousel.CarouselInit("EpisodeOurRecommendations");
- }
- $timeout(function () {
- $("#EpisodeOurRecommendations").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- replaceBigThumbs.replace();
- },200);
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(OurRecommendations.data);
- tempArray2.push(epc.OurRecommendationData.Episodes);
- window.EpisodeEpisodeOurRecommendations=OurRecommendations.data.length;
- window.EpisodeEpisodeOurRecommendationsTotal+=parseInt(window.EpisodeEpisodeOurRecommendations);
- epc.OurRecommendationData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- epc.OurRecommendationData.UpdateInProgress=false;
- });
- /*loadingControl.hideLoading();*/
- bigPlayButton.hideButton();
- epc.tags = [];
- if(result.tags+"" != 'null') {
- epc.tags = result.tags.split(",");
- }else{
- epc.tags = null;
- }
- epc.waitUntilEpisodeDataLoaded = true;
- setTimeout(function () {
- $("#more-info-program").slideUp();
- $("#more-info-icon").find("i").eq(1).removeClass("fa-minus color-red-important").addClass("fa-plus");
- },6000);
- $(".episode-image img").each(function () {
- $(this).error(function () {
- if(!$(this).attr("data-replaced"))
- replacePipelineAddress.replace($(this));
- })
- })
- $timeout(function () {
- if(parseInt($(".summary-episode").height()) > 350){
- $(".read-more-description").addClass("inline-block-important");
- $(".summary-episode").addClass("height-320");
- $(document).on("click",".read-more-description",function () {
- if($(".summary-episode").hasClass("height-320")){
- $(".read-more-description").html("<i class='fa fa-angle-up'></i> کمتر");
- $(".summary-episode").removeClass("height-320");
- }else{
- $(".read-more-description").html("<i class='fa fa-angle-down'></i> بیشتر");
- $(".summary-episode").addClass("height-320");
- }
- })
- }
- },200);
- var showTime = epc.Episode.show_time.toString();
- var showTimeArray = showTime.split(" ");
- var dateFormat = showTimeArray[0].toString().replace("-","/");
- var dateFormat2 = dateFormat.replace("-","/");
- $scope.showDate = dateFormat2;
- if(showTimeArray[1] != null) {
- $scope.showHour = showTimeArray[1].toString();
- }else{
- $scope.showHour = 17+"";
- }
- if(!$rootScope.UserStatus.IsAuthenticated){
- epc.Episode.download_link=[];
- }
- window.EpisodeId=epc.Episode.id;
- $rootScope.Page.Description=(epc.Episode.program.is_singleton)?'':epc.Episode.program.title+epc.Episode.title;
- $rootScope.Page.Keywords=(epc.Episode.program.is_singleton)?'':epc.Episode.program.title+epc.Episode.title;
- $rootScope.$broadcast("UserData");
- var listOfChannels = ChannelFcy.getChannelDescriptorList();
- var idOfChannel = epc.Episode.program.channel_id;
- var counter =0;
- for(var i=0; i<listOfChannels.length; i++){
- var channelDescriptor = listOfChannels[i]+"";
- ChannelFcy.getChannelNameFromDescriptor(channelDescriptor).then(function (result) {
- if(result == idOfChannel){
- epc.Episode.program.channel_descriptor = listOfChannels[counter];
- }
- counter++;
- });
- }
- epc.Episode.view_count=$rootScope.ConvertToPersianNumber($filter('number')(epc.Episode.view_count));
- epc.Episode.title=$rootScope.ConvertToPersianNumber(epc.Episode.title);
- epc.Episode.program.title=$rootScope.ConvertToPersianNumber(epc.Episode.program.title);
- epc.Episode.show_time=$rootScope.ConvertToPersianNumber(epc.Episode.show_time);
- epc.Episode.program.channel_id=$rootScope.ConvertToPersianNumber($rootScope.ChannelIdToName(epc.Episode.program.channel_id));
- epc.EpisodeSettings.UpdateInProgress = false;
- epc.Episode.UpdateInProgress = false;
- if(epc.Episode.file_path=='' || epc.Episode.file_path=='undefined' || epc.Episode.file_path==null){
- epc.EpisodeSettings.Valid=false;
- }
- ProgressBarFcy.setDone();
- epc.EpisodeSettings.UpdateInProgress = false;
- $rootScope.Page.Title = epc.Episode.program.is_singleton?epc.Episode.program.title:epc.Episode.program.title+'-'+epc.Episode.title;
- if(epc.device == 'android' || epc.device == 'iphone'){
- }else{
- epc.ShowPlayer();
- }
- setTimeout(function () {
- var tags = result.tags;
- var rawKeywords = result.keywords_english;
- var commaKeywords = result.tags;
- if((rawKeywords+"").length>11){
- commaKeywords = rawKeywords.split("#").join();
- }
- var keywords = commaKeywords+","+tags;
- if(result.page_description != null)
- $rootScope.Page.Description=result.page_description+" , "+result.title;
- else
- $rootScope.Page.Description=result.title;
- $rootScope.Page.Keywords=keywords;
- },100);
- $timeout(function () {
- if((DeviceDetection.IsAndroid() || DeviceDetection.IsIos() || DeviceDetection.IsSmartTv()) && !DeviceDetection.IsIpad()) {
- epc.ShowPlayer();
- }
- },1000)
- })
- });
- });
- $scope.$watch("epc.EpisodeSettings.UpdateInProgress",function(){
- if(epc.EpisodeSettings.UpdateInProgress==false && epc.Episode!=='undefined' && epc.Episode.program!=null && epc.Episode.program.is_singleton==0){
- epc.getOtherProgramEpisodes();
- epc.getEpisodeMoments();
- epc.getEpisodeFavoriteLists();
- }
- });
- epc.getNext=function(type){
- if(type=='OurRecommendation'){
- epc.OurRecommendationData.Limit=((epc.OurRecommendationData.Page+1)==1)?50:50;
- epc.OurRecommendationData.Offset=((epc.OurRecommendationData.Page+1)==1)?0:((epc.OurRecommendationData.Page+1)*50)+50;
- epc.OurRecommendationData.UpdateInProgress=true;
- epc.getOurRecommendations();
- }
- else if(type=='OtherProgramEpisode'){
- epc.ProgramOtherEpisodes.Limit=((epc.ProgramOtherEpisodes.Page+1)==1)?50:50;
- epc.ProgramOtherEpisodes.Offset=((epc.ProgramOtherEpisodes.Page+1)==1)?0:((epc.ProgramOtherEpisodes.Page+1)*50)+50;
- epc.ProgramOtherEpisodes.UpdateInProgress=true;
- epc.getOtherProgramEpisodes();
- }
- }
- window.getNextEpisode=epc.getNext;
- epc.getPosterImage = function(program,size){
- switch (program){
- case 42911:
- return "/images/poster/"+size+"_25637.jpg";
- break;
- case 449973:
- return "/images/poster/"+size+"_25637.jpg";
- break;
- case 45958:
- return "/images/poster/"+size+"_45655.jpg";
- break;
- case 45954:
- case 47451:
- result.program_types.id
- case 46676:
- case 43028:
- case 44997:
- case 25637:
- case 39893:
- case 44162:
- case 45655:
- case 3959:
- case 37728:
- case 5709:
- return "/images/poster/"+size+"_"+program+".jpg";
- break;
- default:
- return "/media/img/poster.jpg";
- break
- }
- }
- epc.GenerateDownloadLink=function(){
- window.location.href="http://downloadproxy.telewebion.com/download?cdn=1&episode_id="+$scope.Episode.id+"&token="+$scope.User.sdt;
- }
- epc.JumpToSecond = function(second){
- if(DeviceDetection.IsAndroid() || DeviceDetection.IsIos() || DeviceDetection.IsSmartTv() || DeviceDetection.IsIpad()){
- var playerz = document.getElementById("MobilePlayer_html5_api");
- setTimeout(function(){playerz.currentTime = second;},200);
- }else{
- if(Configs.Player.Vod.DefaultPlayer=="RadiantPlayer"){
- window.playerInstance.seekTo(second*1000);
- }
- else if(Configs.Player.Vod.DefaultPlayer=="OsmfPlayer") {
- var player = document.getElementById("ply");
- player.seek(second);
- }
- }
- }
- epc.getEpisodeFavoriteLists = function () {
- FavoriteListSrv.getFavoriteListByEpisode($routeParams.Id).then(function (result) {
- var spliceList = [];
- var index = 0;
- result.forEach(function (item) {
- var remove = true;
- for (var i = item.length-1;i>0;i--){
- if(item[i].parent != result[index][i].parent){
- remove = false;
- }
- }
- index++;
- if(remove){
- if(index != 1) {
- spliceList.push(index-1);
- }
- }
- })
- if(spliceList.length > 0) {
- for(var j = 0; j<spliceList.length;j++) {
- var size = result.length;
- result[spliceList[j]-1]=null;
- }
- }
- for(var k = 0;k<result.length;k++){
- result.splice(result.indexOf(null),result.indexOf(null)+1);
- }
- epc.EpisodeFavoriteLists = result;
- })
- }
- setTimeout(function () {
- epc.CheckIfHasEditPermission();
- },1000);
- }
- function ProgramCtrl(GeneralInit,$rootScope,ProgramSrv,Messages,$routeParams,SiteConstants,SecurityFcy,ProgressBarFcy,ProgramFcy,$scope,ChannelFcy,$timeout){
- var pgc= this;
- TopCarousel.initCarousel();
- $(".position-fix-carousel").scroll(function () {
- $(document).scroll()
- })
- $(document).on("click",".slick-next,.slick-prev",function () {
- $(document).scroll()
- setTimeout(function () {
- $(document).scroll()
- },600)
- })
- pgc.HasAdminAccess = false;
- pgc.waitUntilEpisodeDataLoaded = false;
- pgc.CheckIfHasEditPermission = function () {
- SecurityFcy.userHasPermission(['admin','superadmin','operator']).then(function (result) {
- pgc.HasAdminAccess = result;
- })
- };
- window.ProgramOtherProgramEpisodesTotal=0;
- /*pgc.Program={};*/
- /*pgc.OurRecommendationData={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0};*/
- pgc.ProgramOtherEpisodes={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0};
- pgc.ProgramSettings = {UpdateInProgress:true,Valid:true};
- /*pgc.getOurRecommendations=function(){
- EpisodeFcy.getOurRecommendations(pgc.OurRecommendationData.Offset,pgc.OurRecommendationData.Limit).then(function(OurRecommendations){
- pgc.OurRecommendationData.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(OurRecommendations);
- tempArray2.push(pgc.OurRecommendationData.Episodes);
- pgc.OurRecommendationData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- pgc.OurRecommendationData.UpdateInProgress=false;
- });
- }*/
- var flagForTryOnce = true;
- $(".replace-on-error").error(function () {
- if(flagForTryOnce) {
- setTimeout(function () {
- $(".replace-on-error").attr("src", pgc.ProgramOtherEpisodes.Episodes[0].picture_path);
- flagForTryOnce = false;
- },500)
- }
- })
- pgc.getOtherProgramEpisodes=function(){
- ProgramFcy.getOtherEpisodesOfThisProgram(pgc.ProgramOtherEpisodes.Offset,pgc.ProgramOtherEpisodes.Limit,$routeParams.Id).then(function(OtherProgramEpisodes){
- /*loaded("ProgramEpisodes");*/
- pgc.ProgramOtherEpisodes.Page++;
- window.ProgramOtherProgramEpisodes=OtherProgramEpisodes.length;
- window.ProgramOtherProgramEpisodesTotal+=parseInt(window.ProgramOtherProgramEpisodes);
- if(pgc.ProgramOtherEpisodes.Page==1){
- TwoRowsCarousel.CarouselInit("ProgramOtherEpisodes");
- }
- $timeout(function () {
- $("#ProgramOtherEpisodes").find("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn"
- });
- },200);
- $timeout(function () {
- replaceBigThumbs.replace();
- },800)
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(OtherProgramEpisodes);
- tempArray2.push(pgc.ProgramOtherEpisodes.Episodes);
- pgc.ProgramOtherEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- pgc.ProgramOtherEpisodes.UpdateInProgress=false;
- });
- }
- pgc.User=GeneralInit.User;
- $rootScope.User=GeneralInit.User;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.plus(0.2);
- ProgramSrv.getProgram($routeParams.Id).then(function(result){
- if(result.is_singleton){
- debuger.info("Program was singleton and was redirected to its episode page");
- window.location.assign("/#!/fa/episode/"+result.singleton_episode_id);
- }
- pgc.waitUntilEpisodeDataLoaded = true;
- setTimeout(function () {
- $("#more-info-program").slideUp();
- $("#more-info-icon-program > i:last-of-type").removeClass("fa-minus color-red-important").addClass("fa-plus");
- },6000);
- pgc.Program = result;
- $rootScope.Page.Description=pgc.Program.title;
- $rootScope.Page.Keywords=pgc.Program.title;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- $rootScope.Page.Title=pgc.Program.title;
- pgc.ProgramSettings.UpdateInProgress=false;
- pgc.tags = [];
- if(result.tags+"" != 'null') {
- pgc.tags = result.tags.split(",");
- }else{
- pgc.tags = null;
- }
- setTimeout(function () {
- var tags = result.tags;
- var rawKeywords = result.keywords_english;
- var commaKeywords = result.tags;
- if((rawKeywords+"").length>11){
- commaKeywords = rawKeywords.split("#").join();
- }
- var keywords = commaKeywords+","+tags;
- if(result.page_description != null)
- $rootScope.Page.Description=result.page_description+" , "+result.title;
- else
- $rootScope.Page.Description=result.title;
- $rootScope.Page.Keywords=keywords;
- },100);
- });
- $scope.$watch("pgc.ProgramSettings.UpdateInProgress",function(){
- if(pgc.ProgramSettings.UpdateInProgress==false){
- pgc.getOtherProgramEpisodes();
- }
- });
- pgc.ChannelIdToName = function(id){
- switch (id){
- case 1:
- return "شبکه 1";
- break;
- case 2:
- return "شبکه 2";
- break;
- case 45:
- return "شبکه امید";
- break;
- case 3:
- return "شبکه 3";
- break;
- case 4:
- return "شبکه 4";
- break;
- case 5:
- return "شبکه 5";
- break;
- case 6:
- return "شبکه خبر";
- break;
- case 7:
- return "شبکه آموزش";
- break;
- case 8:
- return "شبکه پویا";
- break;
- case 9:
- return "شبکه IFilm";
- break;
- case 10:
- return "شبکه نمایش";
- break;
- case 11:
- return "شبکه تماشا";
- break;
- case 12:
- return "شبکه جام جم 1";
- break;
- case 13:
- return "شبکه ورزش";
- break;
- case 18:
- return "پرشین تونز";
- break;
- case 19:
- return "شبکه مستند سیما";
- break;
- case 20:
- return "شبکه قرآن";
- break;
- case 21:
- return "شبکه سلامت";
- break;
- case 22:
- return "شبکه جام جم 2";
- break;
- case 23:
- return "شبکه جام جم 3";
- break;
- case 24:
- return "شبکه شما";
- break;
- case 25:
- return "شبکه بازار";
- break;
- case 29:
- return "IFilm English";
- break;
- case 30:
- return "شبکه اصفهان";
- break;
- case 31:
- return "شبکه سهند";
- break;
- case 32:
- return "شبکه فارس";
- break;
- case 33:
- return "شبکه خوزستان";
- break;
- case 34:
- return "شبکه باران";
- break;
- case 35:
- return "سینمای خانگی";
- break;
- case 36:
- return "شبکه سمنان";
- break;
- case 37:
- return "شبکه آفتاب";
- break;
- case 38:
- return "شبکه افلاک";
- break;
- case 39:
- return "شبکه کردستان";
- break;
- case 40:
- return "شبکه خلیج فارس";
- break;
- case 41:
- return "شبکه نسیم";
- break;
- case 42:
- return "شبکه افق";
- break;
- case 43:
- return "شبکه HD";
- break;
- }
- }
- pgc.CheckIfHasEditPermission();
- pgc.getGeneralPosterImage = function(category,size){
- switch (category){
- case 8:
- case 9:
- case 10:
- case 11:
- case 18:
- case 17:
- return "/images/category/"+size+'_movies.jpg';
- break;
- case 7:
- case 13:
- case 16:
- case 21:
- case 20:
- case 19:
- case 15:
- return "/images/category/"+size+'_news.jpg';
- break;
- case 12:
- return "/images/category/"+size+'_cartoon.jpg';
- break;
- case 14:
- return "/images/category/"+size+'_sport.jpg';
- break;
- }
- }
- window.counterImagePoster = 1;
- pgc.getPosterImage = function(program,size,category) {
- var countLimit = 6;
- if (!isNaN(program) && parseInt(countLimit) > window.counterImagePoster) {
- window.counterImagePoster+=1;
- switch (program) {
- case 42911:
- case 25637:
- return "/images/poster/" + size + "_25637.jpg";
- break;
- case 47451:
- return "/images/poster/" + size + "_47451.jpg";
- break;
- case 44997:
- return "/images/poster/" + size + "_44997.jpg";
- break;
- case 45958:
- return "/images/poster/" + size + "_45655.jpg";
- break;
- case 46676:
- return "/images/poster/" + size + "_"+program+".jpg";
- break;
- case 37728:
- return "/images/poster/" + size + "_"+program+".jpg";
- break;
- case 44162:
- case 43194:
- return "/images/poster/" + size + "_" + '44162' + ".jpg";
- break;
- default:
- if(pgc.getGeneralPosterImage(category,size)) {
- return pgc.getGeneralPosterImage(category, size);
- }else{
- setTimeout(function(){
- return pgc.getGeneralPosterImage(category, size);
- },500)
- }
- break;
- }
- }
- }
- }
- function RegisterCtrl(GeneralInit,UserSrv,Messages,$rootScope,SiteConstants,ProgressBarFcy){
- var urg= this;
- urg.User={};//GeneralInit.User;
- $rootScope.Page.Title=(GeneralInit.Culture=="fa")?SiteConstants.Fa.PageTitle.Register:SiteConstants.En.PageTitle.Register;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- urg.Registration={Status:"NoAction"};
- urg.Login={Status:"NoAction"};
- urg.phoneNumberStatus = false;
- urg.Register=function(){
- urg.Registration.Status="InProgress";
- UserSrv.registerUser(urg.User).then(function (result) {
- if (result.state == 1) {
- urg.Registration.Status = "NoAction";
- urg.Registration.ErrorMessage = Messages.Fa.DuplicatedEmailRegistration;
- }
- else if (result.state == 2) {
- urg.Registration.Status = "SuccessfulAction";
- urg.Registration.ErrorMessage = Messages.Fa.SuccessfulRegistration;
- urg.User = {};
- }
- else if (result.state == 3) {
- urg.Registration.Status = "SuccessfulAction";
- urg.Registration.ErrorMessage = Messages.Fa.SuccessfulRegistration;
- urg.User = {};
- }
- else if (result.state == 0) {
- urg.Registration.Status = "NoAction";
- urg.Registration.ErrorMessage = Messages.Fa.FailedRegistration;
- }
- else if (result.state == -1) {
- urg.Registration.Status = "NoAction";
- urg.Registration.ErrorMessage = Messages.Fa.FailedRegistration;
- }
- urg.phoneNumberStatus = false;
- });
- }
- urg.DoLogin=function(){
- urg.Login.Status="InProgress";
- UserSrv.loginUser(urg.User).then(function(result){
- if(result && typeof result=='object')
- {
- urg.Login.Status="SuccessfulAction";
- $window.location.replace("/#!/");
- urg.Login.ErrorMessage=Messages.Fa.SuccessfulLogin;
- }
- else
- {
- urg.Login.Status="NoAction";
- urg.Login.ErrorMessage=Messages.Fa.FailedLogin;
- }
- });
- }
- }
- function SearchCtrl(GeneralInit,$routeParams,SearchFcy,$rootScope,SiteConstants,ProgressBarFcy){
- var src= this;
- src.Context=$routeParams.SearchContext;
- src.SearchEpisodes={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0};
- src.SearchPrograms={Offset:0,Limit:10,UpdateInProgress:true,Page:0,Programs:[]};
- $rootScope.Page.SearchContext='';
- src.getSearchResult = function(JustEpisodes){
- if(!JustEpisodes){
- SearchFcy.getPrograms(src.Context,src.SearchPrograms.Offset,src.SearchPrograms.Limit).then(function(result){
- src.SearchPrograms.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(src.SearchPrograms.Programs);
- src.SearchPrograms.Programs = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- src.SearchPrograms.UpdateInProgress=false;
- ProgressBarFcy.plus(0.2);
- });
- }
- SearchFcy.getEpisodes(src.Context,src.SearchEpisodes.Offset,src.SearchEpisodes.Limit).then(function(result){
- src.SearchEpisodes.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(src.SearchEpisodes.Episodes);
- src.SearchEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- src.SearchEpisodes.UpdateInProgress=false;
- if(src.SearchEpisodes.Page<2){
- ProgressBarFcy.plus(0.4);
- }
- });
- }
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.Search+src.Context;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.plus(0.2);
- src.getNext=function(type){
- type = type?type:"Search";
- if(type=='Search'){
- src.SearchEpisodes.UpdateInProgress = true;
- src.SearchEpisodes.Limit=((src.SearchEpisodes.Page+1)==1)?50:50;
- src.SearchEpisodes.Offset=((src.SearchEpisodes.Page+1)==1)?0:((src.SearchEpisodes.Page)*50);
- src.getSearchResult(true);
- }
- }
- src.getSearchResult(false);
- }
- function TestCtrl(GeneralInit,EpisodeFcy){
- var tst= this;
- tst.MovieData={Offset:0,Limit:70,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- tst.getMovies=function(){
- EpisodeFcy.getMovies(tst.MovieData.Offset,tst.MovieData.Limit).then(function(Movies){
- tst.MovieData.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(Movies);
- tempArray2.push(tst.MovieData.Episodes);
- tst.MovieData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- tst.MovieData.UpdateInProgress=false;
- });
- }
- tst.getMovies();
- //this is for test
- }
- function ResetPasswordCtrl(GeneralInit,UserSrv,Messages,$rootScope,SiteConstants,ProgressBarFcy,$routeParams){
- var rpc = this;
- rpc.User={};
- rpc.ValidateStatus={InProgress:true,IsValid:false}
- UserSrv.validateResetPasswordToken($routeParams.token).then(function(result){
- rpc.ValidateStatus.InProgress=false;
- if(result.status_code==1){
- rpc.ValidateStatus.IsValid=true;
- }
- else{
- NgNote.Error(result.status_message,3);
- }
- });
- rpc.DoRequest= function(){
- if(rpc.Password==rpc.ConfirmPassword){
- UserSrv.resetPassword($routeParams.token,rpc.User.Password).then(function(resetResult){
- if(resetResult.status_code==1){
- NgNote.Success(resetResult.status_message,5);
- }
- else{
- NgNote.Error(resetResult.status_message,3);
- }
- });
- }
- }
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.ResetPassword;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- }
- function CategoryCtrl(GeneralInit,EpisodeFcy,$routeParams,$rootScope,SiteConstants,ProgressBarFcy){
- var ctc= this;
- ctc.CategoryId=$routeParams.Id;
- ctc.CategoryPageTitle = function(categoryId){
- var title=null;
- switch (categoryId){
- case '110':
- title="کلیپ های پیشنهادی ما";
- break;
- case '111':
- title="لیست فیلم ها";
- break;
- case '112':
- title="جدیدترین کلیپ های روز";
- break;
- case '113':
- title="آرشیو سریال ها";
- break;
- case '114':
- title="کلیپ های پیشنهادی کاربران";
- break;
- case '115':
- title="فیلم ها و کارتون های برگزیده کودکان";
- break;
- default:
- title="دیگر قسمت های این برنامه";
- break;
- }
- return title ;
- }
- ctc.Category={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0,IsPoster:false};
- switch (parseInt(ctc.CategoryId)){
- case 6:
- break;
- default:
- break;
- }
- ctc.getCategoryEpisodes = function(){
- EpisodeFcy.getCategoryEpisodes(ctc.CategoryId,ctc.Category.Offset,ctc.Category.Limit).then(function(result){
- ctc.Category.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(ctc.Category.Episodes);
- ctc.Category.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- ctc.Category.UpdateInProgress=false;
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- ProgressBarFcy.setDone();
- });
- }
- $rootScope.Page.Title=ctc.CategoryPageTitle(ctc.CategoryId);
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.plus(0.2);
- ctc.getNext=function(){
- ctc.Category.UpdateInProgress = true;
- ctc.Category.Limit=((ctc.Category.Page+1)==1)?50:50;
- ctc.Category.Offset=((ctc.Category.Page+1)==1)?0:((ctc.Category.Page)*50);
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- ctc.getCategoryEpisodes();
- }
- ctc.getCategoryEpisodes();
- }
- function ChannelsCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,ChannelFcy){
- var clc= this;
- clc.Channels={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0};
- clc.getChannels = function(){
- ChannelFcy.getChannels().then(function(result){
- clc.Channels.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(clc.Channels.Episodes);
- clc.Channels.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- clc.Channels.UpdateInProgress=false;
- ProgressBarFcy.setDone();
- });
- }
- $rootScope.Page.Title="مشاهده لیست کانال های تلوزیونی";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.plus(0.2);
- clc.getChannels();
- }
- function ChangeLogCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy){
- $rootScope.Page.Title="نظرات و پیشنهادات";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- }
- function TermsCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy){
- $rootScope.Page.Title="قوانین و مقررات";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- }
- function profileCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy){
- $rootScope.Page.Title="قوانین و مقررات";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- }
- function fourOfourCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,EpisodeFcy){
- var foc = this;
- $rootScope.Page.Title="صفحه مورد نظر یافت نشد";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- foc.OurRecommendationData={Offset:0,Limit:8,UpdateInProgress:true,Channels:[],Page:1,MaximumPage:0,tempColumn:0,Episodes:[]};
- foc.OurRecommendations = function() {
- EpisodeFcy.getOurRecommendations(foc.OurRecommendationData.Offset, foc.OurRecommendationData.Limit).then(function (data) {
- foc.OurRecommendationData.Episodes=data;
- foc.OurRecommendationData.UpdateInProgress=false;
- });
- }
- foc.OurRecommendations();
- }
- function paymentConfirmationCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy){
- $rootScope.Page.Title="قوانین و مقررات";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- }
- function DmcaCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy){
- $rootScope.Page.Title="حقوق مولفین و مصنفین";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- }
- function ArchiveCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,ChannelFcy,EpisodeFcy,$routeParams){
- var arc = this;
- arc.ChannelDescriptor = $routeParams.Id;
- $rootScope.Page.Title="آرشیو برنامه های این شبکه";
- arc.ChannelEpisodes={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0};
- arc.ChannelEpisodes.Page = 0;
- $rootScope.$broadcast("UserData");
- arc.getNewest = function(){
- ChannelFcy.getChannelNameFromDescriptor(arc.ChannelDescriptor).then(function(ChannelId){
- EpisodeFcy.getChannelNewestEpisodes(ChannelId,arc.ChannelEpisodes.Offset,arc.ChannelEpisodes.Limit).then(function(results){
- arc.ChannelEpisodes.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(results);
- tempArray2.push(arc.ChannelEpisodes.Episodes);
- arc.ChannelEpisodes.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- arc.ChannelEpisodes.UpdateInProgress=false;
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- if(arc.ChannelEpisodes.Page<2){
- ProgressBarFcy.plus(0.4);
- }
- });
- })
- }
- arc.getNext=function(){
- arc.ChannelEpisodes.Limit=((arc.ChannelEpisodes.Page+1)==1)?50:50;
- arc.ChannelEpisodes.Offset=((arc.ChannelEpisodes.Page+1)==1)?0:((arc.ChannelEpisodes.Page-1)*50)+50;
- arc.ChannelEpisodes.UpdateInProgress=true;
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- arc.getNewest();
- }
- ProgressBarFcy.plus(0.3);
- arc.getNewest();
- }
- function JobOpportunityCtrl($rootScope,SiteConstants,ProgressBarFcy){
- $rootScope.Page.Title= SiteConstants.Fa.PageTitle.JobOpportunity;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- }
- function VerifyRegistrationCtrl($rootScope,GeneralInit,UserSrv,Messages,SiteConstants,ProgressBarFcy,$routeParams,$scope){
- var vrc = this;
- vrc.Messages='';
- vrc.RequestStatus={InProgress:true}
- if(typeof $routeParams.Username!==null && typeof $routeParams.Username!=='undefined' && typeof $routeParams.VCode!==null && typeof $routeParams.VCode!=='undefined' && typeof $routeParams.HMail!==null && typeof $routeParams.HMail!=='undefined'){
- UserSrv.VerifyRegistration($routeParams.Username,$routeParams.VCode,$routeParams.HMail).then(function(result){
- vrc.Status = typeof result.status_code!==null && typeof result.status_code!=='undefined'?result.status_code:null;
- $scope.$watch('vrc.Status', function(){
- if(vrc.Status!==null && typeof vrc.Status!=='undefined'){
- if(vrc.Status==1){
- vrc.Message=Messages.Fa.AccountVerificationSuccess;
- vrc.RequestStatus.InProgress=false;
- }
- else{
- vrc.Message=Messages.Fa.AccountVerificationFailed;
- vrc.RequestStatus.InProgress=false;
- }
- }
- });
- });
- }
- $rootScope.Page.Title= SiteConstants.Fa.PageTitle.ConfirmRegistration;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- }
- function ResendActivationEmailCtrl(GeneralInit,UserSrv,Messages,$rootScope,SiteConstants,ProgressBarFcy){
- var rpc= this;
- $rootScope.Page.Title= SiteConstants.Fa.PageTitle.ResendActivationEmail;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- rpc.ForgotPassword={Status:"NoAction"};
- rpc.DoRequest=function(){
- rpc.ForgotPassword.Status="InProgress";
- UserSrv.forgotPasswordUser(rpc.User).then(function(result){
- if(result==1)
- {
- rpc.ForgotPassword.Status="SuccessfulAction";
- }
- else if(result==2)
- {
- rpc.ForgotPassword.Status="InProgress";
- }
- else if(result==3)
- {
- rpc.ForgotPassword.Status="InProgress";
- }
- });
- }
- }
- function LigeBartarCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy,FavoriteListSrv,$scope,FavoriteListFcy,$timeout) {
- var lbc = this;
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.LigeBartar95;
- lbc.fullGames = {Offset:0,Limit:26,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- lbc.highlights = {Offset:0,Limit:26,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- lbc.leagueOne = {Offset:0,Limit:26,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- lbc.selection = {Offset:0,Limit:26,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- lbc.sides = {Offset:0,Limit:26,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- lbc.ChildTags = {Offset:0,Limit:26,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- lbc.navadAndFootballNights = {Offset:0,Limit:26,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- $scope.applyChanges = function (selectedItem) {
- lbc.getEpisodes = function () {
- lbc.fullGames.UpdateInProgress = true;
- ProgressBarFcy.setDone();
- FavoriteListFcy.getEpisodeList(selectedItem+"", lbc.fullGames.Offset, lbc.fullGames.Limit).then(function (result) {
- DestroySlickGeneral.destroy("full-games-league-carousel")
- lbc.fullGames.Episodes = result;
- TwoRowsCarousel.CarouselInit("full-games-league-carousel");
- $timeout(function () {
- $(".carousel-image-container img").each(function () {
- $(this).error(function () {
- if (!$(this).attr("data-replaced"))
- replacePipelineAddress.replace($(this));
- })
- })
- }, 200);
- $timeout(function () {
- lbc.fullGames.UpdateInProgress = false;
- },1000)
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- }, 200);
- })
- }
- lbc.getEpisodes();
- }
- lbc.getFullGamesChildTags = function () {
- lbc.ChildTags.UpdateInProgress = true;
- FavoriteListSrv.getChildList('400407', lbc.ChildTags.Offset, lbc.ChildTags.Limit).then(function (result) {
- lbc.ChildTags.Items = result;
- lbc.ChildTags.UpdateInProgress = false;
- $timeout(function () {
- $("#full-games-weeks > option:first-of-type").remove()
- }, 500)
- $timeout(function () {
- replaceBigThumbs.replace();
- },800)
- })
- }
- lbc.getFullGames = function () {
- EpisodeFcy.getCustom('400407',lbc.fullGames.Offset,lbc.fullGames.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("full-games-league-carousel");
- lbc.fullGames.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(lbc.fullGames.Episodes);
- window.fullGames=result.length;
- lbc.fullGames.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- lbc.fullGames.UpdateInProgress=false;
- if(lbc.fullGames.Page==1){
- ProgressBarFcy.plus(0.1);
- ProgressBarFcy.plus(0.1);
- }
- setTimeout(function () {
- replaceBigThumbs.replace();
- },800)
- })
- };
- lbc.getLeagueOneGames = function () {
- EpisodeFcy.getCustom('404867',lbc.leagueOne.Offset,lbc.leagueOne.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("league-one-carousel");
- lbc.leagueOne.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(lbc.leagueOne.Episodes);
- window.leagueOne=result.length;
- lbc.leagueOne.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- lbc.leagueOne.UpdateInProgress=false;
- if(lbc.leagueOne.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- setTimeout(function () {
- replaceBigThumbs.replace();
- },800)
- })
- };
- lbc.getHighlights = function () {
- EpisodeFcy.getCustom('400408',lbc.highlights.Offset,lbc.highlights.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("highlights-carousel");
- lbc.highlights.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(lbc.highlights.Episodes);
- window.highlights=result.length;
- lbc.highlights.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- lbc.highlights.UpdateInProgress=false;
- if(lbc.highlights.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- setTimeout(function () {
- replaceBigThumbs.replace();
- },800)
- })
- };
- lbc.getSelections = function () {
- EpisodeFcy.getCustom('400411',lbc.selection.Offset,lbc.selection.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("selection-carousel");
- lbc.selection.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(lbc.selection.Episodes);
- window.selection=result.length;
- lbc.selection.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- lbc.selection.UpdateInProgress=false;
- if(lbc.selection.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- setTimeout(function () {
- replaceBigThumbs.replace();
- },800)
- })
- };
- lbc.getSides = function () {
- EpisodeFcy.getCustom('400412',lbc.sides.Offset,lbc.sides.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("news-carousel");
- lbc.sides.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(lbc.sides.Episodes);
- window.sides=result.length;
- lbc.sides.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- lbc.sides.UpdateInProgress=false;
- if(lbc.sides.Page==1){
- ProgressBarFcy.plus(0.1);
- ProgressBarFcy.plus(0.1);
- }
- setTimeout(function () {
- replaceBigThumbs.replace();
- },800)
- })
- };
- lbc.getFootballPrograms = function () {
- EpisodeFcy.getCustom('400409',lbc.navadAndFootballNights.Offset,lbc.navadAndFootballNights.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("navad-carousel");
- lbc.navadAndFootballNights.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(lbc.navadAndFootballNights.Episodes);
- window.navadAndFootballNights=result.length;
- lbc.navadAndFootballNights.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- lbc.navadAndFootballNights.UpdateInProgress=false;
- if(lbc.navadAndFootballNights.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- setTimeout(function () {
- replaceBigThumbs.replace();
- },800)
- })
- };
- lbc.getSlider = function () {
- SliderFcy.getleague().then(function (result) {
- lbc.Sliders=result;
- ProgressBarFcy.plus(0.1);
- TopCarousel.initCarousel();
- })
- };
- lbc.getSlider();
- lbc.getFullGames();
- lbc.getFootballPrograms();
- lbc.getHighlights();
- lbc.getSides();
- lbc.getSelections();
- lbc.getFullGamesChildTags();
- lbc.getLeagueOneGames();
- }
- function Ramezan95Ctrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy) {
- var rmc = this;
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.ramezan95;
- rmc.TvSeriesData={Offset:0,Limit:200,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- rmc.DoasData={Offset:0,Limit:200,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- rmc.QuransData={Offset:0,Limit:200,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- rmc.QadrsData={Offset:0,Limit:200,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- rmc.SpecialProgramsData={Offset:0,Limit:200,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- rmc.MahAsalData={Offset:0,Limit:200,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- rmc.getSlider = function () {
- SliderFcy.getRamezan95().then(function (result) {
- rmc.Sliders=result;
- ProgressBarFcy.plus(0.1);
- TopCarousel.initCarousel();
- })
- }
- rmc.getTvSeries = function () {
- EpisodeFcy.getCustom('385501',rmc.TvSeriesData.Offset,rmc.TvSeriesData.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("series-carousel");
- rmc.TvSeriesData.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(rmc.TvSeriesData.Episodes);
- window.HomeCustom1=result.length;
- rmc.TvSeriesData.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- rmc.TvSeriesData.UpdateInProgress=false;
- if(rmc.TvSeriesData.Page==1){
- ProgressBarFcy.plus(0.1);
- ProgressBarFcy.plus(0.1);
- }
- })
- }
- rmc.getDoas = function () {
- EpisodeFcy.getCustom('385497',rmc.DoasData.Offset,rmc.DoasData.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("pray-carousel");
- rmc.DoasData.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(rmc.DoasData.Episodes);
- window.HomeCustom1=result.length;
- rmc.DoasData.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- rmc.DoasData.UpdateInProgress=false;
- if(rmc.DoasData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- })
- }
- rmc.getQurans =function () {
- EpisodeFcy.getCustom('385499',rmc.QuransData.Offset,rmc.QuransData.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("quran-carousel")
- rmc.QuransData.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(rmc.QuransData.Episodes);
- window.HomeCustom1=result.length;
- rmc.QuransData.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- rmc.QuransData.UpdateInProgress=false;
- if(rmc.QuransData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- })
- }
- rmc.getQadrs= function () {
- EpisodeFcy.getCustom('385500',rmc.QadrsData.Offset,rmc.QadrsData.Limit).then(function (result) {
- rmc.QadrsData.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(rmc.QadrsData.Episodes);
- window.HomeCustom1=result.length;
- rmc.QadrsData.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- TwoRowsCarousel.CarouselInit("qadr-carousel");
- rmc.QadrsData.UpdateInProgress=false;
- if(rmc.QadrsData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- })
- }
- rmc.getSpecialPrograms = function () {
- EpisodeFcy.getCustom('385503',rmc.SpecialProgramsData.Offset,rmc.SpecialProgramsData.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("pray-day-carousel");
- rmc.SpecialProgramsData.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(rmc.SpecialProgramsData.Episodes);
- window.HomeCustom1=result.length;
- rmc.SpecialProgramsData.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- rmc.SpecialProgramsData.UpdateInProgress=false;
- if(rmc.SpecialProgramsData.Page==1){
- ProgressBarFcy.plus(0.1);
- ProgressBarFcy.plus(0.1);
- }
- })
- }
- rmc.getMahAsalItems = function () {
- EpisodeFcy.getCustom('385502',rmc.MahAsalData.Offset,rmc.MahAsalData.Limit).then(function (result) {
- TwoRowsCarousel.CarouselInit("moon-carousel");
- rmc.MahAsalData.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(rmc.MahAsalData.Episodes);
- window.HomeCustom1=result.length;
- rmc.MahAsalData.Episodes = result;
- tempArray.length = 0;
- tempArray2.length = 0;
- rmc.MahAsalData.UpdateInProgress=false;
- if(rmc.MahAsalData.Page==1){
- ProgressBarFcy.plus(0.1);
- ProgressBarFcy.plus(0.1);
- }
- })
- }
- rmc.getSlider();
- rmc.getTvSeries();
- rmc.getMahAsalItems();
- rmc.getSpecialPrograms();
- rmc.getQurans();
- rmc.getDoas();
- rmc.getQadrs();
- }
- function oauthLoginCtrl($routeParams,SecurityFcy,Messages,$window,ProgressBarFcy){
- ProgressBarFcy.setDone();
- SecurityFcy.setCookieByToken($routeParams.token);
- $window.opener.location ='/#!/?ls=su';
- setTimeout(function(){
- open(location, '_self').close();
- window.open('', '_self', '');
- $window.close();
- top.window.close();
- window.open("about:blank", "_self").close();
- },550);
- }
- function AdsBankEditCtrl($rootScope,AdsFcy,AdsSrv,ProgressBarFcy,SecurityFcy,UserSrv,AdBankFcy,AdBankSrv,$routeParams,$window){
- var abe = this;
- var Id = $routeParams.Id;
- abe.AdBank = {UpdateInProgress:true}
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- SecurityFcy.getUserToken().then(function (token) {
- AdBankFcy.getAdBankById(Id,token).then(function (data) {
- ProgressBarFcy.setDone();
- abe.AdBank = data;
- if(abe.AdBank.target.indexOf("vod") >= 0){
- $("#vod").click();
- }
- if(abe.AdBank.target.indexOf("live") >= 0){
- $("#live").click();
- }
- if(abe.AdBank.for_iranian == 1){
- $("#forIranian").click();
- }
- if(abe.AdBank.enable == 1){
- $("#Enable").click();
- }
- })
- })
- abe.SaveAdBank = function () {
- var id = Id;
- var target_array = [];
- if($("#vod").is(":checked")){
- target_array.push("vod");
- }
- if($("#live").is(":checked")){
- target_array.push("live");
- }
- var target = target_array.join();
- var forIranian = 0;
- if($("#forIranian").is(":checked")){
- forIranian = 1;
- }
- var enable = 0;
- if($("#Enable").is(":checked")){
- enable = 1;
- }
- var tag_url = abe.AdBank.tag_url;
- var description = abe.AdBank.description;
- var prob = abe.AdBank.prob_percent;
- SecurityFcy.getUserToken().then(function (token) {
- AdBankSrv.saveAdBank(id,token,description,tag_url,prob,target,forIranian,enable).then(function (result) {
- if (result != -1) {
- NgNote.Success('بانک اطلاعاتی با موفقیت اضافه شد', 3);
- } else {
- NgNote.Error('خظا در ارتباط با سرور', 3);
- }
- })
- });
- }
- }else{
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- })
- }
- function AdsBankAddCtrl($rootScope,AdsSrv,ProgressBarFcy,SecurityFcy,UserSrv,$window,AdBankFcy,AdBankSrv){
- var aba = this;
- aba.adsModel = {};
- $rootScope.Page.Title = "افزودن بانک تبلیغات";
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- SecurityFcy.getUserToken().then(function (token) {
- ProgressBarFcy.setDone();
- aba.createAdBank = function () {
- var ad_enable = 0;
- var ad_for_iranian = 0;
- var array_of_target = [];
- if($("#Enable").is(":checked")){
- ad_enable = 1;
- }
- if($("#forIranian").is(":checked")){
- ad_for_iranian = 1;
- }
- if($("#vod").is(":checked")){
- array_of_target.push("vod");
- }
- if($("#live").is(":checked")){
- array_of_target.push("live");
- }
- var ad_target = array_of_target.join();
- var ad_tag_url = aba.adsModel.target_url;
- var ad_title = aba.adsModel.description;
- var ad_probability = aba.adsModel.adsProb;
- // console.log(ad_enable + " " + ad_for_iranian + " " + ad_target + " " + ad_tag_url + " " + ad_title + " " + ad_probability);
- AdBankSrv.addAdBank(ad_title,ad_tag_url,ad_probability,ad_target,ad_for_iranian,ad_enable,token).then(function (response) {
- if(response != -1){
- NgNote.Success('بانک اطلاعاتی با موفقیت اضافه شد.',3);
- }else{
- NgNote.Error('خظا در ارتباط با سرور.',3);
- }
- })
- }
- })
- }else{
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- })
- }
- function PromotionsAddCtrl($rootScope,AdsSrv,ProgressBarFcy,SecurityFcy,UserSrv,$window,PromotionFcy,PromotionsSrv){
- var pac = this;
- pac.Promotion = { UpdateInProgress:true ,Promotion:0};
- $rootScope.Page.Title = "اضافه کردن اسلایدر";
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- ProgressBarFcy.setDone();
- }else{
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- pac.applyChange = function (val) {
- pac.Promotion.promotionType = val + "";
- }
- $(document).on("click","#file-upload-mobile",function () {
- $("#fileInput3").click();
- })
- $(document).on("click","#file-upload-admin3",function () {
- $("#fileInput").click();
- })
- pac.platformType = '1';
- pac.listOfDropdown = [{id:'0',title:'وب'},{id:'1',title:'موبایل'}]
- CalendarSetup.setup("valid-from");
- CalendarSetup.setup("valid-until");
- pac.showLargeImage = false;
- pac.finalize = false;
- $(document).on("click","#poster-upload-button",function () {
- pac.showLargeImage = true;
- })
- $(document).on("click","#upload-mobile-button",function () {
- pac.finalize = true;
- })
- $(document).on("click","#cover-upload-button",function () {
- pac.finalize = true;
- })
- pac.nextLevel = function () {
- SecurityFcy.getUserToken().then(function (token) {
- var promotionCategoryArray = [];
- $(".checkboxes-promotion input[type=checkbox]:checked").each(function () {
- promotionCategoryArray.push($(this).val());
- })
- var promotion_category = promotionCategoryArray.join();
- var show_time = "";
- var date = new JDate($("#valid-from").val());
- var month = parseInt(date._date.getMonth()) + 1;
- var day = parseInt(date._date.toString().split(" ")[2]);
- var year = date._date.getFullYear();
- var MiladiDate = new Date(year, month, parseInt(day));
- if(MiladiDate.getMonth() == 0){
- show_time = (MiladiDate.getFullYear()-1 + "-" + "12" + "-" + day) + " " + "00" + ":" + "00" + ":00";
- }else{
- show_time = (MiladiDate.getFullYear() + "-" + MiladiDate.getMonth() + "-" + day) + " " + "00" + ":" + "00" + ":00";
- }
- var show_time2 = "";
- var date2 = new JDate($("#valid-until").val());
- var month2 = parseInt(date2._date.getMonth()) + 1;
- var day2 = parseInt(date2._date.toString().split(" ")[2]);
- var year2 = date2._date.getFullYear();
- MiladiDate = new Date(year2, month2, parseInt(day2));
- if(MiladiDate.getMonth() == 0){
- show_time2 = (MiladiDate.getFullYear()-1 + "-" + "12" + "-" + day2) + " " + "00" + ":" + "00" + ":00";
- }else{
- show_time2 = (MiladiDate.getFullYear() + "-" + MiladiDate.getMonth() + "-" + day2) + " " + "00" + ":" + "00" + ":00";
- }
- PromotionsSrv.createPromotion(promotion_category,pac.Promotion.description_fa,pac.Promotion.description_en,pac.Promotion.link,$("input[name=slider_type]:checked").val(),pac.Promotion.title,pac.Promotion.play_time,pac.Promotion.occasion,pac.platformType,show_time,show_time2,token).then(function (result) {
- $rootScope.sliderId = result.data.id;
- if(result!=-1){
- // pac.sliderId = result;
- // console.log(result);
- NgNote.Success('اطلاعات اپیزود با موفقیت به ثبت رسید',5);
- }else {
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید',5);
- }
- });
- })
- $(".next-lvl").show();
- $(".prev-lvl").hide();
- $("#picture-form").show();
- $("#edit-form").hide();
- }
- pac.prevLevel = function () {
- $(".prev-lvl").show();
- $(".next-lvl").hide();
- $("#picture-form").hide();
- $("#edit-form").show();
- }
- }
- function PromotionsEditCtrl($rootScope,AdsSrv,ProgressBarFcy,SecurityFcy,UserSrv,$window,PromotionFcy,$routeParams,PromotionsSrv){
- var pec = this;
- pec.Promotion = { UpdateInProgress:true ,Item:{}};
- var Id = $routeParams.Id;
- $rootScope.sliderId = Id;
- $rootScope.Page.Title = "اضافه کردن اسلایدر";
- pec.showLargeImage = false;
- pec.finalize = false;
- $(document).on("click","#poster-upload-button",function () {
- pec.showLargeImage = true;
- })
- $(document).on("click","#file-upload-admin3",function () {
- $("#fileInput").click();
- })
- $(document).on("click","#upload-mobile-button",function () {
- pec.finalize = true;
- })
- $(document).on("click","#cover-upload-button",function () {
- pec.finalize = true;
- })
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- ProgressBarFcy.setDone();
- SecurityFcy.getUserToken().then(function (token) {
- PromotionFcy.getPromotionById(token,Id).then(function (data) {
- pec.Promotion.Item = data;
- if(data.valid_from != null) {
- var date = new Date(data.valid_from.split(" ")[0].split("-")[0], data.valid_from.split(" ")[0].split("-")[1], data.valid_from.split(" ")[0].split("-")[2]);
- pec.Promotion.Item.valid_from = new JDate(date).toLocaleString().split(" ")[0].replace(/\//g, "-");
- }
- if(data.valid_to != null) {
- var date2 = new Date(data.valid_to.split(" ")[0].split("-")[0], data.valid_to.split(" ")[0].split("-")[1], data.valid_to.split(" ")[0].split("-")[2]);
- pec.Promotion.Item.valid_to = new JDate(date2).toLocaleString().split(" ")[0].replace(/\//g, "-");
- }
- if(pec.Promotion.Item.type !=null){
- switch (pec.Promotion.Item.type){
- case 's':
- $("input[value=s]").click();
- break;
- case 'm':
- $("input[value=m]").click();
- break;
- case 'l':
- $("input[value=l]").click();
- break;
- case 'k':
- $("input[value=k]").click();
- break;
- }
- }else{
- $("input[value=movies]").click();
- }
- if(pec.Promotion.Item.category != null){
- pec.Promotion.Item.category.split(",").forEach(function (item) {
- switch (item){
- case "1":
- $("input[ng-value=1]").click();
- break;
- case "2":
- $("input[ng-value=2]").click();
- break;
- case "3":
- $("input[ng-value=3]").click();
- break;
- case "4":
- $("input[ng-value=4]").click();
- break;
- case "5":
- $("input[ng-value=5]").click();
- break;
- case "6":
- $("input[ng-value=6]").click();
- break;
- case "7":
- $("input[ng-value=7]").click();
- break;
- case "8":
- $("input[ng-value=8]").click();
- break;
- case "9":
- $("input[ng-value=9]").click();
- break;
- }
- })
- }
- })
- })
- }else{
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- pec.Promotion.platformType = '0';
- pec.listOfDropdown = [{id:0,title:'وب'},{id:1,title:'موبایل'}]
- CalendarSetup.setup("valid-from");
- CalendarSetup.setup("valid-until");
- pec.nextLevel = function () {
- var promotionCategoryArray = [];
- $(".checkboxes-promotion input[type=checkbox]:checked").each(function () {
- promotionCategoryArray.push($(this).val());
- })
- var promotion_category = promotionCategoryArray.join();
- var show_time = "";
- var date = new JDate($("#valid-from").val());
- var month = parseInt(date._date.getMonth()) + 1;
- var day = parseInt(date._date.toString().split(" ")[2]);
- var year = date._date.getFullYear();
- var MiladiDate = new Date(year, month, parseInt(day));
- if(MiladiDate.getMonth() == 0){
- show_time = (MiladiDate.getFullYear()-1 + "-" + "12" + "-" + day) + " " + "00" + ":" + "00" + ":00";
- }else{
- show_time = (MiladiDate.getFullYear() + "-" + MiladiDate.getMonth() + "-" + day) + " " + "00" + ":" + "00" + ":00";
- }
- var show_time2 = "";
- var date2 = new JDate($("#valid-until").val());
- var month2 = parseInt(date2._date.getMonth()) + 1;
- var day2 = parseInt(date2._date.toString().split(" ")[2]);
- var year2 = date2._date.getFullYear();
- MiladiDate = new Date(year2, month2, parseInt(day2));
- if(MiladiDate.getMonth() == 0){
- show_time2 = (MiladiDate.getFullYear()-1 + "-" + "12" + "-" + day2) + " " + "00" + ":" + "00" + ":00";
- }else{
- show_time2 = (MiladiDate.getFullYear() + "-" + MiladiDate.getMonth() + "-" + day2) + " " + "00" + ":" + "00" + ":00";
- }
- SecurityFcy.getUserToken().then(function (token) {
- PromotionsSrv.savePromotion($routeParams.Id,promotion_category,pec.Promotion.Item.description_fa,pec.Promotion.Item.description_en,pec.Promotion.Item.link,$("input[name=slider_type]:checked").val(),pec.Promotion.Item.title,pec.Promotion.Item.play_time,pec.Promotion.Item.occasion,pec.Promotion.Item.is_mobile,show_time,show_time2,token).then(function (result) {
- if(result!=-1){
- NgNote.Success('اطلاعات اپیزود با موفقیت به ثبت رسید',5);
- }else {
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید',5);
- }
- });
- })
- $(".next-lvl").show();
- $(".prev-lvl").hide();
- $("#picture-form").show();
- $("#edit-form").hide();
- }
- pec.prevLevel = function () {
- $(".prev-lvl").show();
- $(".next-lvl").hide();
- $("#picture-form").hide();
- $("#edit-form").show();
- }
- }
- function PromotionsListCtrl($rootScope,AdsSrv,ProgressBarFcy,SecurityFcy,UserSrv,$window,PromotionFcy,PromotionsSrv){
- var plc = this;
- plc.Promotions = { UpdateInProgress:true ,Promotions:null,offset:0,limit:60};
- $rootScope.Page.Title = "لیست اسلایدر";
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- SecurityFcy.getUserToken().then(function (token) {
- PromotionFcy.getPromotions(plc.Promotions.offset,plc.Promotions.limit,token).then(function (data) {
- plc.Promotions.Promotions = data;
- ProgressBarFcy.setDone();
- })
- })
- }else{
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- })
- plc.deletePromotion = function (id) {
- var cnf = showConfirm.verify();
- if(cnf) {
- SecurityFcy.getUserToken().then(function (token) {
- $("table > tbody > tr[data-row=" + id + "]").remove();
- PromotionsSrv.deletePromotion(id, token);
- NgNote.Success('بنر مورد نظر حذف شد', 3);
- })
- }
- }
- }
- function AddAdsCtrl($rootScope,AdsSrv,ProgressBarFcy,SecurityFcy,UserSrv,$window){
- var adc = this;
- $rootScope.Page.Title = "افزودن تبلیغ جدید";
- adc.adsModel = {adsTitle:"",adsPreroll:"",adsPostroll:"",adsLink:"",adsMediaPath:"",adsMediaStaticPath:"",adsDuration:"00:00:05",adsProb:0,deviceDesktop:"",deviceMobileWeb:"",deviceAndroidApp:"",targetVod:"",targetLive:"",enable:""}
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- ProgressBarFcy.setDone();
- }
- else {
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- adc.CreateAd = function () {
- var arrayOfDevices = [];
- var arrayOfTargets = [];
- if(adc.adsModel.deviceDesktop+"" == "true")
- arrayOfDevices.push("desktop")
- if(adc.adsModel.deviceMobileWeb+"" == "true")
- arrayOfDevices.push("mobile")
- if(adc.adsModel.deviceAndroidApp+"" == "true")
- arrayOfDevices.push("android")
- if((adc.adsModel.targetVod + "") == "true")
- arrayOfTargets.push("vod")
- if((adc.adsModel.targetLive + "") == "true")
- arrayOfTargets.push("live")
- var enabled = "0";
- if(adc.adsModel.enable == "1")
- enabled = "1";
- var targets = arrayOfTargets.join();
- var devices = arrayOfDevices.join();
- var mode = "";
- $("input[name=display-type]").each(function () {
- if($(this).is(":checked"))
- mode = $(this).val();
- })
- SecurityFcy.getUserToken().then(function (token) {
- AdsSrv.create(adc.adsModel.adsTitle, mode, adc.adsModel.adsLink, adc.adsModel.adsMediaPath,
- adc.adsModel.adsMediaStaticPath, adc.adsModel.adsDuration, adc.adsModel.adsProb, devices,
- targets, enabled,token)
- .then(function () {
- NgNote.Success('تبلیغ مورد نظر با موفقیت افزوده شد',3);
- });
- })
- }
- }
- function EditAdsCtrl($rootScope,AdsSrv,ProgressBarFcy,SecurityFcy,UserSrv,$window,$routeParams){
- var edc = this;
- $rootScope.Page.Title = "ویرایش اطلاعات تبلیغ";
- edc.AdStatus = {InProgress:false};
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- ProgressBarFcy.setDone();
- }
- else {
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- edc.preStatus = null;
- edc.postStatus = null;
- edc.desktop = null;
- edc.mobile = null;
- edc.android = null;
- edc.live = null;
- edc.vod = null;
- edc.enable = null;
- var arrayOfDevices = [];
- var arrayOfTargets = [];
- SecurityFcy.getUserToken().then(function (token) {
- AdsSrv.getAd($routeParams.Id,token).then(function (result) {
- edc.adsModel = result;
- if(edc.adsModel.mode == "preroll")
- edc.preStatus = "preroll";
- else
- edc.postStatus = "postroll";
- arrayOfDevices = edc.adsModel.device.split(",");
- arrayOfTargets = edc.adsModel.target.split(",");
- if (arrayOfDevices.indexOf("desktop") >= 0) {
- $("#desktop").click();
- }
- if (arrayOfDevices.indexOf("mobile") >= 0) {
- $("#mobile").click();
- }
- if (arrayOfDevices.indexOf("android") >= 0) {
- $("#android").click();
- }
- if (arrayOfTargets.indexOf("vod") >= 0) {
- $("#vod").click();
- }
- if (arrayOfTargets.indexOf("live") >= 0) {
- $("#live").click();
- }
- if(edc.adsModel.mode=="preroll")
- $("#preroll").click();
- else
- $("#postroll").click();
- if(edc.adsModel.enable != 0)
- edc.enable = "1"
- ProgressBarFcy.setDone();
- })
- })
- edc.UpdateAd = function () {
- edc.AdStatus.InProgress=true;
- var arrayOfDevices = [];
- var arrayOfTargets = [];
- if(edc.adsModel.deviceDesktop+"" == "true")
- arrayOfDevices.push("desktop")
- if(edc.adsModel.deviceMobileWeb+"" == "true")
- arrayOfDevices.push("mobile")
- if(edc.adsModel.deviceAndroidApp+"" == "true")
- arrayOfDevices.push("android")
- if((edc.adsModel.targetVod + "") == "true")
- arrayOfTargets.push("vod")
- if((edc.adsModel.targetLive + "") == "true")
- arrayOfTargets.push("live")
- var enabled = "0";
- if(edc.adsModel.enable == "1")
- enabled = "1";
- var targets = arrayOfTargets.join();
- var devices = arrayOfDevices.join();
- var mode = "";
- $("input[name=display-type]").each(function () {
- if($(this).is(":checked"))
- mode = $(this).val();
- })
- // console.log({title: edc.adsModel.title, mode: mode, link: edc.adsModel.link_url, media_path: edc.adsModel.media_path,
- // static_media_path: edc.adsModel.media_path_static, media_duration: edc.adsModel.media_duration, prob: edc.adsModel.prob, devices: devices,
- // targets: targets, enabled: enabled})
- SecurityFcy.getUserToken().then(function (token) {
- AdsSrv.update($routeParams.Id,edc.adsModel.title, mode, edc.adsModel.link_url, edc.adsModel.media_path,
- edc.adsModel.media_path_static, edc.adsModel.media_duration, edc.adsModel.prob, devices,
- targets, enabled,token)
- .then(function () {
- edc.AdStatus.InProgress=false;
- NgNote.Success('اطلاعات تبلیغ با موفقیت به روز شد',3);
- });
- })
- }
- }
- function AdsBankListCtrl($rootScope,AdsFcy,AdsSrv,ProgressBarFcy,SecurityFcy,UserSrv,AdBankFcy,$window,AdBankSrv){
- var abl = this;
- abl.adBankList = {limit:50,offset:0,UpdateInProgress:true,AdBanks:null};
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- SecurityFcy.getUserToken().then(function (token) {
- AdBankFcy.getAdBankList(abl.adBankList.limit,abl.adBankList.offset,token).then(function (data) {
- abl.adBankList.AdBanks = data;
- })
- })
- abl.removeItem = function (id) {
- var cnf = showConfirm.verify();
- if(cnf) {
- SecurityFcy.getUserToken().then(function (token) {
- $("#adbank-table tr[data-row="+id+"]").remove();
- AdBankSrv.deleteAdBank(id, token);
- NgNote.Success('ایتم مورد نظر حذف شد.',3);
- })
- }
- }
- ProgressBarFcy.setDone();
- }else{
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- })
- }
- function ListAdsCtrl($rootScope,AdsFcy,AdsSrv,ProgressBarFcy,SecurityFcy,UserSrv){
- var lac = this;
- $rootScope.Page.Title = "لیست تبلیغات";
- lac.ItemsData={Offset:0,Limit:50,UpdateInProgress:false,Items:[],Page:0};
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- SecurityFcy.getUserToken().then(function (token) {
- AdsFcy.getAll(token,lac.ItemsData.Offset,lac.ItemsData.Limit).then(function (ItemResults) {
- ProgressBarFcy.setDone();
- lac.ItemsData.Items = ItemResults;
- });
- });
- }
- else {
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- lac.DeleteAd = function (ad_id) {
- SecurityFcy.getUserToken().then(function (token) {
- AdsSrv.deleteAd(ad_id,token).then(function () {
- NgNote.Success("تبلیغ مورد نظر با موفقیت حذف شد",3);
- $("#list-of-ads").find("tr[data-row="+ad_id+"]").remove();
- })
- })
- }
- }
- function AddEpisodeCtrl(GeneralInit,UserSrv,$rootScope,SiteConstants,ProgressBarFcy,EpisodeSrv,$routeParams,$window,$http,SecurityFcy,ArtistFcy,TagFcy,FavoriteListFcy,Configs,ProgramFcy){
- var aec = this;
- var selectize,selectize2,selectize3,selectize4,selectize5;
- aec.EpisodeStatus = { InProgress:false}
- $rootScope.Page.Title="افزودن قسمت برنامه";
- $rootScope.$broadcast("UserData");
- aec.ArtisSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- aec.TagSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- aec.ProgramSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- aec.CountrySearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- aec.Directors = {};
- aec.Provider = {};
- aec.HoursList = [];
- aec.MinutesList = [];
- aec.publishedMinute = 0;
- aec.publishedHour = 0;
- for(var i = 0;i<=24;i++){
- var item = {id:0,title:0};
- item.id = i;
- item.title = i+ ' ساعت ';
- aec.HoursList.push(item)
- }
- for(var i = 0;i<60;i++){
- var item = {id:0,title:0};
- item.id = i;
- item.title = i + ' دقیقه ';
- aec.MinutesList.push(item)
- }
- aec.Actors = null;
- aec.favLists = null;
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- setTimeout(function () {
- $('.tagging').selectize({
- delimiter: '#',
- persist: false,
- create: function (input) {
- return {
- value: input,
- text: input
- }
- }
- });
- $(".taggings").val(result.tags);
- var $select2 = $('.taggings').selectize({
- delimiter: ',',
- persist: false,
- create: function (input) {
- return {
- value: input,
- text: input
- }
- }
- });
- var $select = $('.option-artist').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: input.id,
- text: input.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select5 = $('#copyright-field').selectize({
- valueField: 'descriptor',
- labelField: 'name',
- searchField: 'name',
- create: function (input) {
- return {
- value: input.id,
- text: input.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select3 = $('.fav-list').selectize({
- valueField: 'id',
- labelField: 'name_fa',
- searchField: 'name_fa',
- create: function (input) {
- return {
- value: input.id,
- text: input.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select4 = $('.program').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- maxItems:1,
- create: function (input) {
- return {
- value: input.id,
- text: input.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- CalendarSetup.setup("show_time");
- selectize = $select[0].selectize;
- selectize3 = $select3[0].selectize;
- selectize4 = $select4[0].selectize;
- selectize5 = $select5[0].selectize;
- }, 1800);
- }
- ProgressBarFcy.setDone();
- })
- aec.SearchArtist = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- ArtistFcy.searchByName(context, token, aec.ArtisSearchData.Offset, aec.ArtisSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- }
- aec.ArtisSearchData.Items = result;
- itemLoading.hide();
- })
- });
- }else{
- itemLoading.hide();
- }
- };
- aec.SearchProgram = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- ProgramFcy.searchByName(context, token, aec.ProgramSearchData.Offset, aec.ProgramSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- } else if (chooseOption == 4) {
- selectize4.addOption(result);
- selectize4.refreshOptions();
- }
- aec.ProgramSearchData.Items = result;
- itemLoading.hide();
- })
- });
- }else{
- itemLoading.hide();
- }
- };
- aec.SearchCountry = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- ProgramFcy.searchCountryByName(context, token, aec.CountrySearchData.Offset, aec.CountrySearchData.Limit).then(function (result) {
- if (chooseOption == 8) {
- selectize5.addOption(result);
- selectize5.refreshOptions();
- }
- aec.CountrySearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- aec.SearchFavoriteList = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- FavoriteListFcy.searchByName(context, token, aec.TagSearchData.Offset, aec.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- } else if (chooseOption == 3) {
- selectize3.addOption(result);
- selectize3.refreshOptions();
- } else if (chooseOption == 4) {
- selectize4.addOption(result);
- selectize4.refreshOptions();
- }
- aec.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- aec.SearchTag = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- TagFcy.searchByName(context, token, aec.TagSearchData.Offset, aec.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- }
- aec.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- var itemLoading = null;
- var t = null;
- var chooseOption = null;
- $(document).on("input",".option-artist .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 1;
- var value = $(this).val();
- t = setTimeout(function(){aec.SearchArtist(value)},800);
- });
- $(document).on("input",".country-list .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 8;
- var value = $(this).val();
- t = setTimeout(function(){aec.SearchCountry(value)},800);
- });
- $(document).on("input",".program .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 4;
- var value = $(this).val();
- t = setTimeout(function(){aec.SearchProgram(value)},800);
- });
- $(document).on("input",".fav-list .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 3;
- var value = $(this).val();
- t = setTimeout(function(){aec.SearchFavoriteList(value)},800);
- });
- aec.SaveEpisode = function () {
- if($("input[name=showTime]").val().length > 6 && aec.publishedHour+'' != 'undefined' && aec.publishedMinute+'' != 'undefined') {
- aec.EpisodeStatus.InProgress = true;
- SecurityFcy.getUserToken().then(function (token) {
- if (typeof aec.Actors == 'object') {
- aec.Actors = '';
- }
- if(aec.publishedHour < 10){
- aec.publishedHour = '0'+aec.publishedHour;
- }
- if(aec.publishedMinute < 10){
- aec.publishedMinute ='0'+aec.publishedMinute;
- }
- var copyrightType = $("input[name=copyright-type]:checked").val();
- var date = new JDate($("#show_time").val());
- var month = parseInt(date._date.getMonth()) + 1;
- var day = parseInt(date._date.toString().split(" ")[2]);
- var year = date._date.getFullYear();
- var MiladiDate = new Date(year, month, parseInt(day));
- var show_time = "";
- if(MiladiDate.getMonth() == 0){
- show_time = (MiladiDate.getFullYear()-1 + "-" + "12" + "-" + day) + " " + aec.publishedHour + ":" + aec.publishedMinute + ":00";
- }else{
- show_time = (MiladiDate.getFullYear() + "-" + MiladiDate.getMonth() + "-" + day) + " " + aec.publishedHour + ":" + aec.publishedMinute + ":00";
- }
- EpisodeSrv.createEpisode(aec.EpisodeData.program_id, show_time,aec.copyright,copyrightType, aec.EpisodeData.title, aec.EpisodeData.title_english, aec.EpisodeData.description_fa,
- aec.EpisodeData.keywords_english, aec.Actors, aec.EpisodeData.page_description, aec.EpisodeData.tags, aec.favLists, token).then(function (result) {
- if (result != -1) {
- aec.EpisodeStatus.InProgress = false;
- NgNote.Success('اطلاعات اپیزود با موفقیت به ثبت رسید', 5);
- } else {
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید', 5);
- aec.EpisodeStatus.InProgress = false;
- }
- });
- })
- }else{
- alert("لطفا تاریخ قسمت برنامه ساعت و دقیقه را وارد کنید.");
- }
- }
- }
- function ListOfUserCtrl(GeneralInit,UserSrv,UserFcy,$rootScope,SiteConstants,ProgressBarFcy,$window,$http,SecurityFcy,Configs){
- var luc = this;
- $rootScope.Page.Title="لیست کاربران";
- luc.UsersList = {offset:0,limit:50,UpdateInProgress:true,Users:null};
- luc.Pagination = [];
- luc.UserStatus = [];
- luc.SingleUser = null;
- luc.UserStatus[1]= "جدید";
- luc.UserStatus[2]= "فعال";
- luc.UserStatus[3]= "غیر فعال";
- luc.UserStatus[4]= "حذف شده";
- luc.UserStatus[5]= "غیر قابل ورود";
- luc.UserStatus[6]= "ممنوع الورود";
- UserSrv.getUser().then(function (result) {
- if(typeof result!='undefined' && result!=null && typeof result.token!='undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))){
- SecurityFcy.getUserToken().then(function (token) {
- luc.UsersList.UpdateInProgress = false;
- UserFcy.getUsers(luc.UsersList.limit,luc.UsersList.offset,token).then(function (data) {
- luc.UsersList.Users = data;
- })
- });
- luc.searchByEmail = function (email) {
- luc.UsersList.UpdateInProgress = true;
- SecurityFcy.getUserToken().then(function (token) {
- UserFcy.getUserByEmail(email,null,token).then(function (data) {
- luc.SingleUser = data;
- luc.UsersList.Users = data;
- luc.UsersList.UpdateInProgress = false;
- })
- })
- }
- luc.searchByPhone = function (phone) {
- luc.UsersList.UpdateInProgress = true;
- SecurityFcy.getUserToken().then(function (token) {
- UserFcy.getUserByEmail(null,phone,token).then(function (data) {
- luc.UsersList.UpdateInProgress = false;
- luc.SingleUser = data;
- })
- })
- }
- for(var i = 1;i<=50;i++){
- luc.Pagination[i-1] = i;
- }
- ProgressBarFcy.setDone();
- $(document).on("click",".page",function () {
- var index = $(this).data("page");
- luc.UsersList.offset = (index-1)*50;
- luc.UsersList.UpdateInProgress = true;
- SecurityFcy.getUserToken().then(function (token) {
- UserFcy.getUsers(luc.UsersList.limit,luc.UsersList.offset,token).then(function (data) {
- luc.UsersList.UpdateInProgress = false;
- luc.UsersList.Users = data;
- })
- })
- })
- }else{
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- })
- luc.deleteUser = function (id) {
- var cnf = showConfirm.verify();
- if(cnf) {
- SecurityFcy.getUserToken().then(function (token) {
- UserSrv.deleteUser(id, token);
- $(".user-row[data-row=" + id + "]").remove();
- NgNote.Success('کاربر مورد نظر با موفقیت حذف شد.',3);
- })
- }
- }
- }
- function EditUserCtrl(GeneralInit,UserSrv,UserFcy,$rootScope,SiteConstants,ProgressBarFcy,$routeParams,$window,$http,SecurityFcy,Configs){
- var euc = this;
- $rootScope.Page.Title="ویرایش کاربر";
- UserSrv.getUser().then(function (result) {
- if (typeof result != 'undefined' && result != null && typeof result.token != 'undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- euc.User = {UpdateInProgress:true};
- euc.UserStatus = [];
- euc.UserStatus = [{id: 1, title: 'جدید'}, {id: 2, title: 'فعال'}, {id: 3, title: 'غیر فعال'}, {
- id: 4,
- title: 'حذف شده'
- }, {id: 5, title: 'غیر قابل ورود'}, {id: 6, title: 'ممنوع الورود'}]
- SecurityFcy.getUserToken().then(function (token) {
- UserFcy.getUserById($routeParams.Id, token).then(function (data) {
- euc.User = data;
- euc.User.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- if(euc.User.gender == 'm'){
- euc.User.male = 'm';
- }else if(euc.User.gender == 'f'){
- euc.User.female = 'f';
- }
- })
- })
- euc.saveUser = function () {
- var gender = 'm';
- if($("#man").is(":checked")){
- gender = 'm';
- }else if($("#woman").is(":checked")){
- gender = 'f';
- }
- euc.User.UpdateInProgress = true;
- SecurityFcy.getUserToken().then(function (token) {
- var id = $routeParams.Id;
- UserSrv.updateUser(id,euc.User.fname,gender,euc.User.phone,euc.User.user_membership_status,token).then(function (result) {
- if (result != -1) {
- euc.User.InProgress = false;
- NgNote.Success('کاربر مورد نظر شما با موفقیت ویرایش شد.', 3);
- } else {
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید', 5);
- euc.User.InProgress = false;
- }
- });
- });
- }
- }else{
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- }
- function EditEpisodeCtrl(GeneralInit,UserSrv,$rootScope,SiteConstants,ProgressBarFcy,EpisodeSrv,$routeParams,$window,$http,SecurityFcy,ArtistFcy,TagFcy,FavoriteListFcy,Configs,ProgramFcy){
- var eec = this;
- eec.EpisodeStatus = { InProgress:false}
- $rootScope.Page.Title="ویرایش قسمت برنامه";
- $rootScope.$broadcast("UserData");
- eec.ArtisSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- eec.TagSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- eec.EpisodeSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- eec.CountrySearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- eec.HoursList = [];
- eec.MinutesList = [];
- eec.publishedMinute = 0;
- eec.publishedHour = 0;
- for(var i = 0;i<=24;i++){
- var item = {id:0,title:0};
- if(i < 10){
- item.id = '0'+i;
- }else{
- item.id = i+"";
- }
- item.title = i+ ' ساعت ';
- eec.HoursList.push(item)
- }
- for(var i = 0;i<60;i++){
- var item = {id:0,title:0};
- if(i < 10){
- item.id = '0'+i;
- }else{
- item.id = i+"";
- }
- item.title = i + ' دقیقه ';
- eec.MinutesList.push(item)
- }
- eec.Directors = {};
- eec.Provider = {};
- eec.Actors = null;
- eec.favLists = null;
- ProgressBarFcy.setDone();
- var selectize2,selectize,selectize3,selectize4,selectize5;
- eec.EpisodeData = {};
- UserSrv.getUser().then(function (result) {
- if(typeof result!='undefined' && result!=null && typeof result.token!='undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))){
- SecurityFcy.getUserToken().then(function (token) {
- EpisodeSrv.getFullEpisode($routeParams.Id, token).then(function (result) {
- eec.EpisodeData = result;
- if(result.show_time.length > "6") {
- eec.EpisodeData.today = result.show_time.split(" ")[0];
- eec.EpisodeData.hour = result.show_time.split(" ")[1].split(":")[0];
- eec.EpisodeData.minute = result.show_time.split(" ")[1].split(":")[1];
- }else{
- eec.EpisodeData.today = eec.EpisodeData.today = "1395-09-14";
- eec.EpisodeData.hour = "00";
- eec.EpisodeData.minute = "00";
- }
- if(result.region_inclusion == "include"){
- $("#include").click();
- }else if (result.region_inclusion == "exclude"){
- $("#exclude").click();
- }
- eec.copyright = result.region;
- setTimeout(function () {
- // replacePipelineAddress.replace($(this).find("img"));
- // replacePipelineAddressAngular();
- remainCount.countRemain("MetaDescription",300);
- $('.tagging').val(result.keywords_english);
- $('.tagging').selectize({
- delimiter: '#',
- persist: false,
- create: function (input) {
- return {
- value: input,
- text: input
- }
- }
- });
- CalendarSetup.setup("show_time");
- $(".taggings").val(result.tags);
- var $select2 = $('.taggings').selectize({
- delimiter: ',',
- persist: false,
- create: function (input) {
- return {
- value: input,
- text: input
- }
- }
- });
- var $select5 = $('#copyright-field').selectize({
- delimiter: ',',
- persist: false,
- valueField: 'descriptor',
- labelField: 'name',
- searchField: 'name',
- create: function (input) {
- return {
- value: input,
- text: input
- }
- }
- });
- var $select = $('.option-artist').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: input.id,
- text: input.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select3 = $('.fav-list').selectize({
- valueField: 'id',
- labelField: 'name_fa',
- searchField: 'name_fa',
- create: function (input) {
- return {
- value: input.id,
- text: input.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select4 = $('.program').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- maxItems:1,
- create: function (input) {
- return {
- value: input.id,
- text: input.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- selectize = $select[0].selectize;
- selectize3 = $select3[0].selectize;
- selectize4 = $select4[0].selectize;
- selectize5 = $select5[0].selectize;
- $('.option-artist').val("");
- for (var i = 0; i <= result.artists.length - 1; i++) {
- selectize.addOption(result.artists[i]);
- selectize.addItem(result.artists[i].id);
- }
- if(result.episode_countries != null) {
- for (var i = 0; i <= result.episode_countries.length; i++) {
- selectize5.addOption(result.episode_countries[i]);
- selectize5.addItem(result.episode_countries[i].id);
- }
- }
- for (var i = 0; i <= result.program.length - 1; i++) {
- selectize4.addOption(result.program.title);
- selectize4.addItem(result.program.id);
- }
- for (var i = 0; i <= 0; i++) {
- selectize4.addOption(result.program);
- selectize4.addItem(result.program.id);
- }
- selectize2 = $select2[0].selectize;
- for (var j = 0; j <= result.favorite_lists.length - 1; j++) {
- if (typeof result.favorite_lists[j] != 'undefined') {
- selectize3.addOption(result.favorite_lists[j]);
- selectize3.addItem(result.favorite_lists[j].id);
- }
- }
- }, 1800);
- if (eec.EpisodeData.downloadable == 1) {
- eec.EpisodeData.downloadable = true;
- }
- if (eec.EpisodeData.enable == 1) {
- eec.EpisodeData.enable = true;
- }
- });
- });
- }
- else {
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- eec.SaveEpisode = function () {
- if($("#show_time").val().length > 7 && eec.publishedHour+'' != 'undefined' && eec.publishedMinute+'' != 'undefined') {
- eec.EpisodeStatus.InProgress = true;
- if(eec.publishedHour < 10){
- eec.publishedHour = '0'+eec.publishedHour;
- }
- if(eec.publishedMinute < 10){
- eec.publishedMinute ='0'+eec.publishedMinute;
- }
- var show_time = "";
- var copyrightType = $("input[name=copyright-type]:checked").val();
- var date = new JDate($("#show_time").val());
- var month = parseInt(date._date.getMonth()) + 1;
- var day = parseInt(date._date.toString().split(" ")[2]);
- var year = date._date.getFullYear();
- var MiladiDate = new Date(year, month, parseInt(day));
- if(MiladiDate.getMonth() == 0){
- show_time = (MiladiDate.getFullYear()-1 + "-" + "12" + "-" + day) + " " + eec.EpisodeData.hour + ":" + eec.EpisodeData.minute + ":00";
- }else{
- show_time = (MiladiDate.getFullYear() + "-" + MiladiDate.getMonth() + "-" + day) + " " + eec.EpisodeData.hour + ":" + eec.EpisodeData.minute + ":00";
- }
- SecurityFcy.getUserToken().then(function (token) {
- if (typeof eec.Actors == 'object') {
- eec.Actors = '';
- }
- EpisodeSrv.saveEpisode(eec.EpisodeData.id, show_time,copyrightType,eec.copyright,eec.EpisodeData.program_id2, eec.EpisodeData.title,
- eec.EpisodeData.title_english, eec.EpisodeData.description_fa, eec.EpisodeData.keywords_english,
- eec.Actors, eec.EpisodeData.page_description, eec.EpisodeData.tags, eec.favLists, token).then(function (result) {
- if(result!=-1){
- eec.EpisodeStatus.InProgress = false;
- NgNote.Success('اطلاعات اپیزود با موفقیت به ثبت رسید',5);
- }else {
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید',5);
- eec.EpisodeStatus.InProgress = false;
- }
- })
- });
- }else{
- alert("لطفا تاریخ انتشار ویدئو ساعت و دقیقه را انتخاب کنید.")
- }
- };
- eec.SearchProgram = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- ProgramFcy.searchByName(context, token, eec.EpisodeSearchData.Offset, eec.EpisodeSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- } else if (chooseOption == 4) {
- selectize4.addOption(result);
- selectize4.refreshOptions();
- }
- eec.ProgramSearchData.Items = result;
- itemLoading.hide();
- })
- });
- }else{
- itemLoading.hide();
- }
- };
- eec.SearchArtist = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- ArtistFcy.searchByName(context, token, eec.ArtisSearchData.Offset, eec.ArtisSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- }
- eec.ArtisSearchData.Items = result;
- itemLoading.hide();
- })
- });
- }else{
- itemLoading.hide();
- }
- };
- eec.SearchFavoriteList = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- FavoriteListFcy.searchByName(context, token, eec.TagSearchData.Offset, eec.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- } else if (chooseOption == 3) {
- selectize3.addOption(result);
- selectize3.refreshOptions();
- }
- eec.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- eec.SearchTag = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- TagFcy.searchByName(context, token, eec.TagSearchData.Offset, eec.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- }
- eec.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- eec.SearchCountry = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- ProgramFcy.searchCountryByName(context, token, eec.CountrySearchData.Offset, eec.CountrySearchData.Limit).then(function (result) {
- if (chooseOption == 8) {
- selectize5.addOption(result);
- selectize5.refreshOptions();
- }
- eec.CountrySearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- var itemLoading = null;
- var t = null;
- var chooseOption = null;
- $(document).on("input",".program .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 4;
- var value = $(this).val();
- t = setTimeout(function(){eec.SearchProgram(value)},800);
- });
- $(document).on("input",".country-list .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 8;
- var value = $(this).val();
- t = setTimeout(function(){eec.SearchCountry(value)},800);
- });
- $(document).on("input",".option-artist .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 1;
- var value = $(this).val();
- t = setTimeout(function(){eec.SearchArtist(value)},800);
- });
- $(document).on("input",".fav-list .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 3;
- var value = $(this).val();
- t = setTimeout(function(){eec.SearchFavoriteList(value)},800);
- });
- $(document).on("input","#MetaDescription",function () {
- remainCount.countRemain("MetaDescription",300);
- })
- }
- function EditArtistCtrl(UserSrv,$rootScope,SiteConstants,ProgressBarFcy,EpisodeSrv,$routeParams,$window,ArtistSrv) {
- var aec = this;
- $rootScope.Page.Title="ویرایش اطلاعات هنرمند";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- aec.ArtistData={};
- aec.ArtistStatus={InProgress:false};
- aec.Save = function () {
- aec.ArtistStatus.InProgress=true;
- ArtistSrv.updateArtist(aec.ArtistData.id, aec.ArtistData.title, aec.ArtistData.nickname, aec.ArtistData.gender,
- aec.ArtistData.biography, aec.ArtistData.birth_palce, aec.ArtistData.activities).then(function (result) {
- aec.ArtistStatus.InProgress=false;
- })
- }
- }
- function EditFavoriteListCtrl(UserSrv,$rootScope,SiteConstants,ProgressBarFcy,EpisodeSrv,$routeParams,$window,FavoriteListSrv,SecurityFcy,FavoriteListFcy,UserSrv) {
- var fec = this;
- $rootScope.Page.Title="ویرایش لیست تماشا";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- fec.SearchFavoriteList = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- FavoriteListFcy.searchByName(context, token, eec.TagSearchData.Offset, eec.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- } else if (chooseOption == 3) {
- selectize3.addOption(result);
- selectize3.refreshOptions();
- }
- eec.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- fec.FavoriteListData={};
- fec.TagSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- fec.FavoriteListEpisodesData={Offset:0,Limit:15,UpdateInProgress:false,Episodes:[],Page:0};
- var selectize,t,chooseOption,itemLoading;
- fec.FavoriteListStatus={InProgress:false};
- fec.SearchFavoriteList = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- FavoriteListFcy.searchByName(context, token, fec.TagSearchData.Offset, fec.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- }
- fec.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- fec.getListData = function () {
- SecurityFcy.getUserToken().then(function (token) {
- fec.FavoriteListData.parent = null;
- FavoriteListSrv.getFavoriteList($routeParams.Id,token).then(function (result) {
- fec.FavoriteListData = result;
- var $select = $('#Parent').selectize({
- valueField: 'id',
- labelField: 'name_fa',
- searchField: 'name_fa',
- maxItems:1,
- create: function (input) {
- return {
- value: input.id,
- text: input.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- selectize = $select[0].selectize;
- if(result.parent !=null){
- selectize.addOption(result.parent);
- selectize.addItem(result.parent.id);
- }
- })
- })
- }
- fec.getEpisodeLists = function () {
- fec.FavoriteListEpisodesData.UpdateInProgress = true;
- FavoriteListSrv.getChildEpisodeList($routeParams.Id, fec.FavoriteListEpisodesData.Offset, fec.FavoriteListEpisodesData.Limit).then(function (result) {
- fec.FavoriteListEpisodesData.Episodes = result;
- fec.FavoriteListEpisodesData.UpdateInProgress = false;
- })
- }
- $(document).on("input",".favlist-farsi .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 1;
- var value = $(this).val();
- t = setTimeout(function(){fec.SearchFavoriteList(value)},800);
- });
- UserSrv.getUser().then(function (result) {
- if(typeof result!='undefined' && result!=null && typeof result.token!='undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))){
- SecurityFcy.getUserToken().then(function (token) {
- fec.getListData();
- fec.getEpisodeLists();
- });
- }
- else {
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- fec.Save = function () {
- fec.FavoriteListStatus.InProgress=true;
- SecurityFcy.getUserToken().then(function (token) {
- FavoriteListSrv.updateFavoriteList(fec.FavoriteListData.id, fec.FavoriteListData.name_fa, fec.FavoriteListData.name_en, fec.FavoriteListData.parent, fec.FavoriteListData.child_description, token).then(function (result) {
- fec.FavoriteListStatus.InProgress = false;
- NgNote.Success('اطلاعات شما با موفقیت به روز شد',3);
- })
- })
- }
- }
- function AddArtistCtrl(UserSrv,$rootScope,SiteConstants,ProgressBarFcy,EpisodeSrv,$routeParams,$window,ArtistSrv){
- var aac = this;
- $rootScope.Page.Title="افزودن اطلاعات هنرمند";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- aac.ArtistData={};
- aac.ArtistStatus={InProgress:false};
- aac.Save = function () {
- aac.ArtistStatus.InProgress=true;
- ArtistSrv.createArtist(aac.ArtistData.title, aac.ArtistData.nickname, aac.ArtistData.gender,
- aac.ArtistData.biography, aac.ArtistData.birth_palce, aac.ArtistData.activities).then(function (result) {
- aac.ArtistStatus.InProgress=false;
- })
- }
- }
- function AddFavoriteListCtrl(UserSrv,$rootScope,SiteConstants,ProgressBarFcy,EpisodeSrv,$routeParams,$window,FavoriteListSrv,SecurityFcy,FavoriteListFcy) {
- var fac = this;
- $rootScope.Page.Title="افزودن لیست تماشا";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- fac.FavoriteListData={};
- fac.FavoriteListStatus={InProgress:false};
- fac.TagSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- var selectize,t,chooseOption,itemLoading;
- fac.SearchFavoriteList = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- FavoriteListFcy.searchByName(context, token, fac.TagSearchData.Offset, fac.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- }
- fac.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- setTimeout(function () {
- var $select = $('#Parent').selectize({
- valueField: 'id',
- labelField: 'name_fa',
- searchField: 'name_fa',
- maxItems:1,
- create: function (input) {
- return {
- value: input.id,
- text: input.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- selectize = $select[0].selectize;
- },1000);
- $(document).on("input",".favlist-farsi .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 1;
- var value = $(this).val();
- t = setTimeout(function(){fac.SearchFavoriteList(value)},800);
- });
- fac.Save = function () {
- fac.FavoriteListStatus.InProgress=true;
- SecurityFcy.getUserToken().then(function (token){
- FavoriteListSrv.createFavoriteList(fac.FavoriteListData.name_fa, fac.FavoriteListData.name_en, fac.FavoriteListData.parent, fac.FavoriteListData.child_description, token).then(function (result) {
- if(result){
- NgNote.Success('لیست تماشا با موفقیت افزوده شد', 5);
- }
- else {
- NgNote.Error('خطا در ثبت، لطفا مجددا تلاش فرمایید', 3);
- }
- fac.FavoriteListStatus.InProgress=false;
- })
- });
- }
- fac.SearchFavoriteList = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- FavoriteListFcy.searchByName(context, token, fac.TagSearchData.Offset, fac.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- } else if (chooseOption == 3) {
- selectize3.addOption(result);
- selectize3.refreshOptions();
- }
- fac.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- }
- function AddProgramCtrl(UserSrv,$rootScope,SiteConstants,ProgressBarFcy,ProgramSrv,$routeParams,$window,SecurityFcy,ArtistFcy,ProgramFcy) {
- var apc = this;
- apc.ProgramStatus = { InProgress:false};
- $rootScope.Page.Title="افزودن اطلاعات برنامه";
- $rootScope.$broadcast("UserData");
- apc.ArtisSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- apc.TagSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- apc.CountrySearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- apc.ArtistSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- apc.Directors = null;
- apc.Provider = {};
- apc.Actors = null;
- apc.Genres = {};
- apc.Categoires = {};
- apc.favLists = null;
- ProgressBarFcy.setDone();
- var selectize,selectize2,selectize3,selectize4,selectize5,selectize6,toArrayConversion = [],toArrayConversion2 = [],counter=0;
- apc.ProgramData = {};
- apc.importanceModel = [{id:1,title:"سطح ۱"},{id:2,title:"سطح ۲"},{id:3,title:"سطح ۳"},{id:4,title:"سطح ۴"},{id:5,title:"سطح ۵"}];
- UserSrv.getUser().then(function (result) {
- if(typeof result!='undefined' && result!=null && typeof result.token!='undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))){
- }
- else {
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- apc.saveProgram = function () {
- counter = 0;
- $("#check-checkboxes input[type=checkbox]").each(function () {
- if($(this).is(":checked")){
- toArrayConversion[counter] = $(this).attr("ng-value");
- counter++;
- }
- });
- counter = 0;
- $("#check-checkboxes2 input[type=checkbox]").each(function () {
- if($(this).is(":checked")){
- toArrayConversion2[counter] = $(this).attr("ng-value");
- counter++;
- }
- });
- if(toArrayConversion.length>0) {
- //toArrayConversion[toArrayConversion.length] = "";
- apc.Genres = toArrayConversion.join();
- }else{
- apc.Genres = "";
- }
- if(toArrayConversion2.length>0){
- //toArrayConversion2[toArrayConversion2.length] = "";
- apc.Categoires = toArrayConversion2.join();
- } else{
- apc.Categoires = "";
- }
- apc.ProgramStatus.InProgress = true;
- SecurityFcy.getUserToken().then(function (token) {
- if(typeof apc.Actors=='object'){
- apc.Actors='';
- }
- var copyright_type = $("input[name=copyright-type]:checked").val();
- ProgramSrv.createProgram(apc.ProgramData.id, apc.ProgramData.title, apc.ProgramData.title_english,
- apc.ProgramData.summary_fa, apc.ProgramData.summary_en, apc.ProgramData.tags, apc.ProgramData.downloadable,
- apc.ProgramData.enable, apc.ProgramData.is_singleton, apc.ProgramData.keywords_english,
- apc.ProgramData.page_description, apc.Actors, apc.Directors, apc.Producer, apc.Authors, apc.Others,
- apc.Genres, apc.Categoires, token,copyright_type,apc.copyright,apc.ProgramData.importance).then(function (result) {
- toArrayConversion = [];
- toArrayConversion2 = [];
- if(result!=-1){
- apc.ProgramStatus.InProgress = false;
- NgNote.Success('اطلاعات اپیزود با موفقیت به ثبت رسید',5);
- }else {
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید',5);
- apc.ProgramStatus.InProgress = false;
- }
- })
- });
- };
- apc.SearchArtist = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- ArtistFcy.searchByName(context, token, apc.ArtistSearchData.Offset, apc.ArtistSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- } else if (chooseOption == 3) {
- selectize3.addOption(result);
- selectize3.refreshOptions();
- } else if (chooseOption == 4) {
- selectize4.addOption(result);
- selectize4.refreshOptions();
- }else if (chooseOption == 5) {
- selectize5.addOption(result);
- selectize5.refreshOptions();
- }
- apc.ArtistSearchData.Items = result;
- itemLoading.hide();
- })
- });
- }else{
- itemLoading.hide();
- }
- };
- apc.SearchFavoriteList = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- FavoriteListFcy.searchByName(context, token, apc.TagSearchData.Offset, apc.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- } else if (chooseOption == 3) {
- selectize3.addOption(result);
- selectize3.refreshOptions();
- }
- apc.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- apc.SearchCountry = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- ProgramFcy.searchCountryByName(context, token, apc.CountrySearchData.Offset, apc.CountrySearchData.Limit).then(function (result) {
- if (chooseOption == 8) {
- selectize6.addOption(result);
- selectize6.refreshOptions();
- }
- apc.CountrySearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- apc.SearchTag = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- TagFcy.searchByName(context, token, apc.TagSearchData.Offset, apc.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- }
- apc.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- setTimeout(function () {
- $("#picture-form option").eq(0).remove();
- // replacePipelineAddress.replace($(this).find("img"));
- // replacePipelineAddressAngular();
- var $select6 = $('.taggings').selectize({
- delimiter: ',',
- persist: false,
- create: function (input) {
- return {
- value: input,
- text: input
- }
- }
- });
- $('#KeywordsEnglish').selectize({
- delimiter: '#',
- persist: false,
- create: function (input) {
- return {
- value: input,
- text: input
- }
- }
- });
- var $select = $('#director').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: input,
- text: input
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select6 = $('#copyright-field').selectize({
- valueField: 'descriptor',
- labelField: 'name',
- searchField: 'name',
- create: function (input) {
- return {
- value: input,
- text: input
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select = $('#director').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: input,
- text: input
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select2 = $('#Actors').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: input,
- text: input
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select3 = $('#producer').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: input,
- text: input
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select4 = $('#writer').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: input,
- text: input
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select5 = $('#other-cast').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: input,
- text: input
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- selectize = $select[0].selectize;
- selectize2 = $select2[0].selectize;
- selectize3 = $select3[0].selectize;
- selectize4 = $select4[0].selectize;
- selectize5 = $select5[0].selectize;
- selectize6 = $select6[0].selectize;
- $('#writer').val("");
- $("#director").val("");
- $("#other-cast").val("");
- $("#producer").val("");
- $("#Actors").val("");
- remainCount.countRemain("PageDescription", 300);
- if (apc.ProgramData.enable) {
- apc.ProgramData.enable = true;
- }
- if (apc.ProgramData.is_singleton) {
- apc.ProgramData.is_singleton = true;
- }
- if (apc.ProgramData.downloadable) {
- apc.ProgramData.downloadable = true;
- }
- });
- var itemLoading = null;
- var t = null;
- var chooseOption = null;
- $(document).on("input",".artist-search .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 1;
- var value = $(this).val();
- t = setTimeout(function(){apc.SearchArtist(value)},800);
- });
- $(document).on("input",".country-list .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 8;
- var value = $(this).val();
- t = setTimeout(function(){apc.SearchCountry(value)},800);
- });
- $(document).on("input",".search-writer .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 4;
- var value = $(this).val();
- t = setTimeout(function(){apc.SearchArtist(value)},800);
- });
- $(document).on("input",".search-main-artist .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 2;
- var value = $(this).val();
- t = setTimeout(function(){apc.SearchArtist(value)},800);
- });
- $(document).on("input",".search-provider .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 3;
- var value = $(this).val();
- t = setTimeout(function(){apc.SearchArtist(value)},800);
- });
- $(document).on("input",".other-cast .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 5;
- var value = $(this).val();
- t = setTimeout(function(){apc.SearchArtist(value)},800);
- });
- $(document).on("input","#PageDescription",function () {
- remainCount.countRemain("PageDescription",300);
- });
- }
- function EditProgramCtrl(UserSrv,$rootScope,SiteConstants,ProgressBarFcy,ProgramSrv,$routeParams,$window,SecurityFcy,ArtistFcy,ProgramFcy) {
- var epc = this;
- epc.ProgramStatus = { InProgress:false};
- $rootScope.Page.Title="ویرایش اطلاعات برنامه";
- $rootScope.$broadcast("UserData");
- epc.ArtisSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- epc.TagSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- epc.CountrySearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- epc.ArtistSearchData={Offset:0,Limit:15,UpdateInProgress:false,Items:[],Page:0};
- epc.Directors = null;
- epc.Provider = {};
- epc.Actors = null;
- epc.Genres = {};
- epc.Categoires = {};
- epc.favLists = null;
- // epc.HoursList = [];
- // epc.MinutesList = [];
- // epc.publishedMinute = 0;
- // epc.publishedHour = 0;
- // for(var i = 0;i<=24;i++){
- // var item = {id:0,title:0};
- // item.id = i;
- // item.title = i+ ' ساعت ';
- // epc.HoursList.push(item)
- // }
- // for(var i = 0;i<60;i++){
- // var item = {id:0,title:0};
- // item.id = i;
- // item.title = i + ' دقیقه ';
- // epc.MinutesList.push(item)
- // }
- ProgressBarFcy.setDone();
- var selectize,selectize2,selectize3,selectize4,selectize5,selectize6,toArrayConversion = [],toArrayConversion2 = [],counter=0;
- epc.ProgramData = {};
- epc.importanceModel = [{id:1,title:"سطح ۱"},{id:2,title:"سطح ۲"},{id:3,title:"سطح ۳"},{id:4,title:"سطح ۴"},{id:5,title:"سطح ۵"}];
- UserSrv.getUser().then(function (result) {
- if(typeof result!='undefined' && result!=null && typeof result.token!='undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))){
- SecurityFcy.getUserToken().then(function (token) {
- // CalendarSetup.setup("show_time")
- epc.GetProgram($routeParams.Id, token);
- });
- }
- else {
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- epc.saveProgram = function () {
- counter = 0;
- $("#check-checkboxes input[type=checkbox]").each(function () {
- if($(this).is(":checked")){
- toArrayConversion[counter] = $(this).attr("ng-value");
- counter++;
- }
- });
- counter = 0;
- $("#check-checkboxes2 input[type=checkbox]").each(function () {
- if($(this).is(":checked")){
- toArrayConversion2[counter] = $(this).attr("ng-value");
- counter++;
- }
- });
- if(toArrayConversion.length>0) {
- //toArrayConversion[toArrayConversion.length] = "";
- epc.Genres = toArrayConversion.join();
- }else{
- epc.Genres = "";
- }
- if(toArrayConversion2.length>0){
- //toArrayConversion2[toArrayConversion2.length] = "";
- epc.Categoires = toArrayConversion2.join();
- } else{
- epc.Categoires = "";
- }
- epc.ProgramStatus.InProgress = true;
- SecurityFcy.getUserToken().then(function (token) {
- if(typeof epc.Actors=='object'){
- epc.Actors='';
- }
- var copyright_type = $("input[name=copyright-type]:checked").val();
- if(epc.Genres.length >= 1 && epc.Categoires.length >= 1) {
- ProgramSrv.saveProgram(epc.ProgramData.id, epc.ProgramData.title, epc.ProgramData.title_english,
- epc.ProgramData.summary_fa, epc.ProgramData.summary_en, epc.ProgramData.tags, epc.ProgramData.downloadable,
- epc.ProgramData.enable, epc.ProgramData.is_singleton, epc.ProgramData.keywords_english,
- epc.ProgramData.page_description, epc.Actors, epc.Directors, epc.Producer, epc.Authors, epc.Others,
- epc.Genres, epc.Categoires, token, copyright_type, epc.copyright, epc.ProgramData.importance).then(function (result) {
- toArrayConversion = [];
- toArrayConversion2 = [];
- if (result != -1) {
- epc.ProgramStatus.InProgress = false;
- NgNote.Success('اطلاعات اپیزود با موفقیت به ثبت رسید', 5);
- } else {
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید', 5);
- epc.ProgramStatus.InProgress = false;
- }
- })
- }else{
- epc.ProgramStatus.InProgress = false;
- alert("ژانر و دسته بندی اجباری میباشد.");
- }
- });
- };
- epc.SearchArtist = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- ArtistFcy.searchByName(context, token, epc.ArtistSearchData.Offset, epc.ArtistSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- } else if (chooseOption == 3) {
- selectize3.addOption(result);
- selectize3.refreshOptions();
- } else if (chooseOption == 4) {
- selectize4.addOption(result);
- selectize4.refreshOptions();
- }else if (chooseOption == 5) {
- selectize5.addOption(result);
- selectize5.refreshOptions();
- }
- epc.ArtistSearchData.Items = result;
- itemLoading.hide();
- })
- });
- }else{
- itemLoading.hide();
- }
- };
- epc.SearchFavoriteList = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- FavoriteListFcy.searchByName(context, token, epc.TagSearchData.Offset, epc.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- } else if (chooseOption == 3) {
- selectize3.addOption(result);
- selectize3.refreshOptions();
- }
- epc.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- epc.SearchCountry = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- ProgramFcy.searchCountryByName(context, token, epc.CountrySearchData.Offset, epc.CountrySearchData.Limit).then(function (result) {
- if (chooseOption == 8) {
- selectize6.addOption(result);
- selectize6.refreshOptions();
- }
- epc.CountrySearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- epc.SearchTag = function (context) {
- if(context.length >= 3){
- SecurityFcy.getUserToken().then(function (token) {
- TagFcy.searchByName(context, token, epc.TagSearchData.Offset, epc.TagSearchData.Limit).then(function (result) {
- if (chooseOption == 1) {
- selectize.addOption(result);
- selectize.refreshOptions();
- } else if (chooseOption == 2) {
- selectize2.addOption(result);
- selectize2.refreshOptions();
- }
- epc.TagSearchData.Items = result;
- itemLoading.hide();
- })
- })
- }else{
- itemLoading.hide();
- }
- };
- epc.GetProgram = function (Id, Token) {
- ProgramSrv.getFullProgram(Id, Token).then(function (result) {
- epc.ProgramData = result;
- setTimeout(function () {
- $("#picture-form option").eq(0).remove();
- // replacePipelineAddress.replace($(this).find("img"));
- // replacePipelineAddressAngular();
- var $select6 = $('.taggings').selectize({
- delimiter: ',',
- persist: false,
- create: function (input) {
- return {
- value: input,
- text: input
- }
- }
- });
- $('#KeywordsEnglish').selectize({
- delimiter: '#',
- persist: false,
- create: function (input) {
- return {
- value: input,
- text: input
- }
- }
- });
- var $select = $('#director').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: result.id,
- text: result.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select6 = $('#copyright-field').selectize({
- valueField: 'descriptor',
- labelField: 'name',
- searchField: 'name',
- create: function (input) {
- return {
- value: input,
- text: input
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select = $('#director').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: result.id,
- text: result.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select2 = $('#Actors').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: result.id,
- text: result.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select3 = $('#producer').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: result.id,
- text: result.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select4 = $('#writer').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: result.id,
- text: result.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- var $select5 = $('#other-cast').selectize({
- valueField: 'id',
- labelField: 'title',
- searchField: 'title',
- create: function (input) {
- return {
- value: result.id,
- text: result.name
- }
- },
- render: {
- option_create: function (data, escape) {
- return '';
- }
- }
- });
- selectize = $select[0].selectize;
- selectize2 = $select2[0].selectize;
- selectize3 = $select3[0].selectize;
- selectize4 = $select4[0].selectize;
- selectize5 = $select5[0].selectize;
- selectize6 = $select6[0].selectize;
- $('#writer').val("");
- $("#director").val("");
- $("#other-cast").val("");
- $("#producer").val("");
- $("#Actors").val("");
- remainCount.countRemain("PageDescription",300);
- if(result.others !== undefined) {
- for (var i = 0; i <= result.others.length - 1; i++) {
- selectize5.addOption(result.others[i]);
- selectize5.addItem(result.others[i].id);
- }
- }
- if(result.program_countries !== undefined){
- for (var i = 0; i <= result.program_countries.length - 1; i++) {
- selectize6.addOption(result.program_countries[i]);
- selectize6.addItem(result.program_countries[i].id);
- }
- }
- if(result.directors !== undefined) {
- for (var i = 0; i <= result.directors.length - 1; i++) {
- selectize.addOption(result.directors[i]);
- selectize.addItem(result.directors[i].id);
- }
- }
- if(result.writers !== undefined) {
- for (var i = 0; i <= result.writers.length - 1; i++) {
- selectize4.addOption(result.writers[i]);
- selectize4.addItem(result.writers[i].id);
- }
- }
- if(result.producer !== undefined) {
- for (var i = 0; i <= result.producer.length - 1; i++) {
- selectize3.addOption(result.producer[i]);
- selectize3.addItem(result.producer[i].id);
- }
- }
- if(result.artists !== undefined) {
- for (var i = 0; i <= result.artists.length - 1; i++) {
- selectize2.addOption(result.artists[i]);
- selectize2.addItem(result.artists[i].id);
- }
- }
- if(result.genres !== undefined) {
- for (var i = 0; i <= result.genres.length - 1; i++) {
- $("input[ng-value=" + result.genres[i].id + "]").attr("checked", "checked");
- }
- }
- if(result.categories !== undefined) {
- for (var i = 0; i <= result.categories.length - 1; i++) {
- $("input[ng-value=" + result.categories[i].id + "]").attr("checked", "checked");
- }
- }
- },200);
- if (epc.ProgramData.enable) {
- epc.ProgramData.enable = true;
- }
- if (epc.ProgramData.is_singleton) {
- epc.ProgramData.is_singleton = true;
- }
- if (epc.ProgramData.downloadable) {
- epc.ProgramData.downloadable = true;
- }
- });
- };
- var itemLoading = null;
- var t = null;
- var chooseOption = null;
- $(document).on("input",".artist-search .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 1;
- var value = $(this).val();
- t = setTimeout(function(){epc.SearchArtist(value)},800);
- });
- $(document).on("input",".country-list .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 8;
- var value = $(this).val();
- t = setTimeout(function(){epc.SearchCountry(value)},800);
- });
- $(document).on("input",".search-writer .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 4;
- var value = $(this).val();
- t = setTimeout(function(){epc.SearchArtist(value)},800);
- });
- $(document).on("input",".search-main-artist .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 2;
- var value = $(this).val();
- t = setTimeout(function(){epc.SearchArtist(value)},800);
- });
- $(document).on("input",".search-provider .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 3;
- var value = $(this).val();
- t = setTimeout(function(){epc.SearchArtist(value)},800);
- });
- $(document).on("input",".other-cast .selectize-input input",function () {
- if(t!=null){
- clearTimeout(t);
- }
- itemLoading = $(this).parents(".input-holder").find(".loader");
- if($(this).val().length>3){
- itemLoading.show();
- }
- chooseOption = 5;
- var value = $(this).val();
- t = setTimeout(function(){epc.SearchArtist(value)},800);
- });
- $(document).on("input","#PageDescription",function () {
- remainCount.countRemain("PageDescription",300);
- });
- }
- function PartnerCtrl($rootScope,SiteConstants,ProgressBarFcy){
- $rootScope.Page.Title= SiteConstants.Fa.PageTitle.Partners;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- }
- function AngularFileUploader($rootScope,Upload) {
- var modelName = 'episode';
- $rootScope.upload = function (file) {
- Upload.upload({
- url: 'http://telewebion.com/op?action=uploadImage&token=testewojfsdaojsodfjsdoifjdsofi&model='+modelName+'&episode=1455899',
- data: {
- image: file
- },
- headers: {
- 'Content-Type': file.type,
- 'Access-Control-Allow-Headers': 'Content-Type',
- 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
- 'Access-Control-Allow-Origin': '*'
- },
- method: 'POST',
- }).then(function (resp) {
- console.log('Success ' + 'uploaded. Response: ' + resp.data);
- }, function (resp) {
- console.log('Error status: ' + resp.status);
- }, function (evt) {
- var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
- $rootScope.StatusPercentage=progressPercentage + '%';
- });
- };
- }
- function replacePipelineAddressAngular(){
- $(".image-thumbnail-container img").each(function () {
- var elem = $(this);
- var arrayOfImageItems = elem.attr("src").split("static");
- var result = "";
- for(i=0;i<arrayOfImageItems.length;i++){
- if(i==1){
- result += "static.pipeline";
- }
- result += arrayOfImageItems[i];
- }
- elem.attr("src",result);
- });
- }
- function AngularFileCrop($rootScope,$scope,ImageUploadFcy,SecurityFcy) {
- $scope.model=null;
- $scope.itemId=null;
- $scope.type=null;
- $scope.token='not-token';
- $scope.UploadInProgress = false;
- $scope.ImageBinray=null;
- $scope.finalResult=null;
- $scope.isCompleted=false;
- $scope.fileChanged = function(e) {
- var files = e.target.files;
- var fileReader = new FileReader();
- fileReader.readAsDataURL(files[0]);
- fileReader.onload = function(e) {
- $scope.imgSrc = this.result;
- $scope.$apply();
- };
- }
- $scope.clear = function() {
- $scope.imageCropStep = 1;
- delete $scope.imgSrc;
- delete $scope.result;
- delete $scope.result2;
- delete $scope.resultBlob;
- delete $scope.resultBlob2;
- };
- $scope.UploadImageForMobile = function () {
- $scope.UploadInProgress = true;
- $scope.model = 'promotion';
- $scope.type = 'small';
- $scope.itemId = $rootScope.sliderId;
- setTimeout(function () {
- SecurityFcy.getUserToken().then(function (token) {
- if($scope.imgSrc.length > 100) {
- ImageUploadFcy.upload($scope.imgSrc, $scope.model, token, $scope.itemId, $scope.type).then(function (result) {
- console.log(result);
- if (result.status != -1) {
- $scope.UploadInProgress = false;
- NgNote.Success('عکس اپیزود با موفقیت به روز شد', 5);
- }
- else {
- $scope.UploadInProgress = false;
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید', 5);
- }
- });
- }
- });
- window.location.href="/#!/admin/promotions/list";
- }, 2000);
- }
- $scope.UploadImageLargeWeb = function () {
- $scope.UploadInProgress = true;
- $scope.model = 'promotion';
- $scope.type = 'large';
- $scope.itemId = $rootScope.sliderId;
- setTimeout(function () {
- SecurityFcy.getUserToken().then(function (token) {
- if($scope.imgSrc.length > 100) {
- ImageUploadFcy.upload($scope.imgSrc, $scope.model, token, $scope.itemId, $scope.type).then(function (result) {
- console.log(result);
- if (result.status != -1) {
- $scope.UploadInProgress = false;
- NgNote.Success('عکس اپیزود با موفقیت به روز شد', 5);
- }
- else {
- $scope.UploadInProgress = false;
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید', 5);
- }
- });
- }
- });
- }, 2000);
- }
- $scope.UploadImageSmallWeb = function () {
- $scope.model = 'promotion';
- $scope.type = 'medium';
- $scope.itemId = $rootScope.sliderId;
- $scope.UploadInProgress = true;
- setTimeout(function () {
- SecurityFcy.getUserToken().then(function (token) {
- if($scope.imgSrc.length > 100) {
- ImageUploadFcy.upload($scope.imgSrc, $scope.model, token, $scope.itemId, $scope.type).then(function (result) {
- console.log(result);
- if (result.status != -1) {
- $scope.UploadInProgress = false;
- NgNote.Success('عکس اپیزود با موفقیت به روز شد', 5);
- }
- else {
- $scope.UploadInProgress = false;
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید', 5);
- }
- });
- }
- });
- window.location.href="/#!/admin/promotions/list";
- }, 2000);
- }
- $scope.UploadImage = function () {
- $scope.UploadInProgress = true;
- setTimeout(function () {
- SecurityFcy.getUserToken().then(function (token) {
- if ($scope.typeOfImageSelected == "cover"){
- ImageUploadFcy.upload($scope.result2, $scope.model, token, $scope.itemId, $scope.type).then(function (result) {
- if (result.status != -1) {
- $scope.UploadInProgress = false;
- NgNote.Success('عکس اپیزود با موفقیت به روز شد', 5);
- }
- else {
- $scope.UploadInProgress = false;
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید', 5);
- }
- });
- }else
- {
- ImageUploadFcy.upload($scope.result, $scope.model, token, $scope.itemId, $scope.type).then(function (result) {
- if (result.status != -1) {
- $scope.UploadInProgress = false;
- NgNote.Success('عکس اپیزود با موفقیت به روز شد', 5);
- }
- else {
- $scope.UploadInProgress = false;
- NgNote.Error('خطا در ارسال داده به سرور، لطفا مجددا تلاش نمایید', 5);
- }
- });
- }
- });
- },1000);
- };
- }
- function ListOfProgramCtrl(UserSrv,$rootScope,SiteConstants,ProgressBarFcy,ProgramSrv,ProgramFcy,$window,SecurityFcy,ChannelFcy) {
- $rootScope.Page.Title="لیست برنامه ها";
- var lpc = this;
- lpc.ProgramList = {offset:0,limit:50,UpdateInProgress:true,Programs:null};
- lpc.Pagination = [];
- lpc.Channels = {};
- lpc.filteredActive = false;
- lpc.filteredPrograms = {filteredItems:{},isActive:false,isSingleton:false,title:null,from_date:null,to_date:null,channelId:null,offset:0,limit:50,token:null}
- UserSrv.getUser().then(function (result) {
- if(typeof result!='undefined' && result!=null && typeof result.token!='undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- SecurityFcy.getUserToken().then(function (token) {
- ProgramFcy.getProgramList(lpc.ProgramList.offset,lpc.ProgramList.limit,token).then(function (data) {
- lpc.ProgramList.UpdateInProgress = false;
- lpc.ProgramList.Programs = data;
- ProgressBarFcy.setDone();
- })
- })
- ChannelFcy.getChannels().then(function (data) {
- lpc.Channels = data;
- })
- CalendarSetup.setup("from_date");
- CalendarSetup.setup("to_date");
- for (var i = 1; i <= 50; i++) {
- lpc.Pagination[i - 1] = i;
- }
- lpc.deleteProgram = function (id) {
- SecurityFcy.getUserToken().then(function (token) {
- var cnf = showConfirm.verify();
- if (cnf) {
- NgNote.Success('برنامه مورد نظر با موفقیت حذف شد.',3);
- $(".program-row[data-row="+id+"]").remove();
- ProgramSrv.deleteProgram(id, token);
- }
- });
- }
- $(document).on("click", ".page", function () {
- var index = $(this).data("page");
- lpc.ProgramList.offset = (index - 1) * 50;
- lpc.ProgramList.UpdateInProgress = true;
- SecurityFcy.getUserToken().then(function (token) {
- if(!lpc.filteredActive) {
- ProgramFcy.getProgramList(lpc.ProgramList.offset, lpc.ProgramList.limit, token).then(function (data) {
- lpc.ProgramList.Programs = data;
- lpc.ProgramList.UpdateInProgress = false;
- })
- }else {
- ProgramFcy.getProgramWithFilter(lpc.filteredPrograms.offset, lpc.filteredPrograms.limit,
- token, lpc.filteredPrograms.channelId, lpc.filteredPrograms.from_date, lpc.filteredPrograms.to_date,
- lpc.filteredPrograms.isActive, lpc.filteredPrograms.isSingleton, lpc.filteredPrograms.title).then(function (data) {
- lpc.ProgramList.Programs = data;
- lpc.ProgramList.UpdateInProgress = false;
- })
- }
- });
- });
- }else{
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- })
- lpc.filterPrograms = function () {
- if(!$("#from_date").val() || !$("#to_date").val()){
- alert(" تاریخ شروع و پایان را باید انتخاب کنید. ");
- }else{
- if($("input[name=is_singleton]:checked").val() == "yes"){
- lpc.filteredPrograms.isSingleton = true;
- }else if($("input[name=is_singleton]:checked").val() == "no"){
- lpc.filteredPrograms.isSingleton = false;
- }else{
- lpc.filteredPrograms.isSingleton = null;
- }
- if($("input[name=status]:checked").val() == "active"){
- lpc.filteredPrograms.isActive = true;
- }else if($("input[name=status]:checked").val() == "deactive"){
- lpc.filteredPrograms.isActive = false;
- }else{
- lpc.filteredPrograms.isActive = null;
- }
- if($("#title-search").val().length >= 3){
- lpc.filteredPrograms.title = $("#title-search").val();
- }else{
- lpc.filteredPrograms.title = null;
- }
- if($("select[name=channelSelect]").val().length > 0){
- lpc.filteredPrograms.channelId = $("select[name=channelSelect]").val();
- }else{
- lpc.filteredPrograms.channelId = null;
- }
- lpc.ProgramList.UpdateInProgress = true;
- var date = new JDate($("#from_date").val());
- var month = parseInt(date._date.getMonth()) + 1;
- var day = parseInt(date._date.toString().split(" ")[2]);
- var year = date._date.getFullYear();
- var MiladiDate = new Date(year, month, parseInt(day));
- var show_time = "";
- if(MiladiDate.getMonth() == 0){
- show_time = (MiladiDate.getFullYear()-1 + "-" + "12" + "-" + day);
- }else {
- show_time = (MiladiDate.getFullYear() + "-" + MiladiDate.getMonth() + "-" + day);
- }
- lpc.filteredPrograms.from_date = show_time;
- var date2 = new JDate($("#to_date").val());
- month = parseInt(date2._date.getMonth()) + 1;
- day = parseInt(date2._date.toString().split(" ")[2]);
- year = date2._date.getFullYear();
- MiladiDate = new Date(year, month, parseInt(day));
- if(MiladiDate.getMonth() == 0){
- show_time = (MiladiDate.getFullYear()-1 + "-" + "12" + "-" + day);
- }else {
- show_time = (MiladiDate.getFullYear() + "-" + MiladiDate.getMonth() + "-" + day);
- }
- lpc.filteredPrograms.to_date = show_time;
- SecurityFcy.getUserToken().then(function (token) {
- ProgramFcy.getProgramWithFilter(lpc.filteredPrograms.offset,lpc.filteredPrograms.limit,
- token,lpc.filteredPrograms.channelId,lpc.filteredPrograms.from_date,lpc.filteredPrograms.to_date,
- lpc.filteredPrograms.isActive,lpc.filteredPrograms.isSingleton,lpc.filteredPrograms.title).then(function (data) {
- lpc.ProgramList.Programs = data;
- lpc.filteredActive = true;
- lpc.ProgramList.UpdateInProgress = false;
- });
- })
- }
- }
- }
- function ListOfEpisodesCtrl(UserSrv,$rootScope,SiteConstants,ProgressBarFcy,ProgramSrv,$routeParams,$window,SecurityFcy,EpisodeFcy,EpisodeSrv,ChannelFcy,$scope) {
- var lec = this;
- $rootScope.Page.Title="لیست قسمت برنامه ها";
- lec.EpisodeList = {offset:0,limit:50,UpdateInProgress:true,Episodes:null};
- lec.Pagination = [];
- lec.Channels = {};
- lec.applyChannelChanges = function () {
- lec.EpisodeList.offset = 0;
- lec.EpisodeList.limit = 800;
- lec.EpisodeList.UpdateInProgress = true;
- EpisodeFcy.getEpisodeByDateAndChannel($("#input_calendar").val(),$scope.channelId,lec.EpisodeList.offset,lec.EpisodeList.limit).then(function(result) {
- lec.EpisodeList.Episodes = result;
- lec.EpisodeList.UpdateInProgress = false;
- });
- }
- UserSrv.getUser().then(function (result) {
- if(typeof result!='undefined' && result!=null && typeof result.token!='undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))) {
- SecurityFcy.getUserToken().then(function (token) {
- EpisodeFcy.getEpisodeLists(lec.EpisodeList.limit, lec.EpisodeList.offset, token).then(function (data) {
- lec.EpisodeList.Episodes = data;
- lec.EpisodeList.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- CalendarSetup.setup("input_calendar")
- })
- });
- ChannelFcy.getChannels().then(function (data) {
- lec.Channels = data;
- })
- for (var i = 1; i <= 50; i++) {
- lec.Pagination[i - 1] = i;
- }
- lec.deleteEpisode = function (id) {
- SecurityFcy.getUserToken().then(function (token) {
- var cnf = showConfirm.verify();
- if (cnf) {
- NgNote.Success('قسمت برنامه مورد نظر با موفقیت حذف شد.',3);
- $(".episode-row[data-row="+id+"]").remove();
- EpisodeSrv.deleteEpisode(id, token);
- }
- });
- }
- $(document).on("click", ".page", function () {
- var index = $(this).data("page");
- lec.EpisodeList.offset = (index - 1) * 50;
- lec.EpisodeList.UpdateInProgress = true;
- lec.EpisodeList.limit = 50;
- SecurityFcy.getUserToken().then(function (token) {
- EpisodeFcy.getEpisodeLists(lec.EpisodeList.limit, lec.EpisodeList.offset, token).then(function (data) {
- lec.EpisodeList.Episodes = data;
- lec.EpisodeList.UpdateInProgress = false;
- })
- });
- });
- }else{
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- }
- function ListOfFavListCtrl(UserSrv,$rootScope,SiteConstants,ProgressBarFcy,ProgramSrv,$routeParams,$window,SecurityFcy,FavoriteListFcy) {
- var flc = this;
- $rootScope.Page.Title="لیست های تماشا";
- $rootScope.$broadcast("UserData");
- flc.FavoriteLists={Offset:0,Limit:100,UpdateInProgress:false,Items:[],Page:0};
- ProgressBarFcy.setDone();
- flc.getList = function () {
- SecurityFcy.getUserToken().then(function (token){
- flc.FavoriteLists.UpdateInProgress = true;
- FavoriteListFcy.getList(flc.FavoriteLists.Offset, flc.FavoriteLists.Limit, $routeParams.Id, token).then(function (result) {
- flc.FavoriteLists.Items = result;
- flc.FavoriteLists.UpdateInProgress = false;
- ProgressBarFcy.setDone();
- })
- })
- }
- flc.getList();
- flc.deleteFromFavoriteList = function (id) {
- SecurityFcy.getUserToken().then(function (token) {
- var cnf = showConfirm.verify();
- if(cnf) {
- FavoriteListFcy.deleteList(id, token).then(function (result) {
- NgNote.Success("لیست مورد نظر با موفقیت حذف شد", 3);
- $(".table-for-list tr[data-row=" + id + "]").remove();
- })
- }
- });
- }
- }
- function TagCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy, TagPageFcy,$routeParams,FavoriteListSrv,$timeout) {
- var tac = this;
- tac.TagsData = {UpdateInProgress:true,Page:0,limit:50,offset:0,Items:[],isGetNext:true}
- tac.TagsProgramData = {UpdateInProgress:true,Page:0,limit:14,offset:0,Items:[],isGetNext:true}
- tac.pageTitle = $routeParams.name;
- tac.pageTitleEscaped = $routeParams.name;
- $rootScope.Page.Title = "جستجوی برنامه ها و قسمت برنامه های تگ " + tac.pageTitle;
- $timeout(function () {
- $("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- event:"getnext"
- });
- },2000);
- tac.getPrograms = function () {
- tac.TagsProgramData.UpdateInProgress = true;
- ProgressBarFcy.setDone();
- TagPageFcy.getTagPrograms(tac.TagsProgramData.limit,tac.TagsProgramData.offset,tac.pageTitle).then(function (result) {
- $timeout(function () {
- $("img.lazyload").lazyload();
- },1000)
- tac.TagsProgramData.Page++;
- if(result.data[0].programs.length == 0){
- tac.TagsProgramData.isGetNext = false;
- }
- var tempArray=[];
- var tempArray2=[];
- if(result.data[0].programs.length > 0) {
- tempArray.push(result.data[0].programs);
- tempArray2.push(tac.TagsProgramData.Items);
- tac.TagsProgramData.Items = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- tac.TagsProgramData.UpdateInProgress = false;
- $timeout(function () {
- $(".carousel-image-container img").each(function () {
- $(this).error(function () {
- if (!$(this).attr("data-replaced"))
- replacePipelineAddress.replace($(this));
- })
- })
- }, 200);
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- }, 200);
- }
- })
- }
- tac.getTags = function () {
- tac.TagsData.UpdateInProgress = true;
- ProgressBarFcy.setDone();
- tac.TagsData.UpdateInProgress = false;
- TagPageFcy.getTagEpisodes(tac.TagsData.limit,tac.TagsData.offset,tac.pageTitle).then(function (result) {
- $timeout(function () {
- $("img.lazyload").lazyload();
- },1000)
- tac.TagsData.Page++;
- var tempArray=[];
- var tempArray2=[];
- if(result.data[0].episodes.length == 0){
- tac.TagsData.isGetNext = false;
- }
- if(result.data[0].episodes.length > 0) {
- tempArray.push(result.data[0].episodes);
- tempArray2.push(tac.TagsData.Items);
- tac.TagsData.Items = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- tac.TagsData.UpdateInProgress = false;
- $timeout(function () {
- $(".carousel-image-container img").each(function () {
- $(this).error(function () {
- if (!$(this).attr("data-replaced"))
- replacePipelineAddress.replace($(this));
- })
- })
- }, 200);
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- }, 200);
- }
- })
- }
- tac.getNextProgram = function () {
- tac.TagsProgramData.UpdateInProgress = true;
- if(tac.TagsProgramData.isGetNext) {
- tac.TagsProgramData.limit = ((tac.TagsProgramData.Page + 1) == 1) ? 14 : 14;
- tac.TagsProgramData.offset = ((tac.TagsProgramData.Page + 1) == 1) ? 0 : ((tac.TagsProgramData.Page) * 14);
- tac.getPrograms();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- }, 200);
- }
- }
- tac.getNext=function() {
- if (tac.TagsData.isGetNext) {
- tac.TagsData.UpdateInProgress = true;
- tac.TagsData.limit = ((tac.TagsData.Page + 1) == 1) ? 50 : 50;
- tac.TagsData.offset = ((tac.TagsData.Page + 1) == 1) ? 0 : ((tac.TagsData.Page) * 50);
- tac.getTags();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- }, 200);
- }
- }
- tac.getTags();
- tac.getPrograms();
- }
- function TagsCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy, FavoriteListFcy,$routeParams,FavoriteListSrv,$timeout) {
- var tgc = this;
- $timeout(function () {
- $("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- event:"getnext"
- });
- },1000);
- $(".position-fix-carousel").scroll(function () {
- $(document).scroll()
- })
- $(document).on("click",".slick-next,.slick-prev",function () {
- $(document).scroll()
- setTimeout(function () {
- $(document).scroll()
- },600)
- })
- tgc.TagsData={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- tgc.ChildTags={Offset:0,Limit:100,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- tgc.ParentTags={Offset:0,Limit:100,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- tgc.getSlider = function () {
- SliderFcy.getTags().then(function (result) {
- tgc.Sliders=result;
- ProgressBarFcy.plus(0.1);
- TopCarousel.initCarousel();
- })
- }
- $rootScope.Page.Title= "لیست قسمت برنامه های تگ ";
- tgc.getSlider()
- tgc.getEpisodes = function () {
- tgc.TagsData.UpdateInProgress = true;
- ProgressBarFcy.setDone();
- FavoriteListFcy.getEpisodeList($routeParams.Id, tgc.TagsData.Offset, tgc.TagsData.Limit).then(function (result) {
- tgc.TagsData.Page ++;
- var tempArray=[];
- var tempArray2=[];
- tgc.TagsData.UpdateInProgress = false;
- if(result.length > 0) {
- tempArray.push(result);
- tempArray2.push(tgc.TagsData.Episodes);
- tgc.TagsData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- tgc.TagsData.UpdateInProgress = false;
- $timeout(function () {
- $(".carousel-image-container img").each(function () {
- $(this).error(function () {
- if (!$(this).attr("data-replaced"))
- replacePipelineAddress.replace($(this));
- })
- })
- }, 200);
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- }, 200);
- }
- })
- }
- tgc.getNext=function(){
- tgc.TagsData.UpdateInProgress = true;
- tgc.TagsData.Limit=((tgc.TagsData.Page+1)==1)?50:50;
- tgc.TagsData.Offset=((tgc.TagsData.Page+1)==1)?0:((tgc.TagsData.Page)*50);
- tgc.getEpisodes();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- setTimeout(function () {
- $("img.lazyload").lazyload();
- },1000);
- }
- tgc.getChildTags = function () {
- tgc.ChildTags.UpdateInProgress = true;
- FavoriteListSrv.getChildList($routeParams.Id, tgc.ChildTags.Offset, tgc.ChildTags.Limit).then(function (result) {
- tgc.ChildTags.Items = result;
- tgc.ChildTags.UpdateInProgress = false;
- })
- }
- tgc.getParentTags = function () {
- tgc.ParentTags.UpdateInProgress = true;
- FavoriteListSrv.getFavoriteListParents($routeParams.Id).then(function (result) {
- tgc.ParentTags.Items = result;
- $rootScope.Page.Title += tgc.ParentTags.Items[0].name_fa;
- tgc.ParentTags.UpdateInProgress = false;
- })
- }
- tgc.getEpisodes();
- tgc.getChildTags();
- tgc.getParentTags();
- }
- function MainAdminCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy,UserSrv,SecurityFcy,$window) {
- var mac = this;
- UserSrv.getUser().then(function (result) {
- if(typeof result!='undefined' && result!=null && typeof result.token!='undefined' && ($rootScope.InArray('admin', result.credentials) || $rootScope.InArray('superadmin', result.credentials) || $rootScope.InArray('operator', result.credentials))){
- SecurityFcy.getUserToken().then(function (token) {
- mac.userToken = token;
- });
- }
- else {
- NgNote.Error('کاربر گرامی شما اجازه دسترسی به این بخش را ندارید',3);
- setTimeout(function(){
- $window.location.replace("/#!/");
- },1000);
- }
- });
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.MainAdminPage;
- ProgressBarFcy.setDone();
- }
- function ShademanehCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy) {
- var smc = this;
- smc.ShademanehData = {};
- smc.ShademanehData.Page = 1;
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.ShademanehPage;
- smc.getSlider = function () {
- SliderFcy.getShademaneh().then(function (result) {
- smc.Sliders=result;
- ProgressBarFcy.plus(0.3);
- TopCarousel.initCarousel();
- })
- }
- smc.getSlider();
- smc.ShademanehData={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- smc.ShademanehSpecialData={Offset:0,Limit:23,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- smc.getShademanehSpecial=function(){
- EpisodeFcy.getCustom('404883',smc.ShademanehSpecialData.Offset,smc.ShademanehSpecialData.Limit).then(function(CustomEpisodes){
- smc.ShademanehSpecialData.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(smc.ShademanehSpecialData.Episodes);
- smc.ShademanehSpecialData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- smc.ShademanehSpecialData.UpdateInProgress=false;
- ProgressBarFcy.plus(0.7);
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- });
- }
- smc.getShademanehSpecial();
- smc.getShademaneh=function(){
- EpisodeFcy.getCustom('372372',smc.ShademanehData.Offset,smc.ShademanehData.Limit).then(function(CustomEpisodes){
- smc.ShademanehData.Page++;
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(smc.ShademanehData.Episodes);
- smc.ShademanehData.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- smc.ShademanehData.UpdateInProgress=false;
- ProgressBarFcy.plus(0.7);
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- });
- }
- smc.getNext=function(){
- smc.ShademanehData.UpdateInProgress = true;
- smc.ShademanehData.Limit=((smc.ShademanehData.Page+1)==1)?50:50;
- smc.ShademanehData.Offset=((smc.ShademanehData.Page+1)==1)?0:((smc.ShademanehData.Page)*50);
- smc.getShademaneh();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- }
- $(".position-fix-carousel").each(function () {
- TwoRowsCarousel.CarouselInit($(this).attr("id"));
- })
- smc.getShademaneh();
- }
- function KidsCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy,$timeout) {
- var kdc = this;
- $timeout(function () {
- $("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- event:"getnext"
- });
- },1000);
- kdc.Category={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0,IsPoster:false};
- kdc.Category.Page = 0;
- kdc.getSlider = function () {
- SliderFcy.getKids().then(function (result) {
- kdc.Sliders=result;
- ProgressBarFcy.plus(0.1);
- TopCarousel.initCarousel();
- })
- };
- kdc.getCategoryEpisodes = function(){
- EpisodeFcy.getCategoryEpisodes("115",kdc.Category.Offset,kdc.Category.Limit).then(function(result){
- kdc.Category.Page++;
- setTimeout(function(){$("img.lazyload").lazyload()},600);
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(kdc.Category.Episodes);
- kdc.Category.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- kdc.Category.UpdateInProgress=false;
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- ProgressBarFcy.setDone();
- });
- }
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.KidsPage;
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.plus(0.2);
- kdc.getNext=function(){
- kdc.Category.UpdateInProgress = true;
- kdc.Category.Limit=((kdc.Category.Page+1)==1)?50:50;
- kdc.Category.Offset=((kdc.Category.Page+1)==1)?0:((kdc.Category.Page)*50);
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- kdc.getCategoryEpisodes();
- }
- kdc.getCategoryEpisodes();
- kdc.getSlider();
- }
- function EuropeLeaguesCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy) {
- var elc = this;
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.EuropeLeaguesPage;
- elc.getSlider = function () {
- SliderFcy.getEuropeLeagues().then(function (result) {
- elc.Sliders=result;
- ProgressBarFcy.plus(0.1);
- TopCarousel.initCarousel();
- })
- };
- elc.NewsData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- elc.SpainData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- elc.EnglandData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- elc.ItalyData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- elc.GermanyData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- elc.FranceData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- elc.ChampionsLeagueData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- elc.getChampionsLeague=function(){
- EpisodeFcy.getCustom('404841',elc.ChampionsLeagueData.Offset,elc.ChampionsLeagueData.Limit).then(function(CustomEpisodes){
- elc.ChampionsLeagueData.Page++;
- //loaded("OurRecommendations");
- if(elc.ChampionsLeagueData.Page==1){
- TwoRowsCarousel.CarouselInit("champions-league");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(elc.ChampionsLeagueData.Episodes);
- window.ChampionsLeagueDataLength=CustomEpisodes.length;
- window.ChampionsLeagueDataTotal+=parseInt(window.ChampionsLeagueDataLength);
- elc.ChampionsLeagueData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- elc.ChampionsLeagueData.UpdateInProgress=false;
- if(elc.ChampionsLeagueData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- elc.getNews=function(){
- EpisodeFcy.getCustom('404821',elc.NewsData.Offset,elc.NewsData.Limit).then(function(CustomEpisodes){
- elc.NewsData.Page++;
- //loaded("OurRecommendations");
- if(elc.NewsData.Page==1){
- TwoRowsCarousel.CarouselInit("news-europeleagues");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(elc.NewsData.Episodes);
- window.EuropeLeaguesNews=CustomEpisodes.length;
- window.EuropeLeaguesNewsTotal+=parseInt(window.EuropeLeaguesNews);
- elc.NewsData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- elc.NewsData.UpdateInProgress=false;
- if(elc.NewsData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- elc.getSpainLeague=function(){
- EpisodeFcy.getCustom('404823',elc.SpainData.Offset,elc.SpainData.Limit).then(function(CustomEpisodes){
- elc.SpainData.Page++;
- //loaded("OurRecommendations");
- if(elc.SpainData.Page==1){
- TwoRowsCarousel.CarouselInit("spain-europeleagues");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(elc.SpainData.Episodes);
- window.SpainLeaguesData=CustomEpisodes.length;
- window.SpainLeaguesDataTotal+=parseInt(window.SpainLeaguesData);
- elc.SpainData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- elc.SpainData.UpdateInProgress=false;
- if(elc.SpainData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- elc.getEnglandLeague=function(){
- EpisodeFcy.getCustom('404822',elc.EnglandData.Offset,elc.EnglandData.Limit).then(function(CustomEpisodes){
- elc.EnglandData.Page++;
- //loaded("OurRecommendations");
- if(elc.EnglandData.Page==1){
- TwoRowsCarousel.CarouselInit("england-europeleagues");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(elc.EnglandData.Episodes);
- window.EnglandLeaguesData=CustomEpisodes.length;
- window.EnglandLeaguesDataTotal+=parseInt(window.EnglandLeaguesData);
- elc.EnglandData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- elc.EnglandData.UpdateInProgress=false;
- if(elc.EnglandData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- elc.getItalyLeague=function(){
- EpisodeFcy.getCustom('404824',elc.ItalyData.Offset,elc.ItalyData.Limit).then(function(CustomEpisodes){
- elc.ItalyData.Page++;
- //loaded("OurRecommendations");
- if(elc.ItalyData.Page==1){
- TwoRowsCarousel.CarouselInit("italy-europeleagues");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(elc.ItalyData.Episodes);
- window.ItalyLeaguesData=CustomEpisodes.length;
- window.ItalyLeaguesDataTotal+=parseInt(window.ItalyLeaguesData);
- elc.ItalyData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- elc.ItalyData.UpdateInProgress=false;
- if(elc.ItalyData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- elc.getGermanyLeague=function(){
- EpisodeFcy.getCustom('404825',elc.ItalyData.Offset,elc.ItalyData.Limit).then(function(CustomEpisodes){
- elc.GermanyData.Page++;
- //loaded("OurRecommendations");
- if(elc.GermanyData.Page==1){
- TwoRowsCarousel.CarouselInit("germany-europeleagues");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(elc.GermanyData.Episodes);
- window.GermanyLeaguesData=CustomEpisodes.length;
- window.GermanyLeaguesDataTotal+=parseInt(window.GermanyLeaguesData);
- elc.GermanyData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- elc.GermanyData.UpdateInProgress=false;
- if(elc.GermanyData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- elc.getFranceLeague=function(){
- EpisodeFcy.getCustom('404826',elc.ItalyData.Offset,elc.ItalyData.Limit).then(function(CustomEpisodes){
- elc.FranceData.Page++;
- //loaded("OurRecommendations");
- if(elc.FranceData.Page==1){
- TwoRowsCarousel.CarouselInit("france-europeleagues");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(elc.FranceData.Episodes);
- window.FranceLeaguesData=CustomEpisodes.length;
- window.FranceLeaguesDataTotal+=parseInt(window.FranceLeaguesData);
- elc.FranceData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- elc.FranceData.UpdateInProgress=false;
- if(elc.FranceData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- elc.getFranceLeague();
- elc.getGermanyLeague();
- elc.getItalyLeague();
- elc.getEnglandLeague();
- elc.getSpainLeague();
- elc.getNews();
- elc.getSlider();
- elc.getChampionsLeague();
- }
- function MoviesCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy,$timeout) {
- var mic = this;
- mic.Category = {};
- mic.Category.Page = 1;
- mic.getSlider = function () {
- SliderFcy.getMovies().then(function (result) {
- mic.Sliders=result;
- ProgressBarFcy.plus(0.1);
- TopCarousel.initCarousel();
- })
- }
- mic.getSlider();
- mic.CategoryId="111";
- mic.CategoryPageTitle = function(categoryId){
- var title = "لیست فیلم ها"
- return title ;
- }
- mic.Category={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0,IsPoster:false};
- switch (parseInt(mic.CategoryId)){
- case 6:
- break;
- default:
- break;
- }
- mic.getCategoryEpisodes = function(){
- EpisodeFcy.getCategoryEpisodes(mic.CategoryId,mic.Category.Offset,mic.Category.Limit).then(function(result){
- mic.Category.Page++;
- $timeout(function () {
- $("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },600);
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(mic.Category.Episodes);
- mic.Category.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- mic.Category.UpdateInProgress=false;
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- });
- }
- $rootScope.Page.Title=mic.CategoryPageTitle(mic.CategoryId);
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.plus(0.2);
- mic.getNext=function(){
- mic.Category.UpdateInProgress = true;
- mic.Category.Limit=((mic.Category.Page+1)==1)?50:50;
- mic.Category.Offset=((mic.Category.Page+1)==1)?0:((mic.Category.Page)*50);
- mic.getCategoryEpisodes();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- }
- mic.getCategoryEpisodes();
- }
- function SeriesCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy,$timeout) {
- var sic = this;
- sic.Category = {};
- sic.Category.Page = 1;
- sic.getSlider = function () {
- SliderFcy.getSeries().then(function (result) {
- sic.Sliders=result;
- ProgressBarFcy.plus(0.1);
- TopCarousel.initCarousel();
- })
- }
- sic.getSlider();
- sic.CategoryId="113";
- sic.CategoryPageTitle = function(categoryId){
- var title = "لیست سریال ها"
- return title ;
- }
- sic.Category={Offset:0,Limit:50,UpdateInProgress:true,Episodes:[],Page:0,IsPoster:false};
- switch (parseInt(sic.CategoryId)){
- case 6:
- break;
- default:
- break;
- }
- sic.getCategoryEpisodes = function(){
- EpisodeFcy.getCategoryEpisodes(sic.CategoryId,sic.Category.Offset,sic.Category.Limit).then(function(result){
- sic.Category.Page++;
- $timeout(function () {
- $("img.lazyload").lazyload({
- threshold : 150,
- effect : "fadeIn",
- });
- },600);
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(result);
- tempArray2.push(sic.Category.Episodes);
- sic.Category.Episodes = tempArray2[0].concat(tempArray[0]);
- tempArray.length = 0;
- tempArray2.length = 0;
- sic.Category.UpdateInProgress=false;
- ProgressBarFcy.setDone();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- });
- }
- $rootScope.Page.Title=sic.CategoryPageTitle(sic.CategoryId);
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.plus(0.2);
- sic.getNext=function(){
- sic.Category.UpdateInProgress = true;
- sic.Category.Limit=((sic.Category.Page+1)==1)?50:50;
- sic.Category.Offset=((sic.Category.Page+1)==1)?0:((sic.Category.Page)*50);
- sic.getCategoryEpisodes();
- setTimeout(function () {
- $(".carousel-info h5 span").each(function () {
- var elem = $(this);
- var persianNumber = persianUtils.toPersianNumber(elem.html());
- elem.html(persianNumber);
- });
- },200);
- }
- sic.getCategoryEpisodes();
- }
- function OlympicsCtrl(GeneralInit,$rootScope,SiteConstants,ProgressBarFcy,SliderFcy,EpisodeFcy) {
- $rootScope.Page.Title=SiteConstants.Fa.PageTitle.OlympicRioPage;
- var orc = this;
- orc.NewsData={Offset:0,Limit:27,UpdateInProgress:true,Episodes:[],Page:0,tempColumn:0};
- orc.WrestlingFarangiData={Offset:0,Limit:35,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- orc.WrestlingAzadData={Offset:0,Limit:35,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- orc.VolleyballData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- orc.TekwandoData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- orc.AthleticData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- orc.PowerLiftingData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- orc.OtherSportsIranData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- orc.OtherSportsInternationalData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- orc.ShootingData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- orc.FootballData={Offset:0,Limit:27,UpdateInProgress:true,Items:[],Page:0,tempColumn:0};
- orc.getNews=function(){
- EpisodeFcy.getCustom('383214',orc.NewsData.Offset,orc.NewsData.Limit).then(function(CustomEpisodes){
- orc.NewsData.Page++;
- //loaded("OurRecommendations");
- if(orc.NewsData.Page==1){
- TwoRowsCarousel.CarouselInit("news-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.NewsData.Episodes);
- window.OlympicsNews=CustomEpisodes.length;
- window.OlympicsNewsTotal+=parseInt(window.OlympicsNews);
- orc.NewsData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.NewsData.UpdateInProgress=false;
- if(orc.NewsData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- orc.getAzadWrestlings=function(){
- EpisodeFcy.getCustom('402114',orc.WrestlingAzadData.Offset,orc.WrestlingAzadData.Limit).then(function(CustomEpisodes){
- orc.WrestlingAzadData.Page++;
- //loaded("OurRecommendations");
- if(orc.WrestlingAzadData.Page==1){
- TwoRowsCarousel.CarouselInit("wrestling-azad-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.WrestlingAzadData.Episodes);
- window.OlympicsWrestling=CustomEpisodes.length;
- window.OlympicsWrestlingTotal+=parseInt(window.OlympicsWrestling);
- orc.WrestlingAzadData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.WrestlingAzadData.UpdateInProgress=false;
- if(orc.WrestlingAzadData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- orc.getFarangiWrestlings=function(){
- EpisodeFcy.getCustom('402115',orc.WrestlingFarangiData.Offset,orc.WrestlingFarangiData.Limit).then(function(CustomEpisodes){
- orc.WrestlingFarangiData.Page++;
- //loaded("OurRecommendations");
- if(orc.WrestlingFarangiData.Page==1){
- TwoRowsCarousel.CarouselInit("wrestling-farangi-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.WrestlingFarangiData.Episodes);
- window.OlympicsWrestlingFarangi=CustomEpisodes.length;
- window.OlympicsWrestlingFarangiTotal+=parseInt(window.OlympicsWrestlingFarangi);
- orc.WrestlingFarangiData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.WrestlingFarangiData.UpdateInProgress=false;
- if(orc.WrestlingFarangiData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- orc.getVolleyball=function(){
- EpisodeFcy.getCustom('402050',orc.VolleyballData.Offset,orc.VolleyballData.Limit).then(function(CustomEpisodes){
- orc.VolleyballData.Page++;
- //loaded("OurRecommendations");
- if(orc.VolleyballData.Page==1){
- TwoRowsCarousel.CarouselInit("volleyball-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.VolleyballData.Episodes);
- window.OlympicsVolleyball=CustomEpisodes.length;
- window.OlympicsVolleyballTotal+=parseInt(window.OlympicsVolleyball);
- orc.VolleyballData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.VolleyballData.UpdateInProgress=false;
- if(orc.VolleyballData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- orc.getTekwando=function(){
- EpisodeFcy.getCustom('402051',orc.TekwandoData.Offset,orc.TekwandoData.Limit).then(function(CustomEpisodes){
- orc.TekwandoData.Page++;
- //loaded("OurRecommendations");
- if(orc.TekwandoData.Page==1){
- TwoRowsCarousel.CarouselInit("tekwando-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.TekwandoData.Episodes);
- window.OlympicsTekwando=CustomEpisodes.length;
- window.OlympicsTekwandoTotal+=parseInt(window.OlympicsTekwando);
- orc.TekwandoData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.TekwandoData.UpdateInProgress=false;
- if(orc.TekwandoData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- orc.getAthletics=function(){
- EpisodeFcy.getCustom('402052',orc.AthleticData.Offset,orc.AthleticData.Limit).then(function(CustomEpisodes){
- orc.AthleticData.Page++;
- //loaded("OurRecommendations");
- if(orc.AthleticData.Page==1){
- TwoRowsCarousel.CarouselInit("athletic-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.AthleticData.Episodes);
- window.OlympicsAthletic=CustomEpisodes.length;
- window.OlympicsAthleticTotal+=parseInt(window.OlympicsAthletic);
- orc.AthleticData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.AthleticData.UpdateInProgress=false;
- if(orc.AthleticData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- orc.getPowerLiftings=function(){
- EpisodeFcy.getCustom('402053',orc.PowerLiftingData.Offset,orc.PowerLiftingData.Limit).then(function(CustomEpisodes){
- orc.PowerLiftingData.Page++;
- //loaded("OurRecommendations");
- if(orc.PowerLiftingData.Page==1){
- TwoRowsCarousel.CarouselInit("powerlifting-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.PowerLiftingData.Episodes);
- window.OlympicsPowerLifting=CustomEpisodes.length;
- window.OlympicsPowerLiftingTotal+=parseInt(window.OlympicsPowerLifting);
- orc.PowerLiftingData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.PowerLiftingData.UpdateInProgress=false;
- if(orc.PowerLiftingData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- orc.getOtherSportsIran=function(){
- EpisodeFcy.getCustom('402116',orc.OtherSportsIranData.Offset,orc.OtherSportsIranData.Limit).then(function(CustomEpisodes){
- orc.OtherSportsIranData.Page++;
- //loaded("OurRecommendations");
- if(orc.OtherSportsIranData.Page==1){
- TwoRowsCarousel.CarouselInit("other-sport-iran-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.OtherSportsIranData.Episodes);
- window.OlympicsOtherSportsIran=CustomEpisodes.length;
- window.OlympicsPowerLiftingTotal+=parseInt(window.OlympicsOtherSportsIran);
- orc.OtherSportsIranData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.OtherSportsIranData.UpdateInProgress=false;
- if(orc.OtherSportsIranData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- orc.getOtherSportsInternational=function(){
- EpisodeFcy.getCustom('402117',orc.OtherSportsInternationalData.Offset,orc.OtherSportsInternationalData.Limit).then(function(CustomEpisodes){
- orc.OtherSportsInternationalData.Page++;
- //loaded("OurRecommendations");
- if(orc.OtherSportsInternationalData.Page==1){
- TwoRowsCarousel.CarouselInit("other-sport-international-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.OtherSportsInternationalData.Episodes);
- window.OlympicsOtherSportsInternational=CustomEpisodes.length;
- window.OlympicsOtherSportsInternationalTotal+=parseInt(window.OlympicsOtherSportsInternational);
- orc.OtherSportsInternationalData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.OtherSportsInternationalData.UpdateInProgress=false;
- if(orc.OtherSportsInternationalData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- orc.getShootings=function(){
- EpisodeFcy.getCustom('402055',orc.ShootingData.Offset,orc.ShootingData.Limit).then(function(CustomEpisodes){
- orc.ShootingData.Page++;
- //loaded("OurRecommendations");
- if(orc.ShootingData.Page==1){
- TwoRowsCarousel.CarouselInit("shooting-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.ShootingData.Episodes);
- window.OlympicsShooting=CustomEpisodes.length;
- window.OlympicsShootingDataTotal+=parseInt(window.OlympicsShooting);
- orc.ShootingData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.ShootingData.UpdateInProgress=false;
- if(orc.ShootingData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- }
- orc.getFootballs=function(){
- EpisodeFcy.getCustom('402058',orc.FootballData.Offset,orc.FootballData.Limit).then(function(CustomEpisodes){
- orc.FootballData.Page++;
- //loaded("OurRecommendations");
- if(orc.FootballData.Page==1){
- TwoRowsCarousel.CarouselInit("football-olympics");
- }
- var tempArray=[];
- var tempArray2=[];
- tempArray.push(CustomEpisodes);
- tempArray2.push(orc.FootballData.Episodes);
- window.OlympicsFootball=CustomEpisodes.length;
- window.OlympicsFootballTotal+=parseInt(window.OlympicsFootball);
- orc.FootballData.Episodes = CustomEpisodes; /*tempArray2[0].concat(tempArray[0]);*/
- tempArray.length = 0;
- tempArray2.length = 0;
- orc.FootballData.UpdateInProgress=false;
- if(orc.FootballData.Page==1){
- ProgressBarFcy.plus(0.1);
- }
- });
- };
- orc.getSlider = function () {
- SliderFcy.getOlympics().then(function (result) {
- orc.Sliders=result;
- ProgressBarFcy.plus(0.1);
- TopCarousel.initCarousel();
- })
- }
- orc.getAthletics()
- orc.getAzadWrestlings();
- orc.getFarangiWrestlings();
- orc.getFootballs();
- orc.getNews();
- orc.getOtherSportsInternational();
- orc.getOtherSportsIran();
- orc.getPowerLiftings();
- orc.getShootings();
- orc.getTekwando();
- orc.getVolleyball();
- orc.getSlider();
- }
- function UnsubscribeCtrl(GeneralInit,$rootScope,$routeParams,ProgressBarFcy, UserSrv) {
- $rootScope.Page.Title="خروج از لیست دریافت خبرنامه ها";
- $rootScope.$broadcast("UserData");
- ProgressBarFcy.setDone();
- var usc = this;
- usc.Status={UpdateInProgress:true, IsSuccess: null,message:""};
- usc.checkEmailStatus = function (email) {
- var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;;
- return re.test(email);
- }
- if(usc.checkEmailStatus($routeParams.email)) {
- UserSrv.unsubscribe($routeParams.email).then(function (result) {
- usc.Status.UpdateInProgress = false;
- if (result) {
- usc.Status.IsSuccess = true;
- usc.Status.message = "ایمیل شما با موفقیت از خبرنامه حذف شد."
- }
- else {
- usc.Status.IsSuccess = false;
- usc.Status.message = "خطا در برقراری ارتباط با سرور. لطفا بعد از چند دقیقه مجددا تلاش فرمایید"
- }
- })
- }else{
- usc.Status.UpdateInProgress = false;
- usc.Status.IsSuccess = false;
- usc.Status.message = "لینک وارد شده اشتباه میباشد."
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement