reduce http request : screening time

This commit is contained in:
2015-08-30 18:41:04 +02:00
parent 50ab7c3cf4
commit edd1c37560

View File

@@ -120,9 +120,9 @@ function Film(oSettings)
this.timetable = function(iCinemaId, sLang, oTimetable) this.timetable = function(iCinemaId, sLang, oTimetable)
{ {
if(!iCinemaId) return this._timetable; if(!iCinemaId) return this._timetable || {};
else if(!sLang) return this._timetable[iCinemaId]; else if(!sLang) return this._timetable[iCinemaId] || {};
else if(!oTimetable) return this._timetable[iCinemaId][sLang]; else if(!oTimetable) return this._timetable[iCinemaId][sLang] || [];
else else
{ {
if(!(iCinemaId in this._timetable)) this._timetable[iCinemaId] = {}; if(!(iCinemaId in this._timetable)) this._timetable[iCinemaId] = {};
@@ -288,12 +288,6 @@ function Ugc()
//Timetable //Timetable
if(!oFilm.ban().status) if(!oFilm.ban().status)
{
getUgcPage( 'filmsAfficheAction!loadDatesList.action',
{filmId:oFilm.id(), cinemaId:iCinemaId, cinemaCode:'', day:''},
function(jData){
if(!(self.settings.date('midnight_timestamp') in jData.dates)) self.wip(-1);
else
{ {
getUgcPage( 'filmsAfficheAction!reloadSeancesList.action', getUgcPage( 'filmsAfficheAction!reloadSeancesList.action',
{filmId:oFilm.id(), cinemaId:iCinemaId, cinemaCode:'', day:self.settings.date('midnight_timestamp')}, {filmId:oFilm.id(), cinemaId:iCinemaId, cinemaCode:'', day:self.settings.date('midnight_timestamp')},
@@ -307,7 +301,7 @@ function Ugc()
{ {
sLang = $.trim($Div.find('.FilmTitle').text()); sLang = $.trim($Div.find('.FilmTitle').text());
} }
else else if($Div.find('a').length > 0)
{ {
$Div.find('a').each(function(iKey, oLink){ $Div.find('a').each(function(iKey, oLink){
var $Time = $(oLink); var $Time = $(oLink);
@@ -325,13 +319,6 @@ function Ugc()
}, },
'html'); 'html');
} }
},
function(){
self.wip(-1);
self.error('Ajax Error detected on movie "'+oFilm.name()+'" @'+self.settings.cinemas(iCinemaId)+'.');
},
'json');
}
else self.wip(-1); else self.wip(-1);
}); });
}; };
@@ -404,7 +391,13 @@ function Settings()
{ {
if(!asCinemas) return this._ugcCinemas; if(!asCinemas) return this._ugcCinemas;
else if($.isNumeric(asCinemas)) return this._ugcCinemas[asCinemas]; //Get Cinema name else if($.isNumeric(asCinemas)) return this._ugcCinemas[asCinemas]; //Get Cinema name
else this._ugcCinemas = asCinemas; else
{
$.each(asCinemas, function(iCinemaId, sCinema){
self._ugcCinemas[iCinemaId] = $.trim(sCinema.replace(/UGC (Ciné Cité|)/i, ''));
});
}
}; };
this.cinemas = function(asCinemas) this.cinemas = function(asCinemas)