reduce http request : screening time
This commit is contained in:
@@ -120,9 +120,9 @@ function Film(oSettings)
|
||||
|
||||
this.timetable = function(iCinemaId, sLang, oTimetable)
|
||||
{
|
||||
if(!iCinemaId) return this._timetable;
|
||||
else if(!sLang) return this._timetable[iCinemaId];
|
||||
else if(!oTimetable) return this._timetable[iCinemaId][sLang];
|
||||
if(!iCinemaId) return this._timetable || {};
|
||||
else if(!sLang) return this._timetable[iCinemaId] || {};
|
||||
else if(!oTimetable) return this._timetable[iCinemaId][sLang] || [];
|
||||
else
|
||||
{
|
||||
if(!(iCinemaId in this._timetable)) this._timetable[iCinemaId] = {};
|
||||
@@ -289,48 +289,35 @@ function Ugc()
|
||||
//Timetable
|
||||
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',
|
||||
{filmId:oFilm.id(), cinemaId:iCinemaId, cinemaCode:'', day:self.settings.date('midnight_timestamp')},
|
||||
function(hData){
|
||||
var sLang = '';
|
||||
var $Timetable = $(hData);
|
||||
var oTimes = [];
|
||||
$Timetable.children().each(function(iKey, oDiv){
|
||||
$Div = $(oDiv);
|
||||
if($Div.attr('class')=='Line') //New Lang
|
||||
{
|
||||
sLang = $.trim($Div.find('.FilmTitle').text());
|
||||
}
|
||||
else
|
||||
{
|
||||
$Div.find('a').each(function(iKey, oLink){
|
||||
var $Time = $(oLink);
|
||||
oTime = {'time':$.trim($Time.find('span').text()), 'booking':oFilm.consts.ugc_url+$Time.attr('href')};
|
||||
oFilm.timetable(iCinemaId, sLang, oTime);
|
||||
});
|
||||
}
|
||||
});
|
||||
oFilm.renderTimetable(iCinemaId);
|
||||
self.wip(-1);
|
||||
},
|
||||
function(){
|
||||
self.wip(-1);
|
||||
self.error('Ajax Error detected on movie "'+oFilm.name()+'" @'+self.settings.cinemas(iCinemaId)+'.');
|
||||
},
|
||||
'html');
|
||||
}
|
||||
getUgcPage( 'filmsAfficheAction!reloadSeancesList.action',
|
||||
{filmId:oFilm.id(), cinemaId:iCinemaId, cinemaCode:'', day:self.settings.date('midnight_timestamp')},
|
||||
function(hData){
|
||||
var sLang = '';
|
||||
var $Timetable = $(hData);
|
||||
var oTimes = [];
|
||||
$Timetable.children().each(function(iKey, oDiv){
|
||||
$Div = $(oDiv);
|
||||
if($Div.attr('class')=='Line') //New Lang
|
||||
{
|
||||
sLang = $.trim($Div.find('.FilmTitle').text());
|
||||
}
|
||||
else if($Div.find('a').length > 0)
|
||||
{
|
||||
$Div.find('a').each(function(iKey, oLink){
|
||||
var $Time = $(oLink);
|
||||
oTime = {'time':$.trim($Time.find('span').text()), 'booking':oFilm.consts.ugc_url+$Time.attr('href')};
|
||||
oFilm.timetable(iCinemaId, sLang, oTime);
|
||||
});
|
||||
}
|
||||
});
|
||||
oFilm.renderTimetable(iCinemaId);
|
||||
self.wip(-1);
|
||||
},
|
||||
function(){
|
||||
self.wip(-1);
|
||||
self.error('Ajax Error detected on movie "'+oFilm.name()+'" @'+self.settings.cinemas(iCinemaId)+'.');
|
||||
},
|
||||
'json');
|
||||
'html');
|
||||
}
|
||||
else self.wip(-1);
|
||||
});
|
||||
@@ -404,7 +391,13 @@ function Settings()
|
||||
{
|
||||
if(!asCinemas) return this._ugcCinemas;
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user