Compare commits
7 Commits
863e2069b5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ccd0279ab | |||
| 3b23d358a0 | |||
| 187ea6c970 | |||
| 2799d2bb86 | |||
| ca72365f6d | |||
| c7cc14effc | |||
| e165581dc7 |
@@ -3,4 +3,5 @@
|
|||||||
class Settings
|
class Settings
|
||||||
{
|
{
|
||||||
const DEBUG = false;
|
const DEBUG = false;
|
||||||
|
const TIMEZONE = 'Europe/Paris';
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<h2><i class="fa inline fa-feedback"></i>Filtered films</h2>
|
<h2><i class="fa inline fa-feedback"></i>Filtered films</h2>
|
||||||
<div id="feed_content"></div>
|
<div id="feed_content"></div>
|
||||||
</div>
|
</div>
|
||||||
<footer><i class="fa inline fa-power"></i>Designed & powered by Franzz, licensed under GPLv3.</footer>
|
<footer><i class="fa inline fa-power"></i>Designed & powered by Franzz, <a href="https://git.lutran.fr/franzz/ugc" title="Git Repository" target="_blank">licensed under GPLv3</a>.</footer>
|
||||||
<div class="background"></div>
|
<div class="background"></div>
|
||||||
<div id="settings">
|
<div id="settings">
|
||||||
<h1>Theaters<span id="ok_settings" class="button no_bg square fa fa-ok"></span></h1>
|
<h1>Theaters<span id="ok_settings" class="button no_bg square fa fa-ok"></span></h1>
|
||||||
@@ -44,4 +44,4 @@
|
|||||||
<div class="switches"><i id="premiere" class="fa fa-lg inline"></i><span>Include Avant-première</span></div>
|
<div class="switches"><i id="premiere" class="fa fa-lg inline"></i><span>Include Avant-première</span></div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
8
script/jquery.js
vendored
8
script/jquery.js
vendored
File diff suppressed because one or more lines are too long
181
script/ugc.js
181
script/ugc.js
@@ -8,7 +8,7 @@ function Film(oSettings)
|
|||||||
this._ban = {status:false, reason:''};
|
this._ban = {status:false, reason:''};
|
||||||
this._timetable = {};
|
this._timetable = {};
|
||||||
this.$Main = $('main');
|
this.$Main = $('main');
|
||||||
|
|
||||||
this.ban = function(bStatus, sReason)
|
this.ban = function(bStatus, sReason)
|
||||||
{
|
{
|
||||||
sReason = sReason || '';
|
sReason = sReason || '';
|
||||||
@@ -22,18 +22,18 @@ function Film(oSettings)
|
|||||||
}
|
}
|
||||||
else this.error('Setting ban status with no reason');
|
else this.error('Setting ban status with no reason');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.id = function(iFilmId)
|
this.id = function(iFilmId)
|
||||||
{
|
{
|
||||||
return this.attr('id', iFilmId);
|
return this.attr('id', iFilmId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.name = function(sName)
|
this.name = function(sName)
|
||||||
{
|
{
|
||||||
sName = sName?(sName + '').toLowerCase().replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g, function($1) {return $1.toUpperCase();}):'';
|
sName = sName?(sName + '').toLowerCase().replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g, function($1) {return $1.toUpperCase();}):'';
|
||||||
return this.attr('name', sName);
|
return this.attr('name', sName);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.safe = function(sName)
|
this.safe = function(sName)
|
||||||
{
|
{
|
||||||
var sSafeName = sName?removeDiacritics(sName):'';
|
var sSafeName = sName?removeDiacritics(sName):'';
|
||||||
@@ -52,7 +52,7 @@ function Film(oSettings)
|
|||||||
if(sPoster) sPoster = this.getPosterUrl(sPoster, 'large', bForce);
|
if(sPoster) sPoster = this.getPosterUrl(sPoster, 'large', bForce);
|
||||||
return this.attr('poster_bg', sPoster);
|
return this.attr('poster_bg', sPoster);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getPosterUrl = function(sUrl, sSize, bForce)
|
this.getPosterUrl = function(sUrl, sSize, bForce)
|
||||||
{
|
{
|
||||||
bForce = bForce || false;
|
bForce = bForce || false;
|
||||||
@@ -65,18 +65,18 @@ function Film(oSettings)
|
|||||||
{
|
{
|
||||||
return this.attr('edito', sEdito);
|
return this.attr('edito', sEdito);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.trailer = function(sTrailer)
|
this.trailer = function(sTrailer)
|
||||||
{
|
{
|
||||||
sTrailer = sTrailer?self.consts.ugc_url+sTrailer:'';
|
sTrailer = sTrailer?self.consts.ugc_url+sTrailer:'';
|
||||||
return this.attr('trailer', sTrailer);
|
return this.attr('trailer', sTrailer);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.director = function(sDirector)
|
this.director = function(sDirector)
|
||||||
{
|
{
|
||||||
return this.attr('director', sDirector);
|
return this.attr('director', sDirector);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.attr = function(sName, sValue)
|
this.attr = function(sName, sValue)
|
||||||
{
|
{
|
||||||
if(!sValue) return this._attr[sName];
|
if(!sValue) return this._attr[sName];
|
||||||
@@ -106,12 +106,12 @@ function Film(oSettings)
|
|||||||
else if(sEdito=='Nouveau') iRank += 10000000; //New releases
|
else if(sEdito=='Nouveau') iRank += 10000000; //New releases
|
||||||
else if(sEdito.slice(-7)=='semaine')iRank += 100000 * parseInt(sEdito.substr(0, sEdito.indexOf('è'))); //Popular movies
|
else if(sEdito.slice(-7)=='semaine')iRank += 100000 * parseInt(sEdito.substr(0, sEdito.indexOf('è'))); //Popular movies
|
||||||
else if(sEdito=='Dernières Séances')iRank += 100000;
|
else if(sEdito=='Dernières Séances')iRank += 100000;
|
||||||
|
|
||||||
//Adding movie ID (newer movies have greater IDs)
|
//Adding movie ID (newer movies have greater IDs)
|
||||||
iRank += parseInt(this.id(), 10);
|
iRank += parseInt(this.id(), 10);
|
||||||
return iRank;
|
return iRank;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.anchor = function()
|
this.anchor = function()
|
||||||
{
|
{
|
||||||
if(Object.keys(this._anchor).length > 0) return this._anchor;
|
if(Object.keys(this._anchor).length > 0) return this._anchor;
|
||||||
@@ -151,7 +151,7 @@ function Film(oSettings)
|
|||||||
.appendTo(this.$Main);
|
.appendTo(this.$Main);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.toggleFilmDetails = function() {
|
this.toggleFilmDetails = function() {
|
||||||
var $This = $(this);
|
var $This = $(this);
|
||||||
var show = function(hDom){
|
var show = function(hDom){
|
||||||
@@ -160,7 +160,7 @@ function Film(oSettings)
|
|||||||
$Dom.find('.movie-infos li').add($Dom.find('.movie-infos').next('ul').find('li')).each(function(iKey, oElem){
|
$Dom.find('.movie-infos li').add($Dom.find('.movie-infos').next('ul').find('li')).each(function(iKey, oElem){
|
||||||
self.anchor().find('.film-details').append($('<p>').text($(oElem).text()));
|
self.anchor().find('.film-details').append($('<p>').text($(oElem).text()));
|
||||||
});
|
});
|
||||||
|
|
||||||
self.anchor().find('.film-details, .timetable').toggle();
|
self.anchor().find('.film-details, .timetable').toggle();
|
||||||
self.anchor().find('.more-info').removeClass('fa-spinner fa-spin').addClass('fa-close');
|
self.anchor().find('.more-info').removeClass('fa-spinner fa-spin').addClass('fa-close');
|
||||||
};
|
};
|
||||||
@@ -168,17 +168,17 @@ function Film(oSettings)
|
|||||||
self.anchor().find('.film-details, .timetable').toggle();
|
self.anchor().find('.film-details, .timetable').toggle();
|
||||||
self.anchor().find('.more-info').removeClass('fa-close').addClass('fa-more');
|
self.anchor().find('.more-info').removeClass('fa-close').addClass('fa-more');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(self.anchor().find('.more-info').hasClass('fa-close')) hide();
|
if(self.anchor().find('.more-info').hasClass('fa-close')) hide();
|
||||||
else if(!$This.data('loaded')) self.getFilmDetails(show);
|
else if(!$This.data('loaded')) self.getFilmDetails(show);
|
||||||
else show();
|
else show();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getFilmDetails = function(fCallBack) {
|
this.getFilmDetails = function(fCallBack) {
|
||||||
self.anchor().find('.more-info').removeClass('fa-more').addClass('fa-spinner fa-spin');
|
self.anchor().find('.more-info').removeClass('fa-more').addClass('fa-spinner fa-spin');
|
||||||
getUgcPage('film.html', {id: self.id()}, fCallBack, function(){}, 'html');
|
getUgcPage('film.html', {id: self.id()}, fCallBack, function(){}, 'html');
|
||||||
};
|
};
|
||||||
|
|
||||||
this.timetable = function(iCinemaId, sLang, oTimetable)
|
this.timetable = function(iCinemaId, sLang, oTimetable)
|
||||||
{
|
{
|
||||||
if(!iCinemaId) return this._timetable || {};
|
if(!iCinemaId) return this._timetable || {};
|
||||||
@@ -191,7 +191,7 @@ function Film(oSettings)
|
|||||||
this._timetable[iCinemaId][sLang].push(oTimetable);
|
this._timetable[iCinemaId][sLang].push(oTimetable);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.renderTimetable = function(iCinemaId)
|
this.renderTimetable = function(iCinemaId)
|
||||||
{
|
{
|
||||||
var sCinema = self.settings.cinemas(iCinemaId);
|
var sCinema = self.settings.cinemas(iCinemaId);
|
||||||
@@ -208,7 +208,7 @@ function Film(oSettings)
|
|||||||
.append($('<span>', {'class':'cinema_name'}).text(sCinema)))
|
.append($('<span>', {'class':'cinema_name'}).text(sCinema)))
|
||||||
.append($('<span>', {'class':'lang'}).text(sLang))
|
.append($('<span>', {'class':'lang'}).text(sLang))
|
||||||
.appendTo($CinemaBox);
|
.appendTo($CinemaBox);
|
||||||
|
|
||||||
var $Timetable = $('<p>', {'class':'screening'});
|
var $Timetable = $('<p>', {'class':'screening'});
|
||||||
$.each(asTimetable.sort(self.timeCompare), function(iKey, oTime){
|
$.each(asTimetable.sort(self.timeCompare), function(iKey, oTime){
|
||||||
$Timetable
|
$Timetable
|
||||||
@@ -219,12 +219,12 @@ function Film(oSettings)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.timeCompare = function(sTime1, sTime2)
|
this.timeCompare = function(sTime1, sTime2)
|
||||||
{
|
{
|
||||||
return (Date.parse('01/01/1970 '+sTime1.time+':00') > Date.parse('01/01/1970 '+sTime2.time+':00'));
|
return (Date.parse('01/01/1970 '+sTime1.time+':00') > Date.parse('01/01/1970 '+sTime2.time+':00'));
|
||||||
};
|
};
|
||||||
|
|
||||||
this.feedback = function(sMsg)
|
this.feedback = function(sMsg)
|
||||||
{
|
{
|
||||||
$('#feed_content').append($('<p>').text(sMsg));
|
$('#feed_content').append($('<p>').text(sMsg));
|
||||||
@@ -249,15 +249,15 @@ function Ugc()
|
|||||||
this.$Main = $('main');
|
this.$Main = $('main');
|
||||||
this.$Footer = $('footer');
|
this.$Footer = $('footer');
|
||||||
this.$Feedback = $('#feedback');
|
this.$Feedback = $('#feedback');
|
||||||
|
|
||||||
this.loadCinemas = function()
|
this.loadCinemas = function()
|
||||||
{
|
{
|
||||||
//Display buffer while loading
|
//Display buffer while loading
|
||||||
buffer(true);
|
buffer(true);
|
||||||
|
|
||||||
//Load Settings
|
//Load Settings
|
||||||
this.settings.init();
|
this.settings.init();
|
||||||
|
|
||||||
//Set Header
|
//Set Header
|
||||||
$('#date')
|
$('#date')
|
||||||
.attr('datetime', this.settings.date('html'))
|
.attr('datetime', this.settings.date('html'))
|
||||||
@@ -270,10 +270,10 @@ function Ugc()
|
|||||||
{cinemaId:iCinemaId, date:self.settings.date('french'), page:'10007', sort:'ugc', searchFilmKey:''},
|
{cinemaId:iCinemaId, date:self.settings.date('french'), page:'10007', sort:'ugc', searchFilmKey:''},
|
||||||
function(hDom){self.addCinema(iCinemaId, hDom)},
|
function(hDom){self.addCinema(iCinemaId, hDom)},
|
||||||
function(){},
|
function(){},
|
||||||
'html');
|
'html');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.wip = function(iProgress)
|
this.wip = function(iProgress)
|
||||||
{
|
{
|
||||||
if(!iProgress) return this._wip;
|
if(!iProgress) return this._wip;
|
||||||
@@ -283,11 +283,11 @@ function Ugc()
|
|||||||
if(this._wip==0) this.onPostLoad();
|
if(this._wip==0) this.onPostLoad();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onPostLoad = function()
|
this.onPostLoad = function()
|
||||||
{
|
{
|
||||||
var $Films = $('.film');
|
var $Films = $('.film');
|
||||||
|
|
||||||
//Remove movies with no screening
|
//Remove movies with no screening
|
||||||
$Films.not('.banned').each(function(iKey, hFilm){
|
$Films.not('.banned').each(function(iKey, hFilm){
|
||||||
var $Film = $(hFilm);
|
var $Film = $(hFilm);
|
||||||
@@ -297,22 +297,22 @@ function Ugc()
|
|||||||
oFilm.ban(true, 'No screening today');
|
oFilm.ban(true, 'No screening today');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Sort films
|
//Sort films
|
||||||
$Films.sort(function(oFilm1, oFilm2){
|
$Films.sort(function(oFilm1, oFilm2){
|
||||||
return (self.film($(oFilm1).data('id')).getRank() < self.film($(oFilm2).data('id')).getRank())?1:-1;
|
return (self.film($(oFilm1).data('id')).getRank() < self.film($(oFilm2).data('id')).getRank())?1:-1;
|
||||||
}).detach();
|
}).detach();
|
||||||
|
|
||||||
//Add films (except bans)
|
//Add films (except bans)
|
||||||
$Films.appendTo(this.$Main);
|
$Films.appendTo(this.$Main);
|
||||||
|
|
||||||
//remove buffer
|
//remove buffer
|
||||||
buffer(false);
|
buffer(false);
|
||||||
|
|
||||||
//Build Search
|
//Build Search
|
||||||
this.initSearch();
|
this.initSearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addCineNav = function(iCinemaId)
|
this.addCineNav = function(iCinemaId)
|
||||||
{
|
{
|
||||||
var sCinema = self.settings.cinemas(iCinemaId);
|
var sCinema = self.settings.cinemas(iCinemaId);
|
||||||
@@ -326,7 +326,7 @@ function Ugc()
|
|||||||
})
|
})
|
||||||
.text(sFirstLetter));
|
.text(sFirstLetter));
|
||||||
};
|
};
|
||||||
|
|
||||||
this.initSearch = function()
|
this.initSearch = function()
|
||||||
{
|
{
|
||||||
var $SearchInput = $("#search");
|
var $SearchInput = $("#search");
|
||||||
@@ -345,10 +345,10 @@ function Ugc()
|
|||||||
{
|
{
|
||||||
var sTerm = removeDiacritics(oRequest.term);
|
var sTerm = removeDiacritics(oRequest.term);
|
||||||
var rMatcher = new RegExp($.ui.autocomplete.escapeRegex(sTerm), 'i');
|
var rMatcher = new RegExp($.ui.autocomplete.escapeRegex(sTerm), 'i');
|
||||||
|
|
||||||
//Remove all films
|
//Remove all films
|
||||||
$('.film').not('.banned').hide();
|
$('.film').not('.banned').hide();
|
||||||
|
|
||||||
$.each(oUgc.film(), function(iFilmId, oFilm)
|
$.each(oUgc.film(), function(iFilmId, oFilm)
|
||||||
{
|
{
|
||||||
if(!oFilm.ban().status)
|
if(!oFilm.ban().status)
|
||||||
@@ -362,7 +362,7 @@ function Ugc()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var asHash = self.hash();
|
var asHash = self.hash();
|
||||||
var sDefaultSearch = asHash.items[0] || '';
|
var sDefaultSearch = asHash.items[0] || '';
|
||||||
if(asHash.page=='search' && sDefaultSearch!='')
|
if(asHash.page=='search' && sDefaultSearch!='')
|
||||||
@@ -370,7 +370,7 @@ function Ugc()
|
|||||||
$SearchInput.focus().val(sDefaultSearch).putCursorAtEnd().autocomplete("search", sDefaultSearch);
|
$SearchInput.focus().val(sDefaultSearch).putCursorAtEnd().autocomplete("search", sDefaultSearch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.hash = function(sPage, asItems)
|
this.hash = function(sPage, asItems)
|
||||||
{
|
{
|
||||||
sPage = sPage || '';
|
sPage = sPage || '';
|
||||||
@@ -390,7 +390,7 @@ function Ugc()
|
|||||||
window.location.hash = '#'+encodeURIComponent(sPage+sItems);
|
window.location.hash = '#'+encodeURIComponent(sPage+sItems);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addCinema = function(iCinemaId, hDom)
|
this.addCinema = function(iCinemaId, hDom)
|
||||||
{
|
{
|
||||||
var $Films = $('<div>'+hDom+'</div>').find('.cinema-time-item');
|
var $Films = $('<div>'+hDom+'</div>').find('.cinema-time-item');
|
||||||
@@ -401,54 +401,54 @@ function Ugc()
|
|||||||
var $Film = $(this);
|
var $Film = $(this);
|
||||||
var iFilmId = $Film.find('.movie-link').attr('href').split('id=').pop();
|
var iFilmId = $Film.find('.movie-link').attr('href').split('id=').pop();
|
||||||
var oFilm = self.film(iFilmId);
|
var oFilm = self.film(iFilmId);
|
||||||
|
|
||||||
if(!oFilm)
|
if(!oFilm)
|
||||||
{
|
{
|
||||||
oFilm = new Film(self.settings);
|
oFilm = new Film(self.settings);
|
||||||
|
|
||||||
//ID
|
//ID
|
||||||
oFilm.id(iFilmId);
|
oFilm.id(iFilmId);
|
||||||
|
|
||||||
//Edito
|
//Edito
|
||||||
var sProg = $.trim($Film.find('.programming').text());
|
var sProg = $.trim($Film.find('.programming').text());
|
||||||
var sLabel = $.trim($Film.find('.label-ugc').text());
|
var sLabel = $.trim($Film.find('.label-ugc').text());
|
||||||
var sEdito = sProg?sProg:sLabel;
|
var sEdito = sProg?sProg:sLabel;
|
||||||
oFilm.edito(sEdito);
|
oFilm.edito(sEdito);
|
||||||
|
|
||||||
//Name
|
//Name
|
||||||
oFilm.safe(oFilm.name($Film.find('.title > a').text()));
|
oFilm.safe(oFilm.name($Film.find('.title > a').text()));
|
||||||
|
|
||||||
//Poster
|
//Poster
|
||||||
var sPosterUrl = $Film.find('.movie-img').attr('source').replace('palegrey.jpg', 'white.jpg');
|
var sPosterUrl = $Film.find('.movie-img').attr('source').replace('palegrey.jpg', 'white.jpg');
|
||||||
oFilm.poster(sPosterUrl);
|
oFilm.poster(sPosterUrl);
|
||||||
oFilm.backgroundPoster(sPosterUrl.replace('/small/', '/large/'));
|
oFilm.backgroundPoster(sPosterUrl.replace('/small/', '/large/'));
|
||||||
|
|
||||||
//Trailer
|
//Trailer
|
||||||
oFilm.trailer('');
|
oFilm.trailer('');
|
||||||
|
|
||||||
//Director
|
//Director
|
||||||
oFilm.director($.trim($Film.find('.movie-realisator').text().substring(4))); //omg
|
oFilm.director($.trim($Film.find('.movie-realisator').text().trim().substring(3))); //omg
|
||||||
|
|
||||||
//Minimum info acquired: book place on DOM
|
//Minimum info acquired: book place on DOM
|
||||||
oFilm.anchor();
|
oFilm.anchor();
|
||||||
|
|
||||||
//Ban if wrong edito
|
//Ban if wrong edito
|
||||||
if((sEdito=='Avant-Première' && !self.settings.premiere()) || sEdito=='UGC Culte' || sEdito=='Soirée Club') oFilm.ban(true, sEdito);
|
if((sEdito=='Avant-Première' && !self.settings.premiere()) || sEdito=='UGC Culte' || sEdito=='Soirée Club') oFilm.ban(true, sEdito);
|
||||||
|
|
||||||
//Append film to Ugc
|
//Append film to Ugc
|
||||||
self.film(iFilmId, oFilm);
|
self.film(iFilmId, oFilm);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Timetable
|
//Timetable
|
||||||
if(!oFilm.ban().status)
|
if(!oFilm.ban().status)
|
||||||
{
|
{
|
||||||
var sLang = '';
|
var sLang = '';
|
||||||
var $Timetables = $Film.find('ul.timetable');
|
var $Timetables = $Film.find('ul.timetable');
|
||||||
var oTimes = [];
|
var oTimes = [];
|
||||||
|
|
||||||
//Loop on languages
|
//Loop on languages
|
||||||
$Timetables.each(function(iKey, oTimeTable){
|
$Timetables.each(function(iKey, oTimeTable){
|
||||||
|
|
||||||
//Loop on sessions
|
//Loop on sessions
|
||||||
$(oTimeTable).find('li').each(function(iKey, oLi){
|
$(oTimeTable).find('li').each(function(iKey, oLi){
|
||||||
$Li = $(oLi);
|
$Li = $(oLi);
|
||||||
@@ -470,19 +470,19 @@ function Ugc()
|
|||||||
else self.wip(-1);
|
else self.wip(-1);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.film = function(iFilmId, oFilm)
|
this.film = function(iFilmId, oFilm)
|
||||||
{
|
{
|
||||||
if(!iFilmId) return this._films;
|
if(!iFilmId) return this._films;
|
||||||
else if(!oFilm) return (iFilmId in this._films)?this._films[iFilmId]:false;
|
else if(!oFilm) return (iFilmId in this._films)?this._films[iFilmId]:false;
|
||||||
else this._films[iFilmId] = oFilm;
|
else this._films[iFilmId] = oFilm;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.feedback = function(sMsg)
|
this.feedback = function(sMsg)
|
||||||
{
|
{
|
||||||
$('#feed_content').append($('<p>').text(sMsg));
|
$('#feed_content').append($('<p>').text(sMsg));
|
||||||
};
|
};
|
||||||
|
|
||||||
this.error = function(sMsg)
|
this.error = function(sMsg)
|
||||||
{
|
{
|
||||||
console.log('Ugc Error: '+sMsg);
|
console.log('Ugc Error: '+sMsg);
|
||||||
@@ -496,14 +496,14 @@ function Settings()
|
|||||||
this._cinemas = {};
|
this._cinemas = {};
|
||||||
//this._ugcDates = [];
|
//this._ugcDates = [];
|
||||||
this._date = null;
|
this._date = null;
|
||||||
|
|
||||||
this.$Settings = $('#settings');
|
this.$Settings = $('#settings');
|
||||||
this.$Header = $('header');
|
this.$Header = $('header');
|
||||||
this.$Main = $('main');
|
this.$Main = $('main');
|
||||||
|
|
||||||
this.consts = { days:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
this.consts = { days:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
||||||
months:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]};
|
months:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]};
|
||||||
|
|
||||||
this.init = function()
|
this.init = function()
|
||||||
{
|
{
|
||||||
//Default date
|
//Default date
|
||||||
@@ -516,16 +516,17 @@ function Settings()
|
|||||||
}
|
}
|
||||||
else oDate = new Date(iCookieTimestamp);
|
else oDate = new Date(iCookieTimestamp);
|
||||||
this.date(oDate);
|
this.date(oDate);
|
||||||
|
|
||||||
//UGC dates
|
//UGC dates
|
||||||
this.addUgcDatesToDom();
|
this.addUgcDatesToDom();
|
||||||
|
|
||||||
//Default cinemas
|
//Default cinemas
|
||||||
var asCookieCinemas = Cookies.getJSON('cinemas');
|
var asCookieCinemas = Cookies.getJSON('cinemas');
|
||||||
this.cinemas(asCookieCinemas?asCookieCinemas:{'10':'Les Halles', '12':'Bercy', '20':'La Défense'});
|
asCookieCinemas = $.isEmptyObject(asCookieCinemas)?{'10':'Les Halles', '12':'Bercy', '20':'La Défense'}:asCookieCinemas;
|
||||||
|
this.cinemas(asCookieCinemas);
|
||||||
|
|
||||||
//UGC cinemas
|
//UGC cinemas
|
||||||
getUgcPage( 'resaExpressAction!getCinemaList.action',
|
getUgcPage( 'resaExpressAction!getCinemaList.action',
|
||||||
{region:'', cinema:'', film:'', date:'', seance:'', '_':this.date('timestamp')},
|
{region:'', cinema:'', film:'', date:'', seance:'', '_':this.date('timestamp')},
|
||||||
function(jData){
|
function(jData){
|
||||||
self.ugcCinemas(jData.cinemas);
|
self.ugcCinemas(jData.cinemas);
|
||||||
@@ -533,39 +534,39 @@ function Settings()
|
|||||||
},
|
},
|
||||||
function(){self.error('Error: Could not load cinema list');},
|
function(){self.error('Error: Could not load cinema list');},
|
||||||
'json');
|
'json');
|
||||||
|
|
||||||
//Avant-Première switch
|
//Avant-Première switch
|
||||||
var bCookiePremiere = Cookies.getJSON('premiere');
|
var bCookiePremiere = Cookies.getJSON('premiere');
|
||||||
this.premiere(bCookiePremiere==null?false:bCookiePremiere);
|
this.premiere(bCookiePremiere==null?false:bCookiePremiere);
|
||||||
$('.switches').click(function(){self.premiere(!self.premiere());});
|
$('.switches').click(function(){self.premiere(!self.premiere());});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.premiere = function(bActive)
|
this.premiere = function(bActive)
|
||||||
{
|
{
|
||||||
var $Premiere = $('#premiere');
|
var $Premiere = $('#premiere');
|
||||||
if(bActive==null) return $Premiere.hasClass('fa-on');
|
if(bActive==null) return $Premiere.hasClass('fa-on');
|
||||||
else $Premiere.removeClass('fa-on fa-off').addClass(bActive?'fa-on':'fa-off');
|
else $Premiere.removeClass('fa-on fa-off').addClass(bActive?'fa-on':'fa-off');
|
||||||
};
|
};
|
||||||
|
|
||||||
this.ugcCinemas = function(asCinemas)
|
this.ugcCinemas = function(asCinemas)
|
||||||
{
|
{
|
||||||
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
|
else
|
||||||
{
|
{
|
||||||
$.each(asCinemas, function(iCinemaId, sCinema){
|
$.each(asCinemas, function(iKey, sCinema){
|
||||||
self._ugcCinemas[iCinemaId] = $.trim(sCinema.replace(/UGC( Ciné Cité|)/i, ''));
|
self._ugcCinemas[sCinema.cinemaId] = $.trim(sCinema.cinemaName.replace(/UGC( Ciné Cité|)/i, ''));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.cinemas = function(asCinemas)
|
this.cinemas = function(asCinemas)
|
||||||
{
|
{
|
||||||
if(!asCinemas) return this._cinemas;
|
if(!asCinemas) return this._cinemas;
|
||||||
else if($.isNumeric(asCinemas)) return this._cinemas[asCinemas]; //Get Cinema name
|
else if($.isNumeric(asCinemas)) return this._cinemas[asCinemas]; //Get Cinema name
|
||||||
else this._cinemas = asCinemas;
|
else this._cinemas = asCinemas;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.date = function(oDate)
|
this.date = function(oDate)
|
||||||
{
|
{
|
||||||
if(!oDate) return this._date;
|
if(!oDate) return this._date;
|
||||||
@@ -601,14 +602,14 @@ function Settings()
|
|||||||
}
|
}
|
||||||
else this._date = oDate;
|
else this._date = oDate;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addUgcDatesToDom = function()
|
this.addUgcDatesToDom = function()
|
||||||
{
|
{
|
||||||
//Build today at midnight
|
//Build today at midnight
|
||||||
var oNextDay = new Date();
|
var oNextDay = new Date();
|
||||||
var bTuesdayNight = (oNextDay.getDay()==2 && oNextDay.getHours()==23);
|
var bTuesdayNight = (oNextDay.getDay()==2 && oNextDay.getHours()==23);
|
||||||
oNextDay = new Date(oNextDay.getFullYear(), oNextDay.getMonth(), oNextDay.getDate());
|
oNextDay = new Date(oNextDay.getFullYear(), oNextDay.getMonth(), oNextDay.getDate());
|
||||||
|
|
||||||
//Build available dates
|
//Build available dates
|
||||||
var $Select = $('#ugc_dates').find('select');
|
var $Select = $('#ugc_dates').find('select');
|
||||||
var $List = $('#ugc_days');
|
var $List = $('#ugc_days');
|
||||||
@@ -625,35 +626,35 @@ function Settings()
|
|||||||
}
|
}
|
||||||
$Select.append($('<option>', {'value':iTimestamp}).text(sDay));
|
$Select.append($('<option>', {'value':iTimestamp}).text(sDay));
|
||||||
$List.append($('<a>', {'class':'button no_bg inline day', 'id':'day_'+iTimestamp}).data('timestamp', iTimestamp).text(sDay));
|
$List.append($('<a>', {'class':'button no_bg inline day', 'id':'day_'+iTimestamp}).data('timestamp', iTimestamp).text(sDay));
|
||||||
|
|
||||||
//Manual break for extra day in case of Tuesday night after 23h
|
//Manual break for extra day in case of Tuesday night after 23h
|
||||||
if(oNextDay.getDay()==3 && bTuesdayNight) break;
|
if(oNextDay.getDay()==3 && bTuesdayNight) break;
|
||||||
|
|
||||||
//Building next day
|
//Building next day
|
||||||
oNextDay = new Date(this.timestamp(oNextDay) + 24*60*60*1000);
|
oNextDay = new Date(this.timestamp(oNextDay) + 24*60*60*1000);
|
||||||
iCount++;
|
iCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Selecting right value
|
//Selecting right value
|
||||||
$Select.val(this.date('midnight_timestamp'));
|
$Select.val(this.date('midnight_timestamp'));
|
||||||
$List.find('#day_'+this.date('midnight_timestamp')).addClass('clicked');
|
$List.find('#day_'+this.date('midnight_timestamp')).addClass('clicked');
|
||||||
|
|
||||||
//event
|
//event
|
||||||
$Select.change(function(){
|
$Select.change(function(){
|
||||||
Cookies.set('date', $(this).val(), {expires:6});
|
Cookies.set('date', $(this).val(), {expires:6, sameSite: 'lax'});
|
||||||
reload();
|
reload();
|
||||||
});
|
});
|
||||||
$List.find('.day').click(function(){
|
$List.find('.day').click(function(){
|
||||||
Cookies.set('date', $(this).data('timestamp'), {expires:6});
|
Cookies.set('date', $(this).data('timestamp'), {expires:6, sameSite: 'lax'});
|
||||||
reload();
|
reload();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addUgcCinemasToDom = function()
|
this.addUgcCinemasToDom = function()
|
||||||
{
|
{
|
||||||
//Hide buffer
|
//Hide buffer
|
||||||
self.$Settings.find('#buffer_settings').hide();
|
self.$Settings.find('#buffer_settings').hide();
|
||||||
|
|
||||||
//Add cinemas
|
//Add cinemas
|
||||||
var $Cinemas = self.$Settings.find('.cinemas');
|
var $Cinemas = self.$Settings.find('.cinemas');
|
||||||
$.each(self.ugcCinemas(), function(iKey, sCinemaName){
|
$.each(self.ugcCinemas(), function(iKey, sCinemaName){
|
||||||
@@ -665,7 +666,7 @@ function Settings()
|
|||||||
.click(function(){$(this).toggleClass('include');})
|
.click(function(){$(this).toggleClass('include');})
|
||||||
.text(sCinemaName));
|
.text(sCinemaName));
|
||||||
});
|
});
|
||||||
|
|
||||||
//Event: Show / Hide panel
|
//Event: Show / Hide panel
|
||||||
$('#btn_settings').click(function(){self.toggleSettings(true);});
|
$('#btn_settings').click(function(){self.toggleSettings(true);});
|
||||||
$('.background').click(function(){self.toggleSettings(false);});
|
$('.background').click(function(){self.toggleSettings(false);});
|
||||||
@@ -678,23 +679,23 @@ function Settings()
|
|||||||
var $Cine = $(oCinema);
|
var $Cine = $(oCinema);
|
||||||
asCines[$Cine.data('id')] = $Cine.text();
|
asCines[$Cine.data('id')] = $Cine.text();
|
||||||
});
|
});
|
||||||
Cookies.set('cinemas', asCines);
|
Cookies.set('cinemas', asCines, {sameSite: 'lax'});
|
||||||
Cookies.set('premiere', self.premiere()?'true':'false');
|
Cookies.set('premiere', self.premiere()?'true':'false', {sameSite: 'lax'});
|
||||||
reload();
|
reload();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.toggleSettings = function(bShow)
|
this.toggleSettings = function(bShow)
|
||||||
{
|
{
|
||||||
self.$Settings.add('.background').toggle((typeof bShow == 'undefined')?null:bShow);
|
self.$Settings.add('.background').toggle((typeof bShow == 'undefined')?null:bShow);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.timestamp = function(oDate)
|
this.timestamp = function(oDate)
|
||||||
{
|
{
|
||||||
oDate = oDate || new Date();
|
oDate = oDate || new Date();
|
||||||
return oDate.getTime();
|
return oDate.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.error = function(sMsg)
|
this.error = function(sMsg)
|
||||||
{
|
{
|
||||||
console.log('Settings Error: '+sMsg);
|
console.log('Settings Error: '+sMsg);
|
||||||
@@ -847,6 +848,6 @@ function removeDiacritics(str)
|
|||||||
{
|
{
|
||||||
return str.replace(/[^\u0000-\u007E]/g, function(a)
|
return str.replace(/[^\u0000-\u007E]/g, function(a)
|
||||||
{
|
{
|
||||||
return diacriticsMap[a] || a;
|
return diacriticsMap[a] || a;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
sass --unix-newline -l --style=compressed --watch ugc.scss:ugc.css
|
sass --style=compressed --watch ugc.scss:ugc.css
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -97,7 +97,7 @@ select {
|
|||||||
.fa-spinner {
|
.fa-spinner {
|
||||||
color: $ugc_color;
|
color: $ugc_color;
|
||||||
font-size:2em;
|
font-size:2em;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
content: "\f110";
|
content: "\f110";
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ select {
|
|||||||
content: "\f0e7";
|
content: "\f0e7";
|
||||||
}
|
}
|
||||||
.fa-feedback:before {
|
.fa-feedback:before {
|
||||||
content: "\f0b0";
|
content: "\f0b0";
|
||||||
}
|
}
|
||||||
.fa-settings:before {
|
.fa-settings:before {
|
||||||
content: "\f013";
|
content: "\f013";
|
||||||
@@ -186,11 +186,11 @@ header .title time {
|
|||||||
|
|
||||||
nav a {
|
nav a {
|
||||||
color: $ugc_color;
|
color: $ugc_color;
|
||||||
|
|
||||||
&:hover, &.hidden {
|
&:hover, &.hidden {
|
||||||
color: $comp_color;
|
color: $comp_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.hidden:hover {
|
&.hidden:hover {
|
||||||
color: $ugc_color;
|
color: $ugc_color;
|
||||||
}
|
}
|
||||||
@@ -226,11 +226,11 @@ main {
|
|||||||
-webkit-box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.5);
|
-webkit-box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.5);
|
||||||
-moz-box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.5);
|
-moz-box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.5);
|
||||||
box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.5);
|
box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.5);
|
||||||
|
|
||||||
* {
|
* {
|
||||||
transform: translate(0px, 0px);
|
transform: translate(0px, 0px);
|
||||||
}
|
}
|
||||||
|
|
||||||
img.bg {
|
img.bg {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
top:50%;
|
top:50%;
|
||||||
@@ -241,10 +241,10 @@ main {
|
|||||||
opacity:0.2;
|
opacity:0.2;
|
||||||
width:calc(100% - #{$poster_size});
|
width:calc(100% - #{$poster_size});
|
||||||
}
|
}
|
||||||
|
|
||||||
.poster-container {
|
.poster-container {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
img.poster {
|
img.poster {
|
||||||
width: $poster_size;
|
width: $poster_size;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
@@ -255,41 +255,41 @@ main {
|
|||||||
p {
|
p {
|
||||||
margin: 0.5em 0;
|
margin: 0.5em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
z-index:2;
|
z-index:2;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align:top;
|
vertical-align:top;
|
||||||
padding:1em;
|
padding:1em;
|
||||||
width: calc(100% - 2em - #{$poster_size});
|
width: calc(100% - 2em - #{$poster_size});
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
a.name {
|
a.name {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.edito {
|
.edito {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
color:#777;
|
color:#777;
|
||||||
}
|
}
|
||||||
|
|
||||||
.film-info {
|
.film-info {
|
||||||
padding-left: calc((1.28571429em + 0.5em)/0.9);
|
padding-left: calc((1.28571429em + 0.5em)/0.9);
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
color: #555;
|
color: #555;
|
||||||
|
|
||||||
.director {
|
.director {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
|
|
||||||
.more-info {
|
.more-info {
|
||||||
font-size: calc(1em/0.9);
|
font-size: calc(1em/0.9);
|
||||||
margin-left: 0.5em;
|
margin-left: 0.5em;
|
||||||
vertical-align: -0.05em;
|
vertical-align: -0.05em;
|
||||||
|
|
||||||
&:not(.fa-spin) {
|
&:not(.fa-spin) {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
&:hover {
|
&:hover {
|
||||||
@@ -298,36 +298,36 @@ main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.film-details {
|
.film-details {
|
||||||
border-left: 2px solid #CCC;
|
border-left: 2px solid #CCC;
|
||||||
padding-left: 0.5em;
|
padding-left: 0.5em;
|
||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
color: #555;
|
color: #555;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.timetable {
|
.timetable {
|
||||||
margin-top:1em;
|
margin-top:1em;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
|
|
||||||
p {
|
p {
|
||||||
line-height: 2.0;
|
line-height: 2.0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cinema {
|
.cinema {
|
||||||
margin-right:0.5em;
|
margin-right:0.5em;
|
||||||
|
|
||||||
.fa {
|
.fa {
|
||||||
font-size: 1.25em;
|
font-size: 1.25em;
|
||||||
line-height: 0.7656249414em;
|
line-height: 0.7656249414em;
|
||||||
vertical-align: -14.06250352%;
|
vertical-align: -14.06250352%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.lang {
|
.lang {
|
||||||
margin-right:0.5em;
|
margin-right:0.5em;
|
||||||
}
|
}
|
||||||
@@ -358,6 +358,14 @@ footer {
|
|||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
margin: 1em 0 0 0;
|
margin: 1em 0 0 0;
|
||||||
color: $ugc_color;
|
color: $ugc_color;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: $ugc_color;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: $comp_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Section - Settings */
|
/* Section - Settings */
|
||||||
@@ -390,7 +398,7 @@ footer {
|
|||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
position:relative;
|
position:relative;
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
right:0;
|
right:0;
|
||||||
@@ -412,7 +420,7 @@ footer {
|
|||||||
|
|
||||||
li {
|
li {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover, &.include {
|
&:hover, &.include {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user