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