--- a/integ/iri-buzz.html Tue Apr 30 12:51:27 2013 +0200
+++ b/integ/iri-buzz.html Tue Apr 30 15:36:42 2013 +0200
@@ -122,22 +122,6 @@
<script type="text/javascript" src="js/script.js"></script>
-<!-- IRI -->
-
-<script type="text/javascript">
- function getURLParameter(name) {
- return decodeURI(
- (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
- );
- }
-
- var getPartner = getURLParameter('partner');
- var partnerCode = (getPartner != 'null') ? getPartner : 'B00015838755';
-
-</script>
-
-<!-- IRI -->
-
<script src="renkan/lib/underscore-min.js"></script>
<script src="js/vs/_VisualSedimentation.js"></script>
--- a/integ/iri-creation-cinecard.html Tue Apr 30 12:51:27 2013 +0200
+++ b/integ/iri-creation-cinecard.html Tue Apr 30 15:36:42 2013 +0200
@@ -161,12 +161,12 @@
<script type="text/javascript">
function getURLParameter(name) {
return decodeURI(
- (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
+ (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||["",""])[1]
);
}
- var getMovie = getURLParameter('movie'),
- idMovie = (getMovie != 'null') ? getMovie : 135082,
+ var programmeCode = getURLParameter("code") || "135082",
+ programmeType = getURLParameter("type") || "movie",
partnerCode = 'B00015838755',
stickers_base = './iri/stickers/',
renkan_base = './renkan/';
--- a/integ/iri/js/iri-buzz.js Tue Apr 30 12:51:27 2013 +0200
+++ b/integ/iri/js/iri-buzz.js Tue Apr 30 15:36:42 2013 +0200
@@ -13,7 +13,7 @@
"4.0": 2, "4.5": 2, "5.0": 2
},
movieCount: 15,
- opinionsPerPage: 100,
+ opinionsPerPage: 20,
colors: [ "#f62a43", "#f3c000", "#2d9252"],
refreshRate: 200,
columnSpacing: 40,
--- a/integ/iri/js/iri-creation-cinecard.js Tue Apr 30 12:51:27 2013 +0200
+++ b/integ/iri/js/iri-creation-cinecard.js Tue Apr 30 15:36:42 2013 +0200
@@ -69,121 +69,123 @@
e.preventDefault();
});
-//-- API allocine
+var apiBase = 'http://api.allocine.fr/rest/v3/';
-//-- movie
-var urlMovie = 'http://api.allocine.fr/rest/v3/movie?partner='+partnerCode+'&code='+ idMovie;
-$.getJSON(urlMovie, function(data) {
- var movie = data.movie;
+//Getting Movie/Series Metadata
- //-- title
- $('.wrap-top .movie-title').text(movie.title);
- $('.wrap-top .movie-year').text(movie.productionYear);
-
- //-- stars
- var castMember = movie.castMember;
+var starTemplate = _.template(
+ '<li class="cinecard-draggable" draggable="true">'
+ + '<a class="tool-info" target="_blank" href="http://www.allocine.fr/personne/fichepersonne_gen_cpersonne=<%- person.code %>" data-title="<%- person.name %>, <%- activity["$"] %><% if (typeof role !== "undefined") { print(" (" + role + ")"); } %>">'
+ + '<img src="<% if (typeof picture !== "undefined") { print(picture.href); } else { print("http://fr.web.img3.acsta.net/c_160_213/b_1_d6d6d6/commons/emptymedia/empty_star.jpg"); } %>" alt="Photo de <%- person.name %>" />'
+ + '</a>'
+ + '</li>'
+);
- $.each(castMember, function(k, v){
- var name = v.person.name;
- var codeActor = v.person.code;
- var urlPicture;
- if(v.picture !== undefined) {
- urlPicture = v.picture.href;
- }else{
- urlPicture = 'http://fr.web.img3.acsta.net/c_160_213/b_1_d6d6d6/commons/emptymedia/empty_star.jpg';
- }
- var urlFichePersonne = 'http://www.allocine.fr/personne/fichepersonne_gen_cpersonne='+codeActor+'.html';
- var itemStar =
- '<li class="cinecard-draggable" draggable="true">'+
- '<a class="tool-info" target="_blank" href="'+ urlFichePersonne +'" data-title="'+ name +'">'+
- '<img src="'+ urlPicture +'" alt="'+ name +'" />'+
- '</a>'+
- '</li>';
- $('#stars-more').append(itemStar);
- });
-
- /* Creating Renkan Template */
- var _posterData = {
- title: movie.title,
- image: movie.poster.href,
- uri: _(movie.link).find(function(l) { return l.rel === "aco:web" }).href,
- position: {
- x: 0,
- y: 0
- },
- description: "Affiche du film",
- size: 4
- },
- _startAngle = Math.PI / 6,
- _stickerDistance = 220,
- _filmNode = _renkan.project.addNode(_posterData);
+$.getJSON(
+ apiBase + programmeType,
+ {
+ partner: partnerCode,
+ code: programmeCode
+ },
+ function(data) {
- stickerlist.filter(function(s) {
- return s.loadAtStart;
- }).forEach(function(v, k, l) {
- var _a = _startAngle + 2 * Math.PI * k / l.length,
- _stickerData = {
- title: "",
- description: v.description,
+ var programme = data[programmeType];
+
+ //-- title
+ $('.wrap-top .movie-title').text(programme.title);
+ $('.wrap-top .movie-year').text(programme.productionYear || programme.yearStart || "");
+
+ //-- stars
+ $('#stars-more').html(programme.castMember.map(starTemplate).join(""));
+
+ /* Creating Renkan Template */
+ var _posterData = {
+ title: programme.title,
+ image: programme.poster.href,
+ uri: _(programme.link).find(function(l) { return l.rel === "aco:web" }).href,
position: {
- x: _stickerDistance * Math.cos(_a),
- y: -_stickerDistance * Math.sin(_a)
+ x: 0,
+ y: 0
},
- image: stickers_base + v.image,
- size: 0
+ description: "Affiche du film",
+ size: 4
},
- _stickerNode = _renkan.project.addNode(_stickerData),
- _edgeData = {
- from: _filmNode,
- to: _stickerNode
- }
- _renkan.project.addEdge(_edgeData);
- });
+ _startAngle = Math.PI / 6,
+ _stickerDistance = 220,
+ _filmNode = _renkan.project.addNode(_posterData);
+
+ stickerlist.filter(function(s) {
+ return s.loadAtStart;
+ }).forEach(function(v, k, l) {
+ var _a = _startAngle + 2 * Math.PI * k / l.length,
+ _stickerData = {
+ title: "",
+ description: v.description,
+ position: {
+ x: _stickerDistance * Math.cos(_a),
+ y: -_stickerDistance * Math.sin(_a)
+ },
+ image: stickers_base + v.image,
+ size: 0
+ },
+ _stickerNode = _renkan.project.addNode(_stickerData),
+ _edgeData = {
+ from: _filmNode,
+ to: _stickerNode
+ }
+ _renkan.project.addEdge(_edgeData);
+ });
+ }
+);
-});
+//Getting Pictures Metadata
-//-- picture
-var urlPicture = 'http://api.allocine.fr/rest/v3/picturelist?partner='+partnerCode+'&subject=movie:'+ idMovie;
-$.getJSON(urlPicture, function(data) {
- var media = data.feed.media;
- $.each(media, function(k, v){
- var urlThumb = v.thumbnail.href;
- var rcode = v.rcode;
- var title = v.title;
- var urlAllocine = 'http://www.allocine.fr/film/fichefilm-'+ idMovie +'/photos/detail/?cmediafile='+ rcode;
- var itemImagess =
- '<li class="cinecard-draggable" draggable="true">'+
- '<a class="tool-info" target="_blank" href="'+ urlAllocine +'" data-title="'+title+'">'+
- '<img src="'+ urlThumb +'" alt="'+title+'" />'+
- '</a>'+
- '</li>';
- $('#images-more').append(itemImagess);
- });
- resizeImg('#images-more');
-});//get
+var picTemplate = _.template(
+ '<li class="cinecard-draggable" draggable="true">'
+ + '<a class="tool-info" target="_blank" href="http://www.allocine.fr/'
+ + '<% if (programmeType === "movie") { print("film/fichefilm") } else { print("series/ficheserie") } %>-'
+ + '<%- programmeCode %>/photos/detail/?cmediafile=<%- rcode %>" data-title="<%- title %>">'
+ + '<img src="<%- thumbnail.href %>" alt="<%- title %>" />'
+ + '</a>'
+ + '</li>'
+);
+
+$.getJSON(
+ apiBase + 'picturelist',
+ {
+ partner: partnerCode,
+ subject: programmeType + ':' + programmeCode,
+ count: 60
+ },
+ function(data) {
+ $('#images-more').html(data.feed.media.map(picTemplate).join(""));
+ resizeImg('#images-more');
+ }
+);
-//-- trailer
-var urlTrailers = 'http://api.allocine.fr/rest/v3/videolist?partner='+partnerCode+'&mediafmt=flv&subject=movie:'+ idMovie;
-$.getJSON(urlTrailers, function(data) {
- var media = data.feed.media;
- $.each(media, function(k, v){
- console.log(v)
- var urlThumbnail = v.thumbnail.href;
- var title = v.title;
- var code = v.code;
- var url = 'http://www.allocine.fr/video/player_gen_cmedia='+code+'&cfilm='+idMovie+'.html';
- var itemVideo =
- '<li class="cinecard-draggable" draggable="true">'+
- '<a class="tool-info" target="_blank" href="'+ url +'" data-title="'+title+'">'+
- '<img src="'+ urlThumbnail +'" alt="'+title+'" />'+
- '</a>'+
- '</li>';
- $('#videos-more').append(itemVideo);
+//Getting Videos Metadata
+
+var videoTemplate = _.template(
+ '<li class="cinecard-draggable" draggable="true">'
+ + '<a class="tool-info" target="_blank" href="http://www.allocine.fr/blogvision/<%- code %>" data-title="<%- title %>">'
+ + '<img src="<%- thumbnail.href %>" alt="<%- title %>" />'
+ + '</a>'
+ + '</li>'
+);
+
+$.getJSON(
+ apiBase + 'videolist',
+ {
+ partner: partnerCode,
+ subject: programmeType + ':' + programmeCode,
+ count: 60
+ },
+ function(data) {
+ $('#videos-more').html(data.feed.media.map(videoTemplate).join(""));
resizeImg('#videos-more');
- });
-});
-
+ }
+);
function resizeImg(parentId){
$(parentId+" img").each(function() {
@@ -208,7 +210,7 @@
}
//TOOLTIP
-var show_tooltip_info_iri = function(elem){
+function show_tooltip_info_iri(elem){
var tooltip = $('.rate_tooltip'),
name = elem.attr('data-title'),
arrow = tooltip.find('.arrow_l'),
@@ -221,7 +223,7 @@
left : right
});
}
-var hide_tooltip_info_iri = function(elem){
+function hide_tooltip_info_iri(elem){
var tooltip = $('.rate_tooltip');
tooltip.hide();
}