--- a/integ/iri/js/iri-buzz.js Tue Apr 30 15:55:54 2013 +0200
+++ b/integ/iri/js/iri-buzz.js Tue Apr 30 18:22:21 2013 +0200
@@ -5,17 +5,17 @@
var config = {
partnerCode: 'B00015838755',
originalDuration: 24 * HOURS,
- vizDuration: 10 * MINUTES,
+ vizDuration: 8 * MINUTES,
colorIds: {
"-2.0": 2,
"0.5": 0, "1.0": 0, "1.5": 0, "2.0": 0,
"2.5": 1, "3.0": 1, "3.5": 1,
"4.0": 2, "4.5": 2, "5.0": 2
},
- movieCount: 15,
- opinionsPerPage: 20,
+ movieCount: 10,
+ opinionsPerPage: 100,
colors: [ "#f62a43", "#f3c000", "#2d9252"],
- refreshRate: 200,
+ refreshRate: 500,
columnSpacing: 40,
columnWidth: 150,
tokenHeight: 16
@@ -74,8 +74,6 @@
function startViz() {
- var barChart = undefined;
-
opinions.sort(function(a,b) {
return a._timestamp > b._timestamp;
});
@@ -85,8 +83,11 @@
height : vsHeight,
chart : {
spacer : config.columnSpacing / 2,
- y: 100,
- height: vsHeight - 100
+ y: 0,
+ height: vsHeight
+ },
+ options : {
+ layout: false
},
data : {
model : movies.map(function(movie) {
@@ -155,6 +156,8 @@
},
callback:{
suspension: function(token) {
+ var currentT = config.refreshRate * token.attr("t");
+ deltaT = Date.now() - currentT;
setTimeout(function() {
token.flocculate();
barChart.strata.update(barChart);
@@ -172,7 +175,7 @@
}
},
aggregation:{
- height: vsHeight - 100,
+ height: vsHeight - 80,
maxData: Math.max.apply(Math, movies.map(function(m) { return m.opinions.length; }))
},
suspension:{
@@ -183,16 +186,19 @@
}
}
- //console.log(barChartSettings);
+ console.log(barChartSettings);
- barChart = $("#data-viz").vs(barChartSettings).data('visualSedimentation');
- var startOfViz = Date.now();
+ var barChart = $("#data-viz").vs(barChartSettings).data('visualSedimentation');
+
+ $(".timer-bar-value").width(0);
+
clearInterval(clockInterval);
- $(".timer-bar-value").width(0);
+ deltaT = Date.now();
clockInterval = setInterval(function() {
- $(".timer-bar-value").width($('.timer-bar').width() * Math.min(1, (Date.now() - startOfViz) / config.vizDuration));
- },
- 100);
+ var t = Date.now() - deltaT,
+ w = $('.timer-bar').width() * Math.min(1, t / config.vizDuration);
+ $(".timer-bar-value").width(w);
+ }, 200);
}
function loadMovie(movie) {
@@ -243,7 +249,23 @@
}
);
}
-
+
+ var acimgserv = 0, acimgservcount = 6;
+
+ function resizeAcPicture(pic, w, h) {
+ var path = pic.path || pic.href || pic || "";
+ if (/^https?:\/\//.test(path)) {
+ path = path.replace(/^https?:\/\/[^\/]+/,'');
+ }
+ return "http://fr.web.img"
+ + ( 1 + (acimgserv++ % acimgservcount))
+ + ".acsta.net/r_"
+ + w
+ + "_"
+ + h
+ + path;
+ }
+
$.getJSON(
"http://api.allocine.fr/rest/v3/movielist",
{
@@ -267,7 +289,7 @@
poster: movie.poster.href,
opinions: [],
opinionPage: 1
- }
+ };
});
moviesToLoad = movies.length;
movies.forEach(loadMovie);
@@ -275,7 +297,7 @@
return '<li style=" margin: 0 '
+ Math.floor(config.columnSpacing / 2)
+ 'px"><img width="150" height="200" src="'
- + movie.poster
+ + resizeAcPicture(movie.poster,150,200)
+ '" alt="'
+ movie.title
+'" /></li>';
--- a/integ/iri/js/iri-creation-cinecard.js Tue Apr 30 15:55:54 2013 +0200
+++ b/integ/iri/js/iri-creation-cinecard.js Tue Apr 30 18:22:21 2013 +0200
@@ -69,6 +69,23 @@
e.preventDefault();
});
+var acimgserv = 0,
+ acimgservcount = 6;
+
+window.resizeAcPicture = function(pic, w, h) {
+ var path = pic.path || pic.href || pic || "";
+ if (/^https?:\/\//.test(path)) {
+ path = path.replace(/^https?:\/\/[^\/]+/,'');
+ }
+ return "http://fr.web.img"
+ + ( 1 + (acimgserv++ % acimgservcount))
+ + ".acsta.net/r_"
+ + w
+ + "_"
+ + h
+ + path
+}
+
var apiBase = 'http://api.allocine.fr/rest/v3/';
//Getting Movie/Series Metadata
@@ -76,7 +93,7 @@
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 %>" />'
+ + '<img src="<% if (typeof picture !== "undefined") { print(resizeAcPicture(picture,232,312)); } else { print(resizeAcPicture("/commons/emptymedia/empty_star.jpg",58, 78)); } %>" alt="Photo de <%- person.name %>" />'
+ '</a>'
+ '</li>'
);
@@ -146,7 +163,7 @@
+ '<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 %>" />'
+ + '<img src="<%- resizeAcPicture(thumbnail,800,600) %>" alt="<%- title %>" />'
+ '</a>'
+ '</li>'
);
@@ -156,7 +173,7 @@
{
partner: partnerCode,
subject: programmeType + ':' + programmeCode,
- count: 60
+ count: 30
},
function(data) {
$('#images-more').html(data.feed.media.map(picTemplate).join(""));
@@ -169,7 +186,7 @@
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 %>" />'
+ + '<img src="<%- resizeAcPicture(thumbnail,800,600) %>" alt="<%- title %>" />'
+ '</a>'
+ '</li>'
);
@@ -179,7 +196,7 @@
{
partner: partnerCode,
subject: programmeType + ':' + programmeCode,
- count: 60
+ count: 30
},
function(data) {
$('#videos-more').html(data.feed.media.map(videoTemplate).join(""));