equal
deleted
inserted
replaced
24 IriSP.JSONSerializer.prototype.sync = function(callback) { |
24 IriSP.JSONSerializer.prototype.sync = function(callback) { |
25 /* we don't have to do much because jQuery handles json for us */ |
25 /* we don't have to do much because jQuery handles json for us */ |
26 |
26 |
27 var self = this; |
27 var self = this; |
28 |
28 |
29 var fn = function(data) { |
29 var fn = function(data) { |
30 self._data = data; |
30 //TODO: seems taht data can be null here |
31 if (typeof(self._data["annotations"]) === "undefined" || |
31 if (data !== null) { |
32 self._data["annotations"] === null) |
32 self._data = data; |
33 self._data["annotations"] = []; |
33 if (typeof(self._data["annotations"]) === "undefined" || |
34 |
34 self._data["annotations"] === null) |
35 // sort the data too |
35 self._data["annotations"] = []; |
36 self._data["annotations"].sort(function(a, b) |
36 |
37 { var a_begin = +a.begin; |
37 // sort the data too |
38 var b_begin = +b.begin; |
38 self._data["annotations"].sort(function(a, b) |
39 return a_begin - b_begin; |
39 { var a_begin = +a.begin; |
40 }); |
40 var b_begin = +b.begin; |
41 |
41 return a_begin - b_begin; |
|
42 }); |
|
43 } |
42 callback(data); |
44 callback(data); |
43 }; |
45 }; |
44 |
46 |
45 this._DataLoader.get(this._url, fn); |
47 this._DataLoader.get(this._url, fn); |
46 }; |
48 }; |