| author | veltr |
| Mon, 13 May 2013 18:08:25 +0200 | |
| changeset 69 | 4265db059697 |
| parent 67 | cff3bbe9e539 |
| child 70 | 7c2a81e5d027 |
| permissions | -rw-r--r-- |
| 54 | 1 |
var SECONDS = 1000, |
2 |
MINUTES = 60 * SECONDS, |
|
3 |
HOURS = 60 * MINUTES; |
|
| 30 | 4 |
|
| 54 | 5 |
var config = { |
6 |
partnerCode: 'B00015838755', |
|
7 |
originalDuration: 24 * HOURS, |
|
| 59 | 8 |
vizDuration: 8 * MINUTES, |
| 53 | 9 |
colorIds: { |
10 |
"-2.0": 2, |
|
11 |
"0.5": 0, "1.0": 0, "1.5": 0, "2.0": 0, |
|
12 |
"2.5": 1, "3.0": 1, "3.5": 1, |
|
13 |
"4.0": 2, "4.5": 2, "5.0": 2 |
|
14 |
}, |
|
| 59 | 15 |
movieCount: 10, |
16 |
opinionsPerPage: 100, |
|
| 56 | 17 |
colors: [ "#f62a43", "#f3c000", "#2d9252"], |
| 63 | 18 |
borderColors: [ "#f7788e", "#fdde83", "#3bb767" ], |
| 67 | 19 |
imageUrlBase: 'iri/img/', |
| 62 | 20 |
refreshRate: .25 * SECONDS, |
| 56 | 21 |
columnSpacing: 40, |
22 |
columnWidth: 150, |
|
| 62 | 23 |
tokenHeight: 16, |
| 63 | 24 |
fallSpeed: 4, |
25 |
disappearAfter: 4 * SECONDS |
|
| 28 | 26 |
} |
27 |
||
| 54 | 28 |
$(function() { |
29 |
|
|
| 56 | 30 |
var originalStart = Date.now() - config.originalDuration, |
| 54 | 31 |
timeScale = config.vizDuration / config.originalDuration, |
32 |
movies, |
|
33 |
moviesToLoad, |
|
34 |
opinions = [], |
|
| 56 | 35 |
loadTime = Date.now(), |
36 |
clockInterval, |
|
37 |
tzDelta = 0, |
|
38 |
tzSuffix = 'Z'; |
|
| 63 | 39 |
|
40 |
|
|
41 |
// Add Patterns |
|
42 |
var xml = '<svg style="position: absolute;" width="1" height="1"><defs>' |
|
| 67 | 43 |
+ _.range(3).map(function(i) { |
| 63 | 44 |
return '<pattern id="pattern_' |
45 |
+ i |
|
| 67 | 46 |
+ '" x="0" y="0" width="3" height="3" patternUnits="userSpaceOnUse"><image x="0" y="0" width="3" height="3" xlink:href="' |
47 |
+ config.imageUrlBase |
|
48 |
+ 'pattern-' |
|
49 |
+ i |
|
50 |
+ '.png" /></pattern>'; |
|
| 63 | 51 |
}).join("") |
52 |
+ '</defs></svg>'; |
|
53 |
$("body").append(xml); |
|
| 54 | 54 |
|
55 |
function resizeTimer() { |
|
| 64 | 56 |
var w = Math.max(80, $(window).width() - 158), |
| 54 | 57 |
n = Math.min(12, Math.floor(w / 80)); |
58 |
$('.timer-bar').width(w); |
|
59 |
var html = ''; |
|
60 |
for (var k = 0; k < n + 1; k++) { |
|
61 |
html += '<li style="left:' |
|
62 |
+ Math.floor(k * w / n) |
|
63 |
+ 'px;">' |
|
| 55 | 64 |
+ new Date(originalStart + k * config.originalDuration / n).toTimeString().substr(0,5) |
| 54 | 65 |
+ '</li>'; |
66 |
} |
|
67 |
$('.hours').html(html); |
|
68 |
} |
|
69 |
|
|
70 |
resizeTimer(); |
|
71 |
$(window).resize(resizeTimer); |
|
72 |
|
|
73 |
var vsHeight = $(window).height() - $('footer').height() - $('header').height() - 300, |
|
| 56 | 74 |
vsWidth = config.movieCount * (config.columnWidth + config.columnSpacing); |
| 54 | 75 |
|
| 64 | 76 |
$("#data-viz").css({ |
77 |
height: vsHeight, |
|
78 |
width: vsWidth |
|
79 |
}); |
|
| 54 | 80 |
$('.posters').css('width', vsWidth); |
81 |
|
|
| 64 | 82 |
var timeAtPause = 0, paused = true, timeStart; |
| 62 | 83 |
|
84 |
function currentVizTime() { |
|
85 |
if (paused) { |
|
86 |
return timeAtPause; |
|
87 |
} else { |
|
88 |
return new Date().valueOf() - timeStart; |
|
89 |
} |
|
90 |
} |
|
91 |
|
|
92 |
function vizTimeToOriginalTime(t) { |
|
93 |
return originalStart + t / timeScale; |
|
94 |
} |
|
95 |
|
|
96 |
function originalTimeToVizTime(t) { |
|
97 |
return (t - originalStart) * timeScale; |
|
98 |
} |
|
99 |
|
|
100 |
function play() { |
|
101 |
if (!paused) { |
|
102 |
return; |
|
103 |
} |
|
| 64 | 104 |
timeStart = Date.now() - timeAtPause; |
| 62 | 105 |
paused = false; |
| 64 | 106 |
$(".play-pause").removeClass("play").addClass("pause").attr("title", "Pause"); |
| 62 | 107 |
} |
108 |
|
|
109 |
function pause() { |
|
110 |
if (paused) { |
|
111 |
return; |
|
112 |
} |
|
113 |
timeAtPause = currentVizTime(); |
|
114 |
paused = true; |
|
| 64 | 115 |
$(".play-pause").removeClass("pause").addClass("play").attr("title", "Lecture"); |
| 62 | 116 |
} |
117 |
|
|
118 |
$(".play-pause").click(function() { |
|
119 |
if (paused) { |
|
120 |
play(); |
|
121 |
} else { |
|
122 |
pause(); |
|
123 |
} |
|
124 |
}); |
|
125 |
|
|
| 64 | 126 |
function agoify(timestamp) { |
127 |
var h = "Il y a ", |
|
128 |
deltaT = Date.now() - timestamp, |
|
129 |
deltaH = Math.round(deltaT / HOURS); |
|
130 |
if (deltaH) { |
|
131 |
h += deltaH + " heure"; |
|
132 |
if (deltaH > 1) { |
|
133 |
h += "s"; |
|
134 |
} |
|
135 |
} else { |
|
136 |
var deltaM = Math.round(deltaT / MINUTES); |
|
137 |
h += deltaM + " minute"; |
|
138 |
if (deltaM > 1) { |
|
139 |
h += "s"; |
|
140 |
} |
|
141 |
} |
|
142 |
return h; |
|
143 |
} |
|
144 |
|
|
145 |
var opinionTemplate = _.template( |
|
146 |
'<div class="comment-content clearfix action-<%- actiontype %>">' |
|
147 |
+ '<div class="avatar"><img src="<%- avatar %>" alt="Avatar" /></div>' |
|
148 |
+ '<div class="comment-right">' |
|
149 |
+ '<div class="comment-metadata">' |
|
150 |
+ '<span class="username"><%- username %> </span>' |
|
151 |
+ ' <span class="date"> <%- ago %></span>' |
|
152 |
+ '<ul class="stars-rating rate-<%- ratevalue %>">' |
|
153 |
+ '<li></li><li></li><li></li><li></li><li></li>' |
|
154 |
+ '</ul>' |
|
155 |
+ '</div>' |
|
156 |
+ '<p class="review-content"><%- content %></p>' |
|
157 |
+ '</div>' |
|
158 |
+ '</div>' |
|
159 |
+ '<div class="comment-arrow"></div>' |
|
160 |
); |
|
161 |
|
|
| 67 | 162 |
var barChart = undefined; |
163 |
|
|
| 54 | 164 |
function startViz() { |
165 |
|
|
| 67 | 166 |
$("#comment").hide(); |
167 |
|
|
168 |
console.log("Start Viz"); |
|
| 64 | 169 |
|
| 67 | 170 |
if (typeof barChart !== "undefined") { |
171 |
console.log("Bar Chart exists"); |
|
172 |
barChart.selectAll("state",1).forEach(function(t) { |
|
173 |
t.flocculate(); |
|
174 |
}); |
|
175 |
} |
|
176 |
|
|
177 |
|
|
178 |
paused = true; |
|
| 62 | 179 |
timeAtPause = 0; |
180 |
|
|
| 54 | 181 |
opinions.sort(function(a,b) { |
182 |
return a._timestamp > b._timestamp; |
|
183 |
}); |
|
| 67 | 184 |
$("#data-viz").html(""); |
| 63 | 185 |
|
186 |
var lastShownToken = null, |
|
187 |
maxData = Math.max.apply(Math, movies.map(function(m) { return m.opinions.length; })), |
|
188 |
aggrHeight = vsHeight - 80, |
|
| 67 | 189 |
aggrScale = aggrHeight / maxData, |
190 |
firstStrataCall = true; |
|
| 63 | 191 |
|
| 54 | 192 |
var barChartSettings = { |
193 |
width : vsWidth, |
|
194 |
height : vsHeight, |
|
195 |
chart : { |
|
| 56 | 196 |
spacer : config.columnSpacing / 2, |
| 59 | 197 |
y: 0, |
198 |
height: vsHeight |
|
199 |
}, |
|
200 |
options : { |
|
| 63 | 201 |
layout: false |
| 54 | 202 |
}, |
203 |
data : { |
|
204 |
model : movies.map(function(movie) { |
|
205 |
return { |
|
206 |
label: movie.title |
|
207 |
}; |
|
208 |
}), |
|
209 |
strata : function() { |
|
| 67 | 210 |
var flocculated = (typeof barChart === "undefined" ? [] : barChart.selectAll("state",2) ); |
211 |
|
|
212 |
if (firstStrataCall) { |
|
213 |
_.defer(function() { |
|
214 |
_.range(3).map(function(colorId) { |
|
215 |
$(".layer_"+colorId).css({ |
|
216 |
fill: "url(#pattern_" +colorId + ")", |
|
217 |
stroke: config.borderColors[colorId] |
|
218 |
}); |
|
| 54 | 219 |
}); |
| 63 | 220 |
}); |
| 67 | 221 |
firstStrataCall = false; |
| 54 | 222 |
} |
223 |
|
|
| 63 | 224 |
var res = movies.map(function(movie, i) { |
| 54 | 225 |
var movieTokens = flocculated.filter(function(t) { |
226 |
return t.attr("movie") === movie.id; |
|
227 |
}); |
|
| 63 | 228 |
var movieHeight = aggrScale * movieTokens.length; |
229 |
movie.poster$.find(".poster-overlay").css("top", -movieHeight); |
|
| 54 | 230 |
return _.range(3).map(function(colorId) { |
231 |
var stratumTokens = movieTokens.filter(function(t) { |
|
232 |
return t.attr("colorId") === colorId; |
|
233 |
}).length; |
|
| 63 | 234 |
movie.poster$.find(".poster-" + colorId).text(stratumTokens); |
| 54 | 235 |
return { |
236 |
value: function() { |
|
237 |
return stratumTokens |
|
238 |
} |
|
239 |
}; |
|
240 |
}); |
|
241 |
}); |
|
242 |
|
|
243 |
return res; |
|
244 |
}, |
|
245 |
stream : { |
|
| 62 | 246 |
provider : "direct" |
247 |
} |
|
| 54 | 248 |
}, |
249 |
sedimentation: { |
|
250 |
token: { |
|
251 |
size: { |
|
252 |
original:12, |
|
253 |
minimum:0 |
|
254 |
} |
|
255 |
}, |
|
256 |
aggregation:{ |
|
| 63 | 257 |
height: aggrHeight, |
258 |
maxData: maxData |
|
| 54 | 259 |
}, |
260 |
suspension:{ |
|
261 |
decay:{ |
|
262 |
power:1.001 |
|
263 |
} |
|
264 |
} |
|
265 |
} |
|
266 |
} |
|
| 56 | 267 |
|
| 62 | 268 |
function onTokenMouseover(token) { |
| 63 | 269 |
if (token !== lastShownToken) { |
270 |
$("body").css("cursor", "pointer"); |
|
| 64 | 271 |
commentDiv.html(opinionTemplate({ |
272 |
actiontype: token.attr("actiontype"), |
|
273 |
avatar: token.attr("avatar"), |
|
274 |
username: token.attr("username"), |
|
275 |
ago: agoify(token.attr("timestamp")), |
|
276 |
ratevalue: token.attr("actionvalue"), |
|
277 |
content: token.attr("content") |
|
278 |
})).show(); |
|
| 62 | 279 |
lastShownToken = token; |
| 63 | 280 |
} |
| 62 | 281 |
} |
282 |
|
|
283 |
function onTokenMouseout(token) { |
|
| 63 | 284 |
lastShownToken = null; |
| 62 | 285 |
setTimeout(function() { |
| 63 | 286 |
if (!lastShownToken) { |
287 |
$("body").css("cursor", ""); |
|
288 |
commentDiv.hide(); |
|
| 62 | 289 |
} |
| 63 | 290 |
}, 200); |
| 62 | 291 |
} |
292 |
|
|
| 65 | 293 |
//console.log(barChartSettings); |
| 56 | 294 |
|
| 67 | 295 |
barChart = $("#data-viz").vs(barChartSettings).data('visualSedimentation'); |
| 59 | 296 |
|
| 63 | 297 |
barChart.world.SetGravity(new barChart.phy.b2Vec2(0,10 * config.fallSpeed)); |
| 64 | 298 |
|
| 59 | 299 |
$(".timer-bar-value").width(0); |
300 |
|
|
| 62 | 301 |
play(); |
302 |
|
|
| 54 | 303 |
clearInterval(clockInterval); |
| 62 | 304 |
|
305 |
var lastTimestamp = 0; |
|
306 |
|
|
| 54 | 307 |
clockInterval = setInterval(function() { |
| 63 | 308 |
|
309 |
if (paused) { |
|
310 |
return; |
|
311 |
} |
|
312 |
|
|
| 62 | 313 |
var vizT = currentVizTime(); |
| 63 | 314 |
|
| 64 | 315 |
var tokensToAdd = opinions.filter(function(o) { |
316 |
return o._viztime > lastTimestamp && o._viztime <= vizT |
|
| 62 | 317 |
}); |
| 63 | 318 |
|
| 64 | 319 |
lastTimestamp = vizT; |
| 62 | 320 |
|
321 |
tokensToAdd.forEach(function(opinion) { |
|
322 |
barChart.addToken({ |
|
323 |
category: opinion._column, |
|
324 |
datetime: opinion.datetime, |
|
325 |
timestamp: opinion._timestamp, |
|
| 64 | 326 |
viztime: opinion._viztime, |
| 62 | 327 |
movie: opinion._movie, |
328 |
colorId: opinion._colorId, |
|
| 67 | 329 |
//fillStyle: config.colors[opinion._colorId], |
| 64 | 330 |
avatar: opinion._avatar, |
| 62 | 331 |
username: opinion.actor.user.userName, |
332 |
actiontype: opinion.action.type, |
|
333 |
actionvalue: opinion.action.value, |
|
| 64 | 334 |
content: opinion._content.replace(/(^.{320,340})[\s].+$/,'$1…'), |
335 |
//size: 30, |
|
| 63 | 336 |
strokeStyle: config.borderColors[opinion._colorId], |
| 67 | 337 |
texture: { |
338 |
src: config.imageUrlBase + 'pattern-' + opinion._colorId + '.png' |
|
339 |
}, |
|
| 62 | 340 |
shape:{ |
341 |
type:'box', |
|
342 |
width: config.columnWidth / 2 - 1, |
|
343 |
height: config.tokenHeight / 2 |
|
344 |
}, |
|
345 |
callback: { |
|
346 |
mouseover: onTokenMouseover, |
|
347 |
mouseout: onTokenMouseout |
|
348 |
} |
|
349 |
}) |
|
350 |
}); |
|
351 |
|
|
352 |
var deleteT = vizT - config.disappearAfter; |
|
353 |
|
|
354 |
barChart.selectAll("state",1) |
|
355 |
.filter(function(t) { |
|
356 |
return t.attr("viztime") <= deleteT; |
|
357 |
}).forEach(function(t) { |
|
358 |
t.flocculate(); |
|
359 |
}); |
|
360 |
|
|
361 |
if (deleteT > config.vizDuration) { |
|
362 |
pause(); |
|
363 |
} |
|
364 |
|
|
365 |
barChart.strata.update(barChart); |
|
366 |
||
367 |
var w = $('.timer-bar').width() * Math.min(1, vizT / config.vizDuration); |
|
| 59 | 368 |
$(".timer-bar-value").width(w); |
| 63 | 369 |
|
| 62 | 370 |
}, config.refreshRate); |
| 54 | 371 |
} |
372 |
|
|
373 |
function loadMovie(movie) { |
|
374 |
$.getJSON( |
|
375 |
"http://api.allocine.fr/rest/v3/opinionlist", |
|
376 |
{ |
|
377 |
partner: config.partnerCode, |
|
378 |
format: "json", |
|
379 |
subject: "movie:" + movie.id, |
|
380 |
count: config.opinionsPerPage, |
|
381 |
refresh: refreshtoken(), |
|
382 |
page: movie.opinionPage |
|
383 |
}, |
|
384 |
function(d) { |
|
385 |
if (d.feed && d.feed.activity) { |
|
386 |
var tokens = d.feed.activity.filter(function(a) { |
|
387 |
return a.action.type !== "notinterested" && a.action.value !== "-3.0"; |
|
388 |
}); |
|
389 |
} else { |
|
390 |
var tokens = []; |
|
391 |
} |
|
392 |
tokens.forEach(function(a) { |
|
393 |
a._colorId = config.colorIds[a.action.value]; |
|
| 56 | 394 |
a._timestamp = Date.parse(a.datetime + tzSuffix) - tzDelta; |
| 64 | 395 |
a._viztime = originalTimeToVizTime(a._timestamp); |
| 54 | 396 |
a._movie = movie.id; |
397 |
a._column = movie.column; |
|
| 69 | 398 |
a._avatar = ((typeof a.actor.user.avatar === "undefined") ? "http://fr.web.img6.acsta.net/r_50_x/commons/emptymedia/AvatarAllocineMr.gif" : resizeAcPicture( a.actor.user.avatar, 50, "x" )); |
| 64 | 399 |
a._content = ( a.action.type === "userreview" ? a.content.$ : (a.action.type === "wanttosee" ? "veut voir ce film." : "" ) ).replace(/[\n\r\s]+/mg,' '); |
| 54 | 400 |
}); |
401 |
var tokcount = tokens.length; |
|
402 |
tokens = tokens.filter(function(a) { |
|
403 |
return a._timestamp >= originalStart; |
|
404 |
}); |
|
405 |
movie.opinions = movie.opinions.concat(tokens); |
|
406 |
opinions = opinions.concat(tokens); |
|
| 67 | 407 |
$("#data-viz h3").append("."); |
| 54 | 408 |
if (tokens.length === tokcount) { |
409 |
console.log("Page " + movie.opinionPage + " of '" + movie.title + "' loaded"); |
|
410 |
movie.opinionPage ++; |
|
411 |
loadMovie(movie); |
|
412 |
} else { |
|
413 |
console.log("Page " + movie.opinionPage + " of '" + movie.title + "' -- total : " + movie.opinions.length + " opinions loaded"); |
|
414 |
moviesToLoad--; |
|
415 |
if (!moviesToLoad) { |
|
| 56 | 416 |
console.log("**** Everything is loaded, in " + (Date.now() - loadTime) / 1000 + " seconds"); |
| 54 | 417 |
startViz(); |
418 |
} |
|
419 |
} |
|
420 |
} |
|
421 |
); |
|
422 |
} |
|
| 59 | 423 |
|
424 |
var acimgserv = 0, acimgservcount = 6; |
|
425 |
|
|
426 |
function resizeAcPicture(pic, w, h) { |
|
427 |
var path = pic.path || pic.href || pic || ""; |
|
| 60 | 428 |
if (/^https?:\/\/[\w\d\.]+\.acsta\.net\//.test(path)) { |
| 59 | 429 |
path = path.replace(/^https?:\/\/[^\/]+/,''); |
430 |
} |
|
| 60 | 431 |
if (path[0] === "/") { |
432 |
return "http://fr.web.img" |
|
433 |
+ ( 1 + (acimgserv++ % acimgservcount)) |
|
434 |
+ ".acsta.net/r_" |
|
435 |
+ w |
|
436 |
+ "_" |
|
437 |
+ h |
|
438 |
+ path; |
|
439 |
} |
|
440 |
return path; |
|
| 59 | 441 |
} |
442 |
|
|
| 54 | 443 |
$.getJSON( |
444 |
"http://api.allocine.fr/rest/v3/movielist", |
|
445 |
{ |
|
446 |
partner: config.partnerCode, |
|
447 |
format: "json", |
|
448 |
filter: "top:week", |
|
449 |
count: config.movieCount, |
|
450 |
refresh: refreshtoken() |
|
451 |
}, |
|
452 |
function(d) { |
|
| 67 | 453 |
$("#data-viz h3").html("Chargement des flux d'opinions<br />"); |
| 54 | 454 |
console.log("Movie List Loaded"); |
| 56 | 455 |
tzDelta = .5 * HOURS * Math.round((Date.parse(d.feed.updated) - loadTime) / (.5 * HOURS)); |
456 |
tzSuffix = d.feed.updated.replace(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,''); |
|
457 |
||
| 60 | 458 |
movies = []; |
459 |
for (var i = 0; i < d.feed.movie.length; i++) { |
|
460 |
var movie = d.feed.movie[i]; |
|
461 |
if (i % 2) { |
|
462 |
movies.push(movie); |
|
463 |
} else { |
|
464 |
movies.splice(0,0,movie); |
|
465 |
} |
|
466 |
} |
|
467 |
movies = movies.map(function(movie, i) { |
|
| 54 | 468 |
return { |
469 |
id: movie.code, |
|
470 |
column: i, |
|
471 |
title: movie.title, |
|
472 |
poster: movie.poster.href, |
|
473 |
opinions: [], |
|
474 |
opinionPage: 1 |
|
| 59 | 475 |
}; |
| 54 | 476 |
}); |
477 |
moviesToLoad = movies.length; |
|
478 |
movies.forEach(loadMovie); |
|
| 64 | 479 |
$('.posters').html(movies.map(function(movie, i) { |
| 63 | 480 |
return '<li class="poster" style=" margin: 0 ' |
| 56 | 481 |
+ Math.floor(config.columnSpacing / 2) |
| 64 | 482 |
+ 'px" data-movie-index="' |
483 |
+ i |
|
484 |
+ '"><img width="150" height="200" src="' |
|
| 59 | 485 |
+ resizeAcPicture(movie.poster,150,200) |
| 54 | 486 |
+ '" alt="' |
487 |
+ movie.title |
|
| 63 | 488 |
+ '" /><div class="poster-overlay"><div class="poster-datainfo">' |
489 |
+ '<ul class="poster-distribution"><li class="poster-2">0</li><li class="poster-1">0</li><li class="poster-0">0</li>' |
|
490 |
+ '</ul></div></div></li>'; |
|
| 54 | 491 |
}).join("")); |
| 63 | 492 |
|
493 |
$(".poster") |
|
| 64 | 494 |
.click(function() { |
495 |
$("#comment-modal").modal({ |
|
496 |
containerCss: { |
|
497 |
height: $(window).height()-200, |
|
498 |
width: Math.min($(window).width()-200, 640) |
|
499 |
}, |
|
500 |
overlayClose: true |
|
501 |
}); |
|
502 |
var vizT = currentVizTime(), |
|
503 |
movie = movies[$(this).attr("data-movie-index")], |
|
504 |
opsToShow = movie.opinions.filter(function(o) { |
|
505 |
return o._viztime <= vizT; |
|
506 |
}); |
|
507 |
$(".comment-count").text(opsToShow.length); |
|
508 |
$(".comment-subject").text(movie.title); |
|
509 |
$(".comment-start").text(new Date(originalStart).toTimeString().substr(0,5)); |
|
510 |
$(".comment-end").text(new Date(vizTimeToOriginalTime(vizT)).toTimeString().substr(0,5)); |
|
511 |
$(".comment-list").html(opsToShow.map(function(o) { |
|
512 |
return opinionTemplate({ |
|
513 |
actiontype: o.action.type, |
|
514 |
avatar: o._avatar, |
|
515 |
username: o.actor.user.userName, |
|
516 |
ago: agoify(o._timestamp), |
|
517 |
ratevalue: o.action.value, |
|
518 |
content: o._content |
|
519 |
}); |
|
520 |
}).join("")) |
|
521 |
.mCustomScrollbar({ |
|
522 |
autoDraggerLength:false, |
|
523 |
scrollButtons:{ |
|
524 |
enable:false |
|
525 |
} |
|
526 |
}); |
|
527 |
return false; |
|
528 |
}) |
|
| 63 | 529 |
.each(function(i) { |
530 |
movies[i].poster$ = $(this); |
|
531 |
}); |
|
| 54 | 532 |
} |
533 |
); |
|
534 |
|
|
535 |
function refreshtoken() { |
|
| 56 | 536 |
return Math.floor(0x100000000 * Math.random()).toString(16) + "-" + (Date.now() % 0x100000000).toString(16); |
| 54 | 537 |
} |
538 |
|
|
| 62 | 539 |
$(".restart").click(function() { |
| 54 | 540 |
startViz(); |
541 |
return false; |
|
| 60 | 542 |
}); |
543 |
|
|
544 |
var commentDiv = $("#comment"); |
|
545 |
|
|
546 |
$("#data-viz").mousemove(_.throttle(function(e) { |
|
547 |
commentDiv |
|
548 |
.css({ |
|
549 |
left: e.pageX, |
|
| 62 | 550 |
top: e.pageY + 2 |
| 60 | 551 |
}) |
| 67 | 552 |
.removeClass("left right").addClass(e.pageX < $(window).width() / 2 ? "left" : "right"); |
| 60 | 553 |
}, 50)); |
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
554 |
|
| 54 | 555 |
}); |