| author | cavaliet |
| Mon, 16 Apr 2012 15:44:54 +0200 | |
| changeset 861 | 05f75ca6b5de |
| parent 842 | 4ae2247a59f4 |
| permissions | -rw-r--r-- |
| 528 | 1 |
/** @class This class implement a serializer for the JSON-Cinelab format |
2 |
@params DataLoader a dataloader reference |
|
3 |
@url the url from which to get our cinelab |
|
4 |
*/ |
|
|
108
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
5 |
IriSP.JSONSerializer = function(DataLoader, url) { |
|
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
6 |
IriSP.Serializer.call(this, DataLoader, url); |
|
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
7 |
}; |
|
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
8 |
|
| 128 | 9 |
IriSP.JSONSerializer.prototype = new IriSP.Serializer(); |
|
108
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
10 |
|
| 528 | 11 |
/** serialize data */ |
|
108
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
12 |
IriSP.JSONSerializer.prototype.serialize = function(data) { |
|
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
13 |
return JSON.stringify(data); |
|
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
14 |
}; |
|
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
15 |
|
| 528 | 16 |
/** deserialize data */ |
|
108
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
17 |
IriSP.JSONSerializer.prototype.deserialize = function(data) { |
|
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
18 |
return JSON.parse(data); |
|
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
19 |
}; |
|
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
20 |
|
| 528 | 21 |
/** load JSON-cinelab data and also sort the annotations by start time |
22 |
@param callback function to call when the data is ready. |
|
23 |
*/ |
|
| 842 | 24 |
IriSP.JSONSerializer.prototype.sync = function(callback, force_refresh) { |
|
108
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
25 |
/* we don't have to do much because jQuery handles json for us */ |
| 128 | 26 |
|
| 137 | 27 |
var self = this; |
28 |
||
|
797
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
29 |
var fn = function(data) { |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
30 |
//TODO: seems taht data can be null here |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
31 |
if (data !== null) { |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
32 |
self._data = data; |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
33 |
if (typeof(self._data["annotations"]) === "undefined" || |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
34 |
self._data["annotations"] === null) |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
35 |
self._data["annotations"] = []; |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
36 |
|
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
37 |
// sort the data too |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
38 |
self._data["annotations"].sort(function(a, b) |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
39 |
{ var a_begin = +a.begin; |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
40 |
var b_begin = +b.begin; |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
41 |
return a_begin - b_begin; |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
42 |
}); |
|
8407313c144f
correct url for annotations + null data on serializer
ymh <ymh.work@gmail.com>
parents:
783
diff
changeset
|
43 |
} |
| 137 | 44 |
callback(data); |
|
108
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
45 |
}; |
| 842 | 46 |
this._DataLoader.get(this._url, fn, force_refresh); |
|
108
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
47 |
}; |
|
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
48 |
|
| 528 | 49 |
/** @return the metadata about the media being read FIXME: always return the first media. */ |
|
108
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
50 |
IriSP.JSONSerializer.prototype.currentMedia = function() { |
| 842 | 51 |
return (typeof this._data.medias == "object" && this._data.medias.length) ? this._data.medias[0] : IriSP.__jsonMetadata.medias[0]; |
|
108
62da43e72e30
broke the serializers across multiple files. added a newline to the end of
hamidouk
parents:
diff
changeset
|
52 |
}; |
|
147
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
53 |
|
| 842 | 54 |
IriSP.JSONSerializer.prototype.getDuration = function() { |
55 |
var _m = this.currentMedia(); |
|
56 |
if (_m === null || typeof _m.meta == "undefined") { |
|
57 |
return 0; |
|
58 |
} |
|
59 |
return +(IriSP.get_aliased(_m.meta, ["dc:duration", "duration"]) || 0); |
|
60 |
} |
|
61 |
||
62 |
||
| 528 | 63 |
/** searches for an annotation which matches title, description and keyword |
|
147
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
64 |
"" matches any field. |
| 395 | 65 |
Note: it ignores tweets. |
| 528 | 66 |
@return a list of matching ids. |
|
147
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
67 |
*/ |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
68 |
IriSP.JSONSerializer.prototype.searchAnnotations = function(title, description, keyword) { |
| 352 | 69 |
/* we can have many types of annotations. We want search to only look for regular segments */ |
70 |
/* the next two lines are a bit verbose because for some test data, _serializer.data.view is either |
|
71 |
null or undefined. |
|
72 |
*/ |
|
73 |
var view; |
|
74 |
||
75 |
if (typeof(this._data.views) !== "undefined" && this._data.views !== null) |
|
76 |
view = this._data.views[0]; |
|
77 |
||
78 |
var searchViewType = ""; |
|
79 |
||
80 |
if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { |
|
81 |
searchViewType = view.annotation_types[0]; |
|
82 |
} |
|
83 |
||
| 395 | 84 |
var filterfn = function(annotation) { |
85 |
if( searchViewType != "" && |
|
86 |
typeof(annotation.meta) !== "undefined" && |
|
87 |
typeof(annotation.meta["id-ref"]) !== "undefined" && |
|
88 |
annotation.meta["id-ref"] !== searchViewType) { |
|
89 |
return true; // don't pass |
|
90 |
} else { |
|
91 |
return false; |
|
92 |
} |
|
93 |
}; |
|
94 |
||
95 |
return this.searchAnnotationsFilter(title, description, keyword, filterfn); |
|
96 |
||
97 |
}; |
|
98 |
||
99 |
/* only look for tweets */ |
|
100 |
IriSP.JSONSerializer.prototype.searchTweets = function(title, description, keyword) { |
|
101 |
/* we can have many types of annotations. We want search to only look for regular segments */ |
|
102 |
/* the next two lines are a bit verbose because for some test data, _serializer.data.view is either |
|
103 |
null or undefined. |
|
104 |
*/ |
|
| 666 | 105 |
|
106 |
var searchViewType = this.getTweets(); |
|
107 |
if (typeof(searchViewType) === "undefined") { |
|
108 |
var view; |
|
109 |
|
|
110 |
if (typeof(this._data.views) !== "undefined" && this._data.views !== null) |
|
111 |
view = this._data.views[0]; |
|
| 395 | 112 |
|
| 666 | 113 |
if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { |
114 |
searchViewType = view.annotation_types[0]; |
|
115 |
} |
|
| 395 | 116 |
} |
117 |
var filterfn = function(annotation) { |
|
118 |
if( searchViewType != "" && |
|
119 |
typeof(annotation.meta) !== "undefined" && |
|
120 |
typeof(annotation.meta["id-ref"]) !== "undefined" && |
|
| 666 | 121 |
annotation.meta["id-ref"] === searchViewType) { |
| 395 | 122 |
return false; // pass |
123 |
} else { |
|
124 |
return true; |
|
125 |
} |
|
126 |
}; |
|
127 |
||
128 |
return this.searchAnnotationsFilter(title, description, keyword, filterfn); |
|
129 |
||
130 |
}; |
|
131 |
||
| 528 | 132 |
/** |
133 |
search an annotation according to its title, description and keyword |
|
134 |
@param filter a function to filter the results with. Used to select between annotation types. |
|
| 395 | 135 |
*/ |
136 |
IriSP.JSONSerializer.prototype.searchAnnotationsFilter = function(title, description, keyword, filter) { |
|
137 |
||
|
147
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
138 |
var rTitle; |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
139 |
var rDescription; |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
140 |
var rKeyword; |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
141 |
/* match anything if given the empty string */ |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
142 |
if (title == "") |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
143 |
title = ".*"; |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
144 |
if (description == "") |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
145 |
description = ".*"; |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
146 |
if (keyword == "") |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
147 |
keyword = ".*"; |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
148 |
|
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
149 |
rTitle = new RegExp(title, "i"); |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
150 |
rDescription = new RegExp(description, "i"); |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
151 |
rKeyword = new RegExp(keyword, "i"); |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
152 |
|
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
153 |
var ret_array = []; |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
154 |
|
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
155 |
var i; |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
156 |
for (i in this._data.annotations) { |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
157 |
var annotation = this._data.annotations[i]; |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
158 |
|
| 352 | 159 |
/* filter the annotations whose type is not the one we want */ |
| 395 | 160 |
if (filter(annotation)) { |
| 352 | 161 |
continue; |
162 |
} |
|
| 395 | 163 |
|
|
147
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
164 |
if (rTitle.test(annotation.content.title) && |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
165 |
rDescription.test(annotation.content.description)) { |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
166 |
/* FIXME : implement keyword support */ |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
167 |
ret_array.push(annotation); |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
168 |
} |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
169 |
} |
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
170 |
|
|
955119f901b4
added a function to search annotations to the json serializer.
hamidouk
parents:
137
diff
changeset
|
171 |
return ret_array; |
|
149
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
172 |
}; |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
173 |
|
| 528 | 174 |
/** breaks a string in words and searches each of these words. Returns an array |
|
149
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
175 |
of objects with the id of the annotation and its number of occurences. |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
176 |
|
| 528 | 177 |
@param searchString a string of words. |
|
149
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
178 |
FIXME: optimize ? seems to be n^2 in the worst case. |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
179 |
*/ |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
180 |
IriSP.JSONSerializer.prototype.searchOccurences = function(searchString) { |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
181 |
var ret = { }; |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
182 |
var keywords = searchString.split(/\s+/); |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
183 |
|
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
184 |
for (var i in keywords) { |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
185 |
var keyword = keywords[i]; |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
186 |
|
| 150 | 187 |
// search this keyword in descriptions and title |
|
149
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
188 |
var found_annotations = [] |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
189 |
found_annotations = found_annotations.concat(this.searchAnnotations(keyword, "", "")); |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
190 |
found_annotations = found_annotations.concat(this.searchAnnotations("", keyword, "")); |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
191 |
|
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
192 |
for (var j in found_annotations) { |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
193 |
var current_annotation = found_annotations[j]; |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
194 |
|
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
195 |
if (!ret.hasOwnProperty(current_annotation.id)) { |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
196 |
ret[current_annotation.id] = 1; |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
197 |
} else { |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
198 |
ret[current_annotation.id] += 1; |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
199 |
} |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
200 |
|
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
201 |
} |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
202 |
|
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
203 |
}; |
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
204 |
|
|
a10198c95808
added a function to break a search string in words and count the number of
hamidouk
parents:
147
diff
changeset
|
205 |
return ret; |
|
317
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
206 |
}; |
|
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
207 |
|
| 528 | 208 |
/** breaks a string in words and searches each of these words. Returns an array |
| 395 | 209 |
of objects with the id of the annotation and its number of occurences. |
210 |
|
|
211 |
FIXME: optimize ? seems to be n^2 in the worst case. |
|
212 |
*/ |
|
213 |
IriSP.JSONSerializer.prototype.searchTweetsOccurences = function(searchString) { |
|
214 |
var ret = { }; |
|
215 |
var keywords = searchString.split(/\s+/); |
|
216 |
|
|
217 |
for (var i in keywords) { |
|
218 |
var keyword = keywords[i]; |
|
219 |
|
|
220 |
// search this keyword in descriptions and title |
|
221 |
var found_annotations = [] |
|
222 |
found_annotations = found_annotations.concat(this.searchTweets(keyword, "", "")); |
|
223 |
found_annotations = found_annotations.concat(this.searchTweets("", keyword, "")); |
|
224 |
|
|
225 |
for (var j in found_annotations) { |
|
226 |
var current_annotation = found_annotations[j]; |
|
227 |
|
|
228 |
if (!ret.hasOwnProperty(current_annotation.id)) { |
|
229 |
ret[current_annotation.id] = 1; |
|
230 |
} else { |
|
231 |
ret[current_annotation.id] += 1; |
|
232 |
} |
|
233 |
|
|
234 |
} |
|
235 |
||
236 |
}; |
|
237 |
|
|
238 |
return ret; |
|
239 |
}; |
|
240 |
||
| 528 | 241 |
/** returns all the annotations that are displayable at the moment |
|
317
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
242 |
NB: only takes account the first type of annotations - ignores tweets |
|
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
243 |
currentTime is in seconds. |
| 528 | 244 |
|
245 |
@param currentTime the time at which we search. |
|
|
595
29d86e6c61a6
finished going through the widgets to add stricter line checking.
hamidouk
parents:
591
diff
changeset
|
246 |
@param (optional) the if of the type of the annotations we want to get. |
|
317
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
247 |
*/ |
|
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
248 |
|
|
595
29d86e6c61a6
finished going through the widgets to add stricter line checking.
hamidouk
parents:
591
diff
changeset
|
249 |
IriSP.JSONSerializer.prototype.currentAnnotations = function(currentTime, id) { |
|
317
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
250 |
var view; |
|
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
251 |
var currentTimeMs = 1000 * currentTime; |
|
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
252 |
|
|
595
29d86e6c61a6
finished going through the widgets to add stricter line checking.
hamidouk
parents:
591
diff
changeset
|
253 |
if (typeof(id) === "undefined") { |
|
29d86e6c61a6
finished going through the widgets to add stricter line checking.
hamidouk
parents:
591
diff
changeset
|
254 |
var legal_ids = this.getNonTweetIds(); |
| 601 | 255 |
} else { |
|
595
29d86e6c61a6
finished going through the widgets to add stricter line checking.
hamidouk
parents:
591
diff
changeset
|
256 |
legal_ids = [id]; |
|
29d86e6c61a6
finished going through the widgets to add stricter line checking.
hamidouk
parents:
591
diff
changeset
|
257 |
} |
|
536
b7e545e35287
fixed an elusive "id-ref" bug in currentAnnotation
hamidouk
parents:
528
diff
changeset
|
258 |
|
|
317
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
259 |
var ret_array = []; |
|
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
260 |
|
|
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
261 |
var i; |
|
536
b7e545e35287
fixed an elusive "id-ref" bug in currentAnnotation
hamidouk
parents:
528
diff
changeset
|
262 |
|
|
317
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
263 |
for (i in this._data.annotations) { |
|
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
264 |
var annotation = this._data.annotations[i]; |
| 320 | 265 |
|
|
590
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
266 |
if (IriSP.underscore.include(legal_ids, annotation.meta["id-ref"]) && |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
267 |
annotation.begin <= currentTimeMs && |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
268 |
annotation.end >= currentTimeMs) |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
269 |
ret_array.push(annotation); |
|
317
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
270 |
} |
|
590
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
271 |
|
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
272 |
if (ret_array == []) { |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
273 |
console.log("ret_array empty, ", legal_ids); |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
274 |
} |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
275 |
|
|
317
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
276 |
return ret_array; |
|
a3492448fa9a
begun the implementation of annotation search according to a timecode.
hamidouk
parents:
150
diff
changeset
|
277 |
}; |
|
513
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
278 |
|
| 613 | 279 |
/** return the current chapitre |
280 |
@param currentTime the current time, in seconds. |
|
281 |
*/ |
|
282 |
IriSP.JSONSerializer.prototype.currentChapitre = function(currentTime) { |
|
283 |
return this.currentAnnotations(currentTime, this.getChapitrage())[0]; |
|
284 |
}; |
|
|
513
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
285 |
|
| 528 | 286 |
/** returns a list of ids of tweet lines (aka: groups in cinelab) */ |
|
513
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
287 |
IriSP.JSONSerializer.prototype.getTweetIds = function() { |
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
288 |
if (IriSP.null_or_undefined(this._data.lists) || IriSP.null_or_undefined(this._data.lists) || |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
289 |
IriSP.null_or_undefined(this._data.views) || IriSP.null_or_undefined(this._data.views[0])) |
|
513
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
290 |
return []; |
|
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
291 |
|
|
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
292 |
|
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
293 |
/* Get the displayable types |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
294 |
We've got to jump through a few hoops because the json sometimes defines |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
295 |
fields with underscores and sometimes with dashes |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
296 |
*/ |
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
297 |
var annotation_types = IriSP.get_aliased(this._data.views[0], ["annotation_types", "annotation-types"]); |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
298 |
if (annotation_types === null) { |
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
299 |
console.log("neither view.annotation_types nor view.annotation-types are defined"); |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
300 |
return; |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
301 |
} |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
302 |
|
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
303 |
var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
304 |
if (available_types === null) { |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
305 |
console.log("neither view.annotation_types nor view.annotation-types are defined"); |
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
306 |
return; |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
307 |
} |
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
536
diff
changeset
|
308 |
|
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
309 |
var potential_types = []; |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
310 |
|
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
311 |
// Get the list of types which contain "Tw" in their content |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
312 |
for (var i = 0; i < available_types.length; i++) { |
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
313 |
if (/Tw/i.test(IriSP.get_aliased(available_types[i], ['dc:title', 'title']))) { |
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
314 |
potential_types.push(available_types[i].id); |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
315 |
} |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
316 |
} |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
317 |
|
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
318 |
// Get the intersection of both. |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
319 |
var tweetsId = IriSP.underscore.intersection(annotation_types, potential_types); |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
320 |
|
|
513
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
321 |
return tweetsId; |
|
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
322 |
}; |
|
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
323 |
|
| 528 | 324 |
/** this function returns a list of lines which are not tweet lines */ |
|
513
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
325 |
IriSP.JSONSerializer.prototype.getNonTweetIds = function() { |
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
326 |
if (IriSP.null_or_undefined(this._data.lists) || IriSP.null_or_undefined(this._data.lists) || |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
327 |
IriSP.null_or_undefined(this._data.views) || IriSP.null_or_undefined(this._data.views[0])) |
|
513
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
328 |
return []; |
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
329 |
|
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
330 |
/* Get the displayable types |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
331 |
We've got to jump through a few hoops because the json sometimes defines |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
332 |
fields with underscores and sometimes with dashes |
|
536
b7e545e35287
fixed an elusive "id-ref" bug in currentAnnotation
hamidouk
parents:
528
diff
changeset
|
333 |
*/ |
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
334 |
var annotation_types = IriSP.get_aliased(this._data.views[0], ["annotation_types", "annotation-types"]); |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
335 |
if (annotation_types === null) { |
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
336 |
console.log("neither view.annotation_types nor view.annotation-types are defined"); |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
337 |
return; |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
338 |
} |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
339 |
|
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
340 |
var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
341 |
if (available_types === null) { |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
342 |
console.log("neither view.annotation_types nor view.annotation-types are defined"); |
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
343 |
return; |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
344 |
} |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
345 |
|
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
346 |
var potential_types = []; |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
347 |
|
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
348 |
// Get the list of types which do not contain "Tw" in their content |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
349 |
for (var i = 0; i < available_types.length; i++) { |
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
350 |
if (!(/Tw/i.test(IriSP.get_aliased(available_types[i], ['dc:title', 'title'])))) { |
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
351 |
potential_types.push(available_types[i].id); |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
352 |
} |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
353 |
} |
| 639 | 354 |
|
|
636
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
355 |
// Get the intersection of both. |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
356 |
var nonTweetsId = IriSP.underscore.intersection(annotation_types, potential_types); |
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
357 |
|
|
b1629eed3e11
rewrote the function to select annotations to make them clearer.
hamidouk
parents:
633
diff
changeset
|
358 |
return nonTweetsId; |
|
513
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
359 |
|
|
4589b90fe1ad
added a couple functions to distinguish between tweet ids and regular lines.
hamidouk
parents:
395
diff
changeset
|
360 |
}; |
|
590
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
361 |
|
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
362 |
/** return the id of the ligne de temps which contains name |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
363 |
@param name of the ligne de temps |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
364 |
*/ |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
365 |
IriSP.JSONSerializer.prototype.getId = function(name) { |
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
366 |
var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
367 |
|
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
368 |
if (available_types == null) |
|
590
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
369 |
return; |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
370 |
|
| 628 | 371 |
name = name.toUpperCase(); |
372 |
var e; |
|
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
373 |
e = IriSP.underscore.find(available_types, |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
374 |
function(entry) { |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
375 |
if (IriSP.get_aliased(entry, ['dc:title', 'title']) === null) |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
376 |
return false; |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
377 |
return (entry["dc:title"].toUpperCase().indexOf(name) !== -1); |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
378 |
}); |
|
590
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
379 |
|
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
380 |
if (typeof(e) === "undefined") |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
381 |
return; |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
382 |
|
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
383 |
var id = e.id; |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
384 |
|
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
385 |
return id; |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
386 |
}; |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
387 |
|
|
693
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
388 |
/** return the list of id's of the ligne de temps which contains name |
|
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
389 |
@param name of the ligne de temps |
|
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
390 |
*/ |
|
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
391 |
IriSP.JSONSerializer.prototype.getIds = function(name) { |
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
392 |
var available_types = IriSP.get_aliased(this._data, ["annotation_types", "annotation-types"]); |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
393 |
|
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
394 |
if (available_types == null) |
|
693
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
395 |
return; |
|
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
396 |
|
|
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
397 |
name = name.toUpperCase(); |
|
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
398 |
var e = []; |
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
399 |
e = IriSP.underscore.filter(available_types, |
|
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
797
diff
changeset
|
400 |
function(entry) { return (IriSP.get_aliased(entry, ['dc:title', 'title']).toUpperCase().indexOf(name) !== -1) }); |
|
693
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
401 |
return IriSP.underscore.pluck(e, "id"); |
|
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
402 |
}; |
|
6328901da7bf
added a method to get a list of lignes with a specified name.
hamidouk
parents:
666
diff
changeset
|
403 |
|
|
590
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
404 |
/** return the id of the ligne de temps named "Chapitrage" */ |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
405 |
IriSP.JSONSerializer.prototype.getChapitrage = function() { |
| 633 | 406 |
var val = this.getId("Chapitrage"); |
407 |
if (typeof(val) === "undefined") |
|
408 |
val = this.getId("Chapter"); |
|
409 |
if (typeof(val) === "undefined") |
|
410 |
val = this.getId("Chapit"); |
|
411 |
if (typeof(val) === "undefined") |
|
412 |
val = this.getId("Chap"); |
|
413 |
|
|
414 |
return val; |
|
|
590
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
415 |
}; |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
416 |
|
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
417 |
/** return the id of the ligne de temps named "Tweets" */ |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
418 |
IriSP.JSONSerializer.prototype.getTweets = function() { |
| 628 | 419 |
var val = this.getId("Tweets"); |
420 |
if (typeof(val) === "undefined") |
|
421 |
val = this.getId("Tweet"); |
|
422 |
if (typeof(val) === "undefined") |
|
423 |
val = this.getId("Twitter"); |
|
424 |
if (typeof(val) === "undefined") |
|
425 |
val = this.getId("twit"); |
|
426 |
if (typeof(val) === "undefined") |
|
427 |
val = this.getId("Polemic"); |
|
428 |
|
|
429 |
return val; |
|
|
590
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
430 |
}; |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
431 |
|
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
432 |
/** return the id of the ligne de temps named "Contributions" */ |
|
495ea8d73bed
added a couple function to return the ids of some lignes de temps.
hamidouk
parents:
566
diff
changeset
|
433 |
IriSP.JSONSerializer.prototype.getContributions = function() { |
| 633 | 434 |
var val = this.getId("Contribution"); |
435 |
if (typeof(val) === "undefined") |
|
436 |
val = this.getId("Particip"); |
|
437 |
if (typeof(val) === "undefined") |
|
438 |
val = this.getId("Contr"); |
|
439 |
if (typeof(val) === "undefined") |
|
440 |
val = this.getId("Publ"); |
|
441 |
|
|
442 |
return val; |
|
| 861 | 443 |
}; |
444 |
||
445 |
/** return the id of the ligne de temps named "Slideshare" */ |
|
446 |
IriSP.JSONSerializer.prototype.getSlideShareType = function() { |
|
447 |
var val = this.getId("slideshare"); |
|
448 |
if (typeof(val) === "undefined") |
|
449 |
val = this.getId("Slides"); |
|
450 |
if (typeof(val) === "undefined") |
|
451 |
val = this.getId("Slide"); |
|
452 |
if (typeof(val) === "undefined") |
|
453 |
val = this.getId("slide-Share"); |
|
454 |
if (typeof(val) === "undefined") |
|
455 |
val = this.getId("slide Share"); |
|
456 |
|
|
457 |
return val; |
|
| 842 | 458 |
}; |