| author | veltr |
| Mon, 29 Apr 2013 15:02:35 +0200 | |
| changeset 53 | 88666afffe6b |
| parent 49 | 531a593a0294 |
| child 54 | faf1e584551c |
| permissions | -rw-r--r-- |
| 28 | 1 |
$(function(){ |
2 |
||
| 30 | 3 |
/* |
4 |
$(window).bind('resize', function(){ |
|
5 |
setSidebarContentHeight(); |
|
6 |
}); |
|
7 |
setSidebarContentHeight(); |
|
8 |
function setSidebarContentHeight(){ |
|
9 |
var newHeight = $(window).height() - $('header').height() - $('footer').height(); |
|
10 |
$(".sidebar .content").css('height', newHeight); |
|
11 |
} |
|
12 |
||
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
13 |
*/ |
| 30 | 14 |
|
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
15 |
|
| 30 | 16 |
|
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
17 |
var CONFIG = { |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
18 |
wChart : 150, |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
19 |
hVS : 200, |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
20 |
now : new Date(), |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
21 |
dayLimit : 1, |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
22 |
timelineMin : 5, |
| 53 | 23 |
bar : [], |
24 |
colorIds: { |
|
25 |
"-2.0": 2, |
|
26 |
"0.5": 0, "1.0": 0, "1.5": 0, "2.0": 0, |
|
27 |
"2.5": 1, "3.0": 1, "3.5": 1, |
|
28 |
"4.0": 2, "4.5": 2, "5.0": 2 |
|
29 |
}, |
|
30 |
colors: [ "#c00000", "#ffd000", "#008000"] |
|
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
31 |
}; |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
32 |
|
| 30 | 33 |
function init(){ |
34 |
var wWin = ($(window).width()>520) ? $(window).width() : 520; |
|
35 |
$('.timer-bar').width(wWin - 170); |
|
36 |
||
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
37 |
var stepHour = CONFIG.dayLimit * 24 / 12; |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
38 |
var hourText = 0; |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
39 |
$('.hours li').each(function(k, v){ |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
40 |
$(v).text(hourText+'h'); |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
41 |
hourText = hourText + stepHour; |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
42 |
}); |
| 30 | 43 |
|
44 |
var wTimerBar = $('.timer-bar').width(), |
|
45 |
nbIndicator = $('.hours li').length-1; |
|
46 |
mrIndicator = wTimerBar/ (nbIndicator); |
|
47 |
$('.timeline-head').css('min-width', wWin); |
|
48 |
$('.hours li').each(function(k,v){ |
|
49 |
if(k >= nbIndicator - 1) return; |
|
50 |
var mr = mrIndicator - $('.hours li:last-child').width()/2 - $(v).width()/2; |
|
51 |
$(v).css('margin-right', mr); |
|
52 |
}); |
|
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
53 |
|
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
54 |
|
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
55 |
var spaceTop = 100, spaceBotPoster = 200; |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
56 |
CONFIG.hVS = $(window).height() - $('footer').height() - $('header').height() - spaceTop - spaceBotPoster; |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
57 |
CONFIG.hVS = (CONFIG.hVS>200) ? CONFIG.hVS : 200; |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
58 |
|
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
59 |
showHorloge(); |
| 30 | 60 |
} |
61 |
||
62 |
init(); |
|
63 |
||
| 28 | 64 |
|
65 |
var bcSettings = { |
|
66 |
width : 960, |
|
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
67 |
height : CONFIG.hVS, |
| 28 | 68 |
chart : { |
| 53 | 69 |
spacer : 5, |
70 |
y: 150, |
|
71 |
height: CONFIG.hVS - 150 |
|
| 28 | 72 |
}, |
73 |
data : { |
|
74 |
model :[], |
|
75 |
strata:[], |
|
76 |
stream : { provider : 'direct' } |
|
77 |
}, |
|
78 |
sedimentation:{ |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
79 |
token:{ |
| 53 | 80 |
size:{original:12,minimum:0} |
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
81 |
}, |
| 53 | 82 |
aggregation:{ |
83 |
height: CONFIG.hVS - 150, |
|
84 |
maxData: 50 |
|
85 |
}, |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
86 |
suspension:{ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
87 |
decay:{power:1.001} |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
88 |
} |
| 28 | 89 |
}, |
90 |
options:{layout:false} |
|
91 |
}; |
|
92 |
||
93 |
var currentDay = new Date().getDate(); |
|
94 |
var _reviewMovies = []; |
|
95 |
var nbMovies; |
|
96 |
var indiceMovie = 0; |
|
97 |
var indiceBar = 0; |
|
98 |
var barChart; |
|
| 53 | 99 |
var count = 10; |
100 |
var urlBestMovies = 'http://api.allocine.fr/rest/v3/movielist?partner='+ partnerCode +'&format=json&filter=top:week&count='+count; |
|
| 28 | 101 |
$.getJSON(urlBestMovies, function(data) { |
102 |
|
|
103 |
var movies = data.feed.movie; |
|
104 |
nbMovies = movies.length; |
|
| 30 | 105 |
bcSettings.width = nbMovies * CONFIG.wChart + (10 * nbMovies); |
| 28 | 106 |
$('.posters').css('width', bcSettings.width); |
107 |
//var wItem = bcSettings.width / nbMovies; |
|
108 |
||
| 53 | 109 |
_.each(movies, function(d, i){ |
| 28 | 110 |
|
111 |
var dataMovie = { |
|
112 |
title : d.originalTitle, |
|
113 |
code : d.code, |
|
114 |
posterUrl : d.poster.href, |
|
115 |
userRating : d.statistics.userRating, |
|
116 |
userReviewCount : d.statistics.userReviewCount |
|
117 |
}; |
|
118 |
||
119 |
var poster = |
|
120 |
'<li>'+ |
|
| 53 | 121 |
'<img width="150" height="200" src="'+ dataMovie.posterUrl +'" alt="'+ dataMovie.title +'" />'+ |
| 28 | 122 |
'</li>'; |
123 |
$('.posters').append(poster); |
|
124 |
||
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
125 |
getReviewsByFilm(dataMovie.code); |
| 28 | 126 |
|
127 |
CONFIG.bar.push(dataMovie.code); |
|
128 |
||
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
129 |
bcSettings.data.model.push({label:"Column A"}); |
| 28 | 130 |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
131 |
|
| 28 | 132 |
}); |
133 |
||
| 53 | 134 |
console.log(CONFIG.bar); |
135 |
|
|
136 |
bcSettings.data.strata = function() { |
|
137 |
if (typeof barChart === "undefined") { |
|
138 |
var flocculated = []; |
|
139 |
_(function() { |
|
140 |
_.range(3).map(function(colorId) { |
|
141 |
$(".layer_"+colorId).css("fill", CONFIG.colors[colorId]); |
|
142 |
}); |
|
143 |
}).defer(); |
|
144 |
} else { |
|
145 |
var flocculated = barChart.selectAll("state",2); |
|
146 |
} |
|
147 |
|
|
148 |
var res = CONFIG.bar.map(function(movieCode) { |
|
149 |
var movieTokens = flocculated.filter(function(t) { |
|
150 |
return t.attr("movieCode") === movieCode; |
|
151 |
}); |
|
152 |
return _.range(3).map(function(colorId) { |
|
153 |
var stratumTokens = movieTokens.filter(function(t) { |
|
154 |
return t.attr("colorId") === colorId; |
|
155 |
}).length; |
|
156 |
return { |
|
157 |
value: function() { |
|
158 |
return stratumTokens |
|
159 |
}, |
|
160 |
text: stratumTokens |
|
161 |
} |
|
162 |
}); |
|
163 |
}); |
|
164 |
return res; |
|
165 |
}; |
|
166 |
|
|
| 28 | 167 |
barChart = $("#data-viz").vs(bcSettings).data('visualSedimentation'); |
| 53 | 168 |
|
| 28 | 169 |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
170 |
//barChart.settings.sedimentation.token.size.minimum=0; |
| 28 | 171 |
}); |
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
172 |
|
| 28 | 173 |
var now = new Date(); |
174 |
||
175 |
function reviewAllowSince(dateReview){ |
|
176 |
var diffNowReview = CONFIG.now.getTime() - new Date(dateReview).getTime(); |
|
177 |
var limit = (CONFIG.dayLimit * 24) * 60 * 60 * 1000; |
|
178 |
if(diffNowReview<=limit){ |
|
179 |
var startDate = limit - diffNowReview; |
|
180 |
return startDate; |
|
181 |
}else{ |
|
182 |
return false; |
|
183 |
} |
|
184 |
} |
|
185 |
||
186 |
function generateTimerByMin(time){ |
|
187 |
var timeLimit = (CONFIG.timelineMin*60)*1000; |
|
188 |
return (time * timeLimit) / ((CONFIG.dayLimit*24)*60*60*1000) |
|
189 |
} |
|
190 |
||
191 |
function showHorloge(){ |
|
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
192 |
|
| 28 | 193 |
var timestampDateLimit = CONFIG.now.getTime() - ((CONFIG.dayLimit*24)*60*60*1000); |
194 |
var dateLimit = new Date(timestampDateLimit); |
|
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
195 |
|
| 28 | 196 |
var diff = CONFIG.now.getTime() - timestampDateLimit; |
197 |
||
198 |
var oneHour = (CONFIG.timelineMin * 60 * 1000) / (CONFIG.dayLimit*24); |
|
199 |
var oneMinute = oneHour / 60; |
|
200 |
||
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
201 |
|
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
202 |
var wTimerBar = $('.timer-bar').width(); |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
203 |
var timerBarValue = $('.timer-bar-value'); |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
204 |
timerBarValue.width(0); |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
205 |
var indice = 0; |
| 28 | 206 |
|
207 |
setInterval(function(){ |
|
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
208 |
if(indice>=diff) return; |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
209 |
indice = indice + (60 * 1000); |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
210 |
var wTimerBarValue = wTimerBar * indice / diff; |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
211 |
timerBarValue.width(wTimerBarValue); |
| 28 | 212 |
},oneMinute); |
213 |
||
214 |
} |
|
215 |
||
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
216 |
|
| 28 | 217 |
|
218 |
function getReviewsByFilm(codeFilm){ |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
219 |
/** |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
220 |
Nouvelle api avatar note |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
221 |
rate, avec une note de 0 à 5 |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
222 |
wanttosee (note arbitraire de -2... À convertir en vert) |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
223 |
notinterested (note arbitraire de -1 À convertir en rouge) |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
224 |
|
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
225 |
Et maintenant, il y a l'avatar de l'utilisateur (pour ceux qui en ont) |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
226 |
|
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
227 |
http://ext.api.allocine.fr/rest/v3/opinionlist?partner=B00015838755&subject=movie:187864&count=100 |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
228 |
**/ |
| 28 | 229 |
|
230 |
var _movie = { |
|
231 |
movieCode : codeFilm |
|
232 |
}; |
|
233 |
||
234 |
var reviewCount = 100; |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
235 |
//var urlCommentaireMovie = 'http://ext.api.allocine.fr/rest/v3/opinionlist?partner='+ partnerCode +'&subject=movie:'+codeFilm+'&count='+reviewCount; |
| 28 | 236 |
var urlCommentaireMovie = 'http://api.allocine.fr/rest/v3/reviewlist?partner='+ partnerCode +'&format=json&filter=public&count='+reviewCount+'&subject=movie:'+codeFilm; |
237 |
$.getJSON(urlCommentaireMovie, function(data) { |
|
238 |
||
239 |
var nbFilmSince = 0; |
|
240 |
//console.log(data) |
|
241 |
var totalResults = data.feed.totalResults; |
|
242 |
if(totalResults > 0) { |
|
243 |
var _reviews = new Array(); |
|
244 |
var reviews = data.feed.review; |
|
245 |
_.each(reviews, function(d){ |
|
246 |
if(d.totalResults == 0) return; |
|
247 |
||
248 |
var dataReview = { |
|
249 |
commentaire : d.body, |
|
250 |
date : d.creationDate,//"2013-03-10T |
|
251 |
rating : d.rating, |
|
252 |
author : d.writer.name |
|
253 |
}; |
|
254 |
||
255 |
var startDate = reviewAllowSince(d.creationDate); |
|
256 |
||
257 |
if(startDate){ |
|
258 |
nbFilmSince++ |
|
259 |
dataReview.startDate = startDate; |
|
260 |
_reviews.push(dataReview); |
|
261 |
} |
|
262 |
}); |
|
263 |
||
264 |
var totalReviews = $('li#movie-'+codeFilm+' span.nbReview').text(); |
|
265 |
$('li#movie-'+codeFilm+' span.nbReview').text(totalReviews-nbFilmSince) |
|
266 |
||
267 |
_movie.reviews = _reviews; |
|
268 |
_reviewMovies.push(_movie); |
|
269 |
} |
|
270 |
||
271 |
indiceMovie++; |
|
272 |
//console.log(indiceMovie) |
|
273 |
if(indiceMovie == nbMovies){ |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
274 |
//showHorloge(); |
| 28 | 275 |
displayReviews(); |
276 |
} |
|
277 |
||
278 |
});//getJson |
|
279 |
}//getReviewsByFilm |
|
280 |
||
281 |
function displayReviews(){ |
|
282 |
_.each(_reviewMovies, function(a){ |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
283 |
console.log(a) |
| 28 | 284 |
var movieCode = a.movieCode; |
285 |
var reviews = a.reviews; |
|
286 |
||
287 |
var barCharCat; |
|
288 |
$.each(CONFIG.bar, function(k,v){ |
|
289 |
if(movieCode == v)barCharCat = k; |
|
290 |
}); |
|
291 |
||
292 |
_.each(reviews, function(b){ |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
293 |
|
| 28 | 294 |
b.movieCode = movieCode; |
295 |
var startDate = b.startDate; |
|
296 |
||
297 |
var timer = generateTimerByMin(startDate); |
|
298 |
setTimeout(function(){ |
|
299 |
addToken(barCharCat, b) |
|
300 |
},timer); |
|
301 |
}); |
|
302 |
}); |
|
303 |
}//displayReviews |
|
304 |
||
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
305 |
var tokenId = 0; |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
306 |
|
| 28 | 307 |
function addToken(barCharCat, data){ |
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
308 |
|
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
309 |
|
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
310 |
|
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
311 |
|
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
312 |
|
| 28 | 313 |
var commentaire = data.commentaire; |
314 |
var date = data.date; |
|
315 |
var rating = data.rating; |
|
316 |
var author = data.author; |
|
317 |
var movieCode = data.movieCode; |
|
| 53 | 318 |
var colorid = CONFIG.colorIds[data.rating.toFixed(1)], |
319 |
color = CONFIG.colors[colorid]; |
|
| 28 | 320 |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
321 |
rating = rating.toString().replace(".","_"); |
| 53 | 322 |
/* |
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
323 |
var commentReview = |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
324 |
'<div class="comment clearfix" id="token-'+tokenId+'">'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
325 |
'<span class="comment-arrow"></span>'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
326 |
'<div class="avatar"><img src="img/profil_50_1.jpg" alt="" /></div>'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
327 |
'<div class="comment-right">'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
328 |
'<div class="comment-info clearfix">'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
329 |
'<span class="username">'+author+'</span>'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
330 |
'<span class="date">il y a 23 heures</span>'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
331 |
'<ul class="rating rate-'+rating+'">'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
332 |
'<li></li><li></li><li></li><li></li><li></li>'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
333 |
'</ul>'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
334 |
'</div>'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
335 |
'<p class="review-content">'+commentaire+'</p>'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
336 |
'</div>'+ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
337 |
'</div>'; |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
338 |
$('body').append(commentReview); |
| 53 | 339 |
*/ |
340 |
var token = barChart.addToken({ |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
341 |
mappingElement : 'token-'+tokenId, |
| 28 | 342 |
commentaire : commentaire, |
343 |
movieCode : movieCode, |
|
344 |
date : date, |
|
345 |
rating : rating, |
|
346 |
author : author, |
|
| 53 | 347 |
category: barCharCat, |
348 |
colorId: colorid, |
|
349 |
fillStyle: color, |
|
350 |
strokeStyle: "#555555", |
|
351 |
||
352 |
shape:{ |
|
353 |
type:'box', |
|
354 |
width:74, |
|
355 |
height:5 |
|
356 |
}, |
|
357 |
callback:{ |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
358 |
/* |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
359 |
draw : function(token){ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
360 |
var myDomElement= $('#'+token.attr('mappingElement'))[0]; |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
361 |
$(myDomElement).css({ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
362 |
top : token.attr('y') + 150, |
| 53 | 363 |
left : token.attr('x') |
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
364 |
}) |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
365 |
}, |
| 28 | 366 |
mouseover:function(token){ |
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
367 |
$('#'+token.attr('mappingElement')).show(); |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
368 |
var myDomElement= $('#'+token.attr('mappingElement'))[0]; |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
369 |
var commentaire = token.attr('commentaire'), |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
370 |
author = token.attr('author'), |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
371 |
date = token.attr('date'), |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
372 |
movieCode = token.attr('movieCode'), |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
373 |
rating = token.attr('rating'); |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
374 |
}, |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
375 |
mouseout:function(token){ |
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
376 |
$('#'+token.attr('mappingElement')).hide(); |
| 53 | 377 |
}, |
378 |
*/ |
|
379 |
suspension: function(token) { |
|
380 |
setTimeout(function() { |
|
381 |
token.flocculate(); |
|
382 |
barChart.strata.update(barChart); |
|
383 |
}, 5000); |
|
| 28 | 384 |
} |
385 |
} |
|
386 |
}); |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
387 |
tokenId++; |
| 28 | 388 |
} |
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
389 |
|
|
49
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
390 |
|
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
391 |
|
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
392 |
|
|
531a593a0294
update buzz : integration crew comment arrow and half star (rating)
Anthony Ly <anthonyly.com@gmail.com>
parents:
42
diff
changeset
|
393 |
|
|
41
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
394 |
$('a.rejouer').bind('click', function(e){ |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
395 |
e.preventDefault(); |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
396 |
addTokenTest() |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
397 |
}); |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
398 |
|
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
399 |
function addTokenTest(){ |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
400 |
barChart.addToken({ |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
401 |
category:0, |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
402 |
size:1, |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
403 |
|
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
404 |
callback:{ |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
405 |
|
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
406 |
} |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
407 |
}); |
|
8d64ffdaf5e3
résolution problème scrollbar firefox
Anthony Ly <anthonyly.com@gmail.com>
parents:
30
diff
changeset
|
408 |
} |
| 28 | 409 |
});//load |