adding avant-première movies (option)

This commit is contained in:
2016-03-20 19:45:58 +01:00
parent f51a05da34
commit 9d7e64ce22
7 changed files with 43 additions and 9 deletions

View File

@@ -38,6 +38,7 @@
<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>
<div id="buffer_settings"><i class="fa fa-spinner fa-spin"></i></div> <div id="buffer_settings"><i class="fa fa-spinner fa-spin"></i></div>
<ul class="cinemas"></ul> <ul class="cinemas"></ul>
<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>

View File

@@ -17,8 +17,8 @@ function Film(oSettings)
{ {
this._ban.status = true; this._ban.status = true;
this._ban.reason = sReason; this._ban.reason = sReason;
this.feedback('Hidding movie "'+this.name()+'": '+this.ban().reason);
this.anchor().addClass('banned'); this.anchor().addClass('banned');
this.feedback('Hidding movie "'+this.name()+'": '+this.ban().reason);
} }
else this.error('Setting ban status with no reason'); else this.error('Setting ban status with no reason');
} }
@@ -84,9 +84,12 @@ function Film(oSettings)
{ {
var sEdito = this.edito() || ''; var sEdito = this.edito() || '';
var iRank = 0; var iRank = 0;
if(this.ban().status) iRank -= 10000000; if(this.ban().status) iRank -= 1000000000; //Banned movies
else if(sEdito=='Nouveau') iRank += 10000000; else if(sEdito=='Avant-première') iRank += 1000000000; //Special event
else if(sEdito.slice(-7)=='semaine') iRank += 100000*parseInt(sEdito.substr(0, sEdito.indexOf('è'))); else if(sEdito=='Nouveau') iRank += 10000000; //New releases
else if(sEdito.slice(-7)=='semaine')iRank += 100000 * parseInt(sEdito.substr(0, sEdito.indexOf('è'))); //Popular movies
//Adding movie ID (newer movies have greater IDs)
iRank += parseInt(this.id(), 10); iRank += parseInt(this.id(), 10);
return iRank; return iRank;
}; };
@@ -225,7 +228,7 @@ function Ugc()
this.onPostLoad = function() this.onPostLoad = function()
{ {
$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){
@@ -286,7 +289,7 @@ function Ugc()
oFilm.anchor(); oFilm.anchor();
//Ban if wrong edito //Ban if wrong edito
if(sEdito=='Avant-première' || 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);
@@ -391,6 +394,18 @@ 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
var bCookiePremiere = Cookies.getJSON('premiere');
this.premiere(bCookiePremiere==null?false:bCookiePremiere);
$('.switches').click(function(){self.premiere(!self.premiere());});
};
this.premiere = function(bActive)
{
var $Premiere = $('#premiere');
if(bActive==null) return $Premiere.hasClass('fa-on');
else $Premiere.removeClass('fa-on fa-off').addClass(bActive?'fa-on':'fa-off');
}; };
this.ugcCinemas = function(asCinemas) this.ugcCinemas = function(asCinemas)
@@ -506,7 +521,7 @@ function Settings()
.attr('id', 'cinema_'+iCinemaId) .attr('id', 'cinema_'+iCinemaId)
.data('id', iCinemaId) .data('id', iCinemaId)
.toggleClass('include', (iCinemaId in self.cinemas())) .toggleClass('include', (iCinemaId in self.cinemas()))
.click(function(){$(this).toggleClass('include')}) .click(function(){$(this).toggleClass('include');})
.text(sCinemaName)); .text(sCinemaName));
}); });
@@ -523,6 +538,7 @@ function Settings()
asCines[$Cine.data('id')] = $Cine.text(); asCines[$Cine.data('id')] = $Cine.text();
}); });
Cookies.set('cinemas', asCines); Cookies.set('cinemas', asCines);
Cookies.set('premiere', self.premiere()?'true':'false');
reload(); reload();
}); });
}; };

0
style/_big_screen.scss Normal file → Executable file
View File

0
style/_small_screen.scss Normal file → Executable file
View File

2
style/ugc.css Normal file → Executable file

File diff suppressed because one or more lines are too long

2
style/ugc.css.map Normal file → Executable file

File diff suppressed because one or more lines are too long

View File

@@ -117,6 +117,15 @@ select {
.fa-down:before { .fa-down:before {
content: "\f0d7"; content: "\f0d7";
} }
.fa-on:before {
content: "\f205";
}
.fa-off:before {
content: "\f204";
}
.fa-on, .fa-off {
cursor: pointer;
}
/* Sections */ /* Sections */
@@ -354,6 +363,14 @@ footer {
font-weight: bold; font-weight: bold;
} }
#settings .switches {
margin-top: 1em;
}
#settings .switches .fa-on + span {
font-weight: bold;
}
/* Mobile Support */ /* Mobile Support */
@import 'small_screen'; @import 'small_screen';