| author | hamidouk |
| Tue, 03 Jan 2012 12:25:57 +0100 | |
| branch | popcorn-port |
| changeset 567 | ada550479aaf |
| parent 566 | 098929cd2d62 |
| child 595 | 29d86e6c61a6 |
| permissions | -rw-r--r-- |
| 169 | 1 |
/* |
| 207 | 2 |
* |
3 |
* Copyright 2010 Institut de recherche et d'innovation |
|
4 |
* contributor(s) : Samuel Huron |
|
5 |
* |
|
6 |
* contact@iri.centrepompidou.fr |
|
7 |
* http://www.iri.centrepompidou.fr |
|
8 |
* |
|
9 |
* This software is a computer program whose purpose is to show and add annotations on a video . |
|
10 |
* This software is governed by the CeCILL-C license under French law and |
|
11 |
* abiding by the rules of distribution of free software. You can use, |
|
12 |
* modify and/ or redistribute the software under the terms of the CeCILL-C |
|
13 |
* license as circulated by CEA, CNRS and INRIA at the following URL |
|
14 |
* "http://www.cecill.info". |
|
15 |
* |
|
16 |
* The fact that you are presently reading this means that you have had |
|
17 |
* knowledge of the CeCILL-C license and that you accept its terms. |
|
| 169 | 18 |
*/ |
19 |
// CHART TIMELINE / VERSION PROTOTYPE :: |
|
20 |
||
| 528 | 21 |
/** the polemic widget */ |
| 169 | 22 |
IriSP.PolemicWidget = function(Popcorn, config, Serializer) { |
23 |
IriSP.Widget.call(this, Popcorn, config, Serializer); |
|
24 |
|
|
| 207 | 25 |
this.userPol = new Array(); |
26 |
this.userNoPol = new Array(); |
|
27 |
this.userst = new Array(); |
|
28 |
this.numberOfTweet = 0; |
|
29 |
this.Users; |
|
30 |
this.TweetPolemic; |
|
31 |
this.yMax = this.height; |
|
32 |
this.PaperSlider; |
|
33 |
this.heightOfChart; |
|
34 |
this.tweets = new Array(); |
|
| 395 | 35 |
this.svgElements = {}; |
| 169 | 36 |
|
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
37 |
this.oldSearchMatches = []; |
| 207 | 38 |
// Make and define the Raphael area |
39 |
this.paper = Raphael(document.getElementById(this._id), config.width, config.height); |
|
| 395 | 40 |
|
41 |
// event handlers |
|
42 |
this._Popcorn.listen("IriSP.search", IriSP.wrap(this, function(searchString) { this.searchHandler(searchString); })); |
|
43 |
this._Popcorn.listen("IriSP.search.closed", IriSP.wrap(this, this.searchFieldClosedHandler)); |
|
44 |
this._Popcorn.listen("IriSP.search.cleared", IriSP.wrap(this, this.searchFieldClearedHandler)); |
|
45 |
||
| 169 | 46 |
}; |
47 |
||
48 |
IriSP.PolemicWidget.prototype = new IriSP.Widget(); |
|
| 207 | 49 |
|
| 169 | 50 |
IriSP.PolemicWidget.prototype.draw = function() { |
| 207 | 51 |
|
52 |
// variable |
|
53 |
// yMax |
|
| 176 | 54 |
|
55 |
var self = this; |
|
| 207 | 56 |
var yCoef = 2; // coef for height of 1 tweet |
57 |
var frameSize = 5; // frame size |
|
58 |
var margin = 1; // marge between frame |
|
59 |
var lineSize = this.width; // timeline pixel width |
|
60 |
var nbrframes = lineSize/frameSize; // frame numbers |
|
61 |
var numberOfTweet = 0; // number of tweet overide later |
|
62 |
var duration = +this._serializer.currentMedia().meta["dc:duration"]; // timescale width |
|
63 |
var frameLength = lineSize / frameSize; // frame timescale |
|
64 |
var timeline; |
|
65 |
var colors = new Array("","#1D973D","#C5A62D","#CE0A15","#036AAE","#585858"); |
|
66 |
|
|
67 |
// array |
|
68 |
//var tweets = new Array(); |
|
69 |
var element = new Array(); |
|
70 |
var cluster = new Array(); |
|
71 |
var frames = new Array(frameLength); |
|
72 |
var slices = new Array(); |
|
73 |
|
|
74 |
|
|
75 |
// Classes ======================================================================= |
|
76 |
var Frames = function(){ |
|
77 |
|
|
78 |
var Myclusters; |
|
79 |
var x; |
|
80 |
var y; |
|
81 |
var width; |
|
82 |
var height; |
|
83 |
}; |
|
84 |
Frames = function(json){ |
|
85 |
// make my clusters |
|
86 |
// ou Frame vide |
|
87 |
}; |
|
88 |
Frames.prototype.draw = function(){ |
|
89 |
}; |
|
90 |
Frames.prototype.zoom = function(){ |
|
91 |
}; |
|
92 |
Frames.prototype.inside = function(){ |
|
93 |
}; |
|
94 |
var Clusters = function(){ |
|
95 |
var Object; |
|
96 |
var yDist; |
|
97 |
var x; |
|
98 |
var y; |
|
99 |
var width; |
|
100 |
var height; |
|
101 |
}; |
|
102 |
Clusters = function(json){ |
|
103 |
// make my object |
|
104 |
}; |
|
105 |
var Tweet = function(){ |
|
106 |
}; |
|
107 |
// Classes ======================================================================= |
|
| 187 | 108 |
|
| 207 | 109 |
// Refactoring (parametere) ************************************************************ |
110 |
// color translastion |
|
111 |
var qTweet_0 =0; |
|
112 |
var qTweet_Q =0; |
|
113 |
var qTweet_REF=0; |
|
114 |
var qTweet_OK =0; |
|
115 |
var qTweet_KO =0; |
|
116 |
function colorTranslation(value){ |
|
117 |
if(value == "Q"){ |
|
118 |
qTweet_Q+=1; |
|
119 |
return 2; |
|
120 |
}else if(value =="REF"){ |
|
121 |
qTweet_REF+=1; |
|
122 |
return 4; |
|
123 |
}else if(value =="OK"){ |
|
124 |
qTweet_OK+=1; |
|
125 |
return 1; |
|
126 |
}else if(value =="KO"){ |
|
127 |
qTweet_KO+=1; |
|
128 |
return 3; |
|
129 |
}else if(value ==""){ |
|
130 |
qTweet_0+=1; |
|
131 |
return 5; |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
| 169 | 135 |
|
| 176 | 136 |
this._serializer.sync(function(data) { loaded_callback.call(self, data) }); |
137 |
|
|
138 |
function loaded_callback (json) { |
|
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
139 |
|
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
140 |
var view_type = this._serializer.getTweetIds()[0]; |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
141 |
if (typeof(view_type) === "undefined") { |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
142 |
// default to guessing if nothing else works. |
| 207 | 143 |
view = json.views[0]; |
144 |
|
|
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
145 |
// |
| 207 | 146 |
tweet_annot_type = null; |
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
147 |
if(typeof(view.annotation_types) !== "undefined") { |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
148 |
if (view.annotation_types.length >= 1) { |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
149 |
view_type = view.annotation_types[0]; |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
150 |
} else { |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
151 |
console.log("PolemicWidget: invalid file"); |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
152 |
} |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
153 |
} |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
154 |
} |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
155 |
|
| 176 | 156 |
for(var i = 0; i < json.annotations.length; i++) { |
|
265
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
157 |
var item = json.annotations[i]; |
| 207 | 158 |
var MyTime = Math.floor(item.begin/duration*lineSize); |
159 |
var Myframe = Math.floor(MyTime/lineSize*frameLength); |
|
| 169 | 160 |
|
| 207 | 161 |
if (typeof(item.meta) !== "undefined" |
162 |
&& typeof(item.meta["id-ref"]) !== "undefined" |
|
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
163 |
&& item.meta["id-ref"] === view_type) { |
| 207 | 164 |
|
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
165 |
var MyTJson = {}; |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
166 |
if (typeof(item.meta['dc:source']) !== "undefined") { |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
167 |
var MyTJson = JSON.parse(item.meta['dc:source']['content']); |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
168 |
} |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
169 |
|
| 207 | 170 |
if (item.content['polemics'] != undefined |
171 |
&& item.content['polemics'][0] != null) { |
|
172 |
|
|
|
265
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
173 |
// a tweet can have many polemics at the same time. |
| 207 | 174 |
for(var j=0; j<item.content['polemics'].length; j++){ |
175 |
|
|
176 |
this.tweets[numberOfTweet] = { |
|
177 |
id:i, |
|
178 |
qualification:colorTranslation(item.content['polemics'][j]), |
|
179 |
yIndicator:MyTime, |
|
180 |
yframe:Myframe, |
|
181 |
title:item.content['title'], |
|
182 |
timeframe:item.begin, |
|
183 |
userId: MyTJson.id, |
|
184 |
userScreenName: MyTJson.screen_name, |
|
|
265
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
185 |
tsource:MyTJson, |
|
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
186 |
cinecast_id: item.id |
| 207 | 187 |
}; |
188 |
numberOfTweet+=1; |
|
189 |
|
|
190 |
} |
|
191 |
} |
|
192 |
else { |
|
193 |
this.tweets[numberOfTweet] = { |
|
194 |
id:i, |
|
195 |
qualification:colorTranslation(""), |
|
196 |
yIndicator:MyTime, |
|
197 |
yframe:Myframe, |
|
198 |
title:item.content['title'], |
|
199 |
timeframe:item.begin, |
|
200 |
userId: MyTJson.id, |
|
201 |
userScreenName: MyTJson.screen_name, |
|
|
265
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
202 |
tsource:MyTJson, |
|
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
203 |
cinecast_id: item.id |
| 207 | 204 |
}; |
205 |
numberOfTweet+=1; |
|
206 |
} |
|
207 |
|
|
208 |
} |
|
209 |
}; |
|
210 |
|
|
211 |
DrawTweets.call (this); // FIXME: ugly. |
|
212 |
|
|
213 |
}; |
|
| 169 | 214 |
|
| 207 | 215 |
// tweet Drawing (in raphael) |
216 |
function DrawTweets (){ |
|
217 |
// GROUPES TWEET ============================================ |
|
218 |
// Count nbr of cluster and tweet in a frame an save int in "frames" |
|
219 |
numberOfTweet = this.tweets.length; |
|
220 |
for(var i=0; i<nbrframes; i++) { |
|
221 |
for(var j=0; j<numberOfTweet; j++) { |
|
222 |
|
|
223 |
if (i==this.tweets[j].yframe){ |
|
224 |
|
|
225 |
var k = this.tweets[j].qualification; |
|
226 |
|
|
227 |
// make array for frame cluster |
|
228 |
if(frames[i]==undefined){ |
|
229 |
frames[i] = {id:i, |
|
230 |
qualifVol:new Array(), |
|
231 |
mytweetsID:new Array() |
|
232 |
}; |
|
233 |
} |
|
234 |
// add my tweet to frame |
|
235 |
frames[i].mytweetsID.push(this.tweets[j]); |
|
236 |
|
|
237 |
// count opinion by frame |
|
238 |
if( frames[i].qualifVol[k] == undefined){ |
|
239 |
frames[i].qualifVol[k] = 1; |
|
240 |
}else{ |
|
241 |
frames[i].qualifVol[k] += 1; |
|
242 |
} |
|
243 |
|
|
244 |
} |
|
245 |
} |
|
246 |
} |
|
247 |
|
|
248 |
// GROUPES TWEET ============================================ |
|
249 |
// max of tweet by Frame |
|
250 |
var max = 0; |
|
251 |
for(var i = 0; i < nbrframes; i++) { |
|
252 |
var moy = 0; |
|
253 |
for (var j = 0; j < 6; j++) { |
|
254 |
if (frames[i] != undefined) { |
|
255 |
if (frames[i].qualifVol[j] != undefined) { |
|
256 |
moy += frames[i].qualifVol[j]; |
|
257 |
} |
|
258 |
} |
|
259 |
} |
|
260 |
|
|
261 |
if (moy > max) { |
|
| 176 | 262 |
max = moy; |
263 |
} |
|
| 207 | 264 |
} |
265 |
|
|
266 |
var tweetDrawed = new Array(); |
|
267 |
var TweetHeight = 5; |
|
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
268 |
var newHeight = TweetHeight * max + 10; |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
269 |
|
| 207 | 270 |
|
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
271 |
if (newHeight > this.height) { |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
272 |
this.paper.setSize(this.width, newHeight); |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
273 |
this.height = newHeight; |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
274 |
console.log("resizeing"); |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
275 |
} |
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
276 |
|
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
277 |
|
| 207 | 278 |
// DRAW TWEETS ============================================ |
279 |
for(var i = 0; i < nbrframes; i++) { |
|
280 |
var addEheight = 5; |
|
281 |
if (frames[i] != undefined){ |
|
282 |
// by type |
|
283 |
|
|
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
284 |
for (var j = 6; j > -1; j--) { |
| 207 | 285 |
if (frames[i].qualifVol[j] != undefined) { |
286 |
// show tweet by type |
|
287 |
for (var k = 0; k < frames[i].mytweetsID.length; k++) { |
|
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
288 |
|
| 207 | 289 |
if (frames[i].mytweetsID[k].qualification == j) { |
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
290 |
var x = i * frameSize; |
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
291 |
var y = this.height - addEheight; |
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
292 |
|
| 207 | 293 |
if (this.yMax > y) { |
| 176 | 294 |
this.yMax = y; |
295 |
} |
|
296 |
|
|
| 567 | 297 |
/* some tweets seem to be duplicated - so we make a check before |
298 |
creating a new rect */ |
|
299 |
if (this.svgElements.hasOwnProperty(frames[i].mytweetsID[k].cinecast_id)) |
|
300 |
continue; |
|
301 |
|
|
|
265
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
302 |
var e = this.paper.rect(x, y, frameSize - margin, TweetHeight /* height */) |
|
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
303 |
.attr({stroke:"#00","stroke-width":0.1, fill: colors[j]}); |
|
196
9fb4dcb0b878
"fixed" a test and added a new array to contain references to the raphael nodes we create.
hamidouk
parents:
195
diff
changeset
|
304 |
|
| 207 | 305 |
addEheight += TweetHeight; |
306 |
|
|
| 395 | 307 |
e.color = colors[j]; |
|
265
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
308 |
e.time = frames[i].mytweetsID[k].timeframe; |
|
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
309 |
e.title = frames[i].mytweetsID[k].title; |
|
e0d32948bf62
added a message sent when the user clicks on a tweet.
hamidouk
parents:
246
diff
changeset
|
310 |
e.id = frames[i].mytweetsID[k].cinecast_id; |
| 567 | 311 |
|
| 395 | 312 |
this.svgElements[e.id] = e; |
| 477 | 313 |
|
| 478 | 314 |
IriSP.jQuery(e.node).mouseenter(function(element) { return function (event) { |
| 477 | 315 |
// event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery. |
|
485
67cf75eefeb6
use jquery page coordinates instead of raphael ones.
hamidouk
parents:
478
diff
changeset
|
316 |
self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), event.pageX - 106, event.pageY - 160); |
| 477 | 317 |
element.displayed = true; |
|
490
2a7fca4f0cc4
fixed stupid bug which disabled seeking when clicking on a tweet.
hamidouk
parents:
485
diff
changeset
|
318 |
}}(e)).mousedown(function(element) { return function () { |
|
2a7fca4f0cc4
fixed stupid bug which disabled seeking when clicking on a tweet.
hamidouk
parents:
485
diff
changeset
|
319 |
self._Popcorn.currentTime(element.time/1000); |
|
2a7fca4f0cc4
fixed stupid bug which disabled seeking when clicking on a tweet.
hamidouk
parents:
485
diff
changeset
|
320 |
self._Popcorn.trigger("IriSP.PolemicTweet.click", element.id); |
|
2a7fca4f0cc4
fixed stupid bug which disabled seeking when clicking on a tweet.
hamidouk
parents:
485
diff
changeset
|
321 |
} |
|
2a7fca4f0cc4
fixed stupid bug which disabled seeking when clicking on a tweet.
hamidouk
parents:
485
diff
changeset
|
322 |
}(e)); |
| 207 | 323 |
|
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
324 |
IriSP.jQuery(e.node).attr('id', 't' + k + ''); |
| 207 | 325 |
IriSP.jQuery(e.node).attr('title', frames[i].mytweetsID[k].title); |
326 |
IriSP.jQuery(e.node).attr('begin', frames[i].mytweetsID[k].timeframe); |
|
327 |
} |
|
328 |
} |
|
329 |
} |
|
330 |
} |
|
331 |
} |
|
| 169 | 332 |
|
| 207 | 333 |
} |
334 |
// DRAW UI :: resize border and bgd |
|
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
335 |
this.paperBackground = this.paper.rect(0, 0, this.width, this.height).attr({fill:"#F8F8F8","stroke-width":0.1,opacity: 1}); |
|
357
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
336 |
|
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
337 |
// outer borders |
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
338 |
this.outerBorders = []; |
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
339 |
this.outerBorders.push(this.paper.rect(0, this.height - 1, this.width, 1).attr({fill:"#ababab",stroke: "none",opacity: 1})); |
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
340 |
this.outerBorders.push(this.paper.rect(0, 0, this.width, 1).attr({fill:"#ababab",stroke: "none",opacity: 1})); |
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
341 |
|
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
342 |
// inner borders |
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
343 |
this.innerBorders = []; |
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
344 |
this.innerBorders.push(this.paper.rect(1, this.height - 2, this.width, 1).attr({fill:"#efefef",stroke: "none",opacity: 1})); |
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
345 |
this.innerBorders.push(this.paper.rect(1, 1, this.width, 1).attr({fill:"#efefef",stroke: "none",opacity: 1})); |
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
346 |
this.innerBorders.push(this.paper.rect(1, 1, 1, this.height - 2).attr({fill:"#d0d1d1",stroke: "none",opacity: 0.8})); |
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
347 |
this.innerBorders.push(this.paper.rect(this.width - 2, 1, 1, this.height - 2).attr({fill:"#efefef",stroke: "none",opacity: 1})); |
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
348 |
|
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
349 |
|
|
6edf399cfa26
the polemicWidget now draws correctly borders around itself.
hamidouk
parents:
265
diff
changeset
|
350 |
|
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
351 |
this.paperSlider = this.paper.rect(0, 0, 0, this.height).attr({fill:"#D4D5D5", stroke: "none", opacity: 1}); |
|
197
a793a8a0c9d2
added a rectangle tip to show where we are in the video .
hamidouk
parents:
196
diff
changeset
|
352 |
|
|
a793a8a0c9d2
added a rectangle tip to show where we are in the video .
hamidouk
parents:
196
diff
changeset
|
353 |
// the small white line displayed over the slider. |
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
354 |
this.sliderTip = this.paper.rect(0, 0, 1, this.height).attr({fill:"#fc00ff", stroke: "none", opacity: 1}); |
| 207 | 355 |
// decalage |
356 |
// tweetSelection = this.paper.rect(-100,-100,5,5).attr({fill:"#fff",stroke: "none",opacity: 1}); |
|
357 |
|
|
|
196
9fb4dcb0b878
"fixed" a test and added a new array to contain references to the raphael nodes we create.
hamidouk
parents:
195
diff
changeset
|
358 |
|
| 207 | 359 |
this.paperSlider.toBack(); |
360 |
this.paperBackground.toBack(); |
|
|
197
a793a8a0c9d2
added a rectangle tip to show where we are in the video .
hamidouk
parents:
196
diff
changeset
|
361 |
this.sliderTip.toFront(); |
| 207 | 362 |
} |
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
363 |
|
| 478 | 364 |
this.selector.mouseleave(IriSP.wrap(this, function() { self.TooltipWidget.hide.call(self.TooltipWidget); })); |
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
365 |
this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater)); |
|
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
366 |
} |
|
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
367 |
|
| 528 | 368 |
/** update the positionMarker as time passes */ |
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
369 |
IriSP.PolemicWidget.prototype.sliderUpdater = function() { |
| 169 | 370 |
|
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
371 |
var time = +this._Popcorn.currentTime(); |
|
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
372 |
var duration = +this._serializer.currentMedia().meta["dc:duration"]; |
|
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
373 |
|
|
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
374 |
this.paperSlider.attr("width", time * (this.width / (duration / 1000))); |
|
197
a793a8a0c9d2
added a rectangle tip to show where we are in the video .
hamidouk
parents:
196
diff
changeset
|
375 |
|
|
a793a8a0c9d2
added a rectangle tip to show where we are in the video .
hamidouk
parents:
196
diff
changeset
|
376 |
this.sliderTip.attr("x", time * (this.width / (duration / 1000))); |
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
377 |
}; |
| 528 | 378 |
|
379 |
/** reacts to IriSP.search events */ |
|
| 395 | 380 |
IriSP.PolemicWidget.prototype.searchHandler = function(searchString) { |
381 |
if (searchString == "") |
|
382 |
return; |
|
383 |
||
384 |
var matches = this._serializer.searchTweetsOccurences(searchString); |
|
385 |
||
386 |
if (IriSP.countProperties(matches) > 0) { |
|
| 398 | 387 |
this._Popcorn.trigger("IriSP.search.matchFound"); |
| 395 | 388 |
} else { |
| 398 | 389 |
this._Popcorn.trigger("IriSP.search.noMatchFound"); |
| 395 | 390 |
} |
391 |
||
|
565
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
392 |
|
|
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
393 |
// decrease the opacity of the other elements. |
|
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
394 |
for (var id in this.svgElements) { |
|
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
395 |
var e = this.svgElements[id]; |
| 567 | 396 |
e.attr({fill: e.color, opacity: 0.4}); |
|
565
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
397 |
} |
|
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
398 |
|
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
399 |
|
|
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
400 |
for (var id in matches) { |
| 395 | 401 |
if (this.svgElements.hasOwnProperty(id)) { |
| 443 | 402 |
var e = this.svgElements[id]; |
|
565
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
403 |
this.svgElements[id].attr({fill: "#fc00ff", opacity: 1}); |
| 395 | 404 |
} |
405 |
} |
|
406 |
||
407 |
this.oldSearchMatches = matches; |
|
408 |
}; |
|
409 |
||
| 528 | 410 |
/** reacts to IriSP.search.cleared messages */ |
| 395 | 411 |
IriSP.PolemicWidget.prototype.searchFieldClearedHandler = function() { |
|
565
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
412 |
for (var id in this.svgElements) { |
|
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
413 |
var e = this.svgElements[id]; |
|
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
414 |
e.attr({fill: e.color, opacity: 1}); |
| 395 | 415 |
} |
416 |
}; |
|
417 |
||
| 528 | 418 |
/** reacts to IriSP.search.closed messages by clearing the highlighted elements */ |
| 395 | 419 |
IriSP.PolemicWidget.prototype.searchFieldClosedHandler = function() { |
|
565
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
420 |
for (var id in this.svgElements) { |
|
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
421 |
var e = this.svgElements[id]; |
|
903435828e6c
WIP - reducing the opacity of the rectanges which are not search results.
hamidouk
parents:
528
diff
changeset
|
422 |
e.attr({fill: e.color, opacity: 1}); |
| 395 | 423 |
} |
424 |
|
|
425 |
}; |
|
426 |
|