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