# HG changeset patch # User hamidouk # Date 1326104113 -3600 # Node ID 29d86e6c61a627a9ee6ebac1e1f01e2d3c221109 # Parent 96af41097260c3d788a69ab710737cc5e4e34e0f finished going through the widgets to add stricter line checking. diff -r 96af41097260 -r 29d86e6c61a6 src/js/serializers/JSONSerializer.js --- a/src/js/serializers/JSONSerializer.js Fri Jan 06 17:20:39 2012 +0100 +++ b/src/js/serializers/JSONSerializer.js Mon Jan 09 11:15:13 2012 +0100 @@ -228,18 +228,21 @@ currentTime is in seconds. @param currentTime the time at which we search. + @param (optional) the if of the type of the annotations we want to get. */ -IriSP.JSONSerializer.prototype.currentAnnotations = function(currentTime) { +IriSP.JSONSerializer.prototype.currentAnnotations = function(currentTime, id) { var view; var currentTimeMs = 1000 * currentTime; - var id = this.getChapitrage(); - /* FIXME: ugly */ - if (typeof(id) === "undefined") - var legal_ids = this.getNonTweetIds(); - else - legal_ids = [id]; + if (typeof(id) === "undefined") { + id = this.getChapitrage(); + + if (typeof(id) === "undefined") + var legal_ids = this.getNonTweetIds(); + else + legal_ids = [id]; + } var ret_array = []; diff -r 96af41097260 -r 29d86e6c61a6 src/js/widgets/annotationsListWidget.js --- a/src/js/widgets/annotationsListWidget.js Fri Jan 06 17:20:39 2012 +0100 +++ b/src/js/widgets/annotationsListWidget.js Mon Jan 09 11:15:13 2012 +0100 @@ -14,7 +14,7 @@ IriSP.AnnotationsListWidget.prototype.draw = function() { var _this = this; - var view_type = this._serializer.getNonTweetIds()[0]; + var view_type = this._serializer.getContributions(); var annotations = this._serializer._data.annotations; var list = []; diff -r 96af41097260 -r 29d86e6c61a6 src/js/widgets/annotationsWidget.js --- a/src/js/widgets/annotationsWidget.js Fri Jan 06 17:20:39 2012 +0100 +++ b/src/js/widgets/annotationsWidget.js Mon Jan 09 11:15:13 2012 +0100 @@ -55,7 +55,11 @@ this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", IriSP.wrap(this, this.handleAnnotateSignal)); - var legal_ids = this._serializer.getNonTweetIds(); + var legal_ids = []; + if (typeof(this._serializer.getChapitrage()) !== "undefined") + legal_ids.push(this._serializer.getChapitrage()); + else + legal_ids = this._serializer.getNonTweetIds(); var annotations = this._serializer._data.annotations; var i; diff -r 96af41097260 -r 29d86e6c61a6 src/js/widgets/polemicWidget.js --- a/src/js/widgets/polemicWidget.js Fri Jan 06 17:20:39 2012 +0100 +++ b/src/js/widgets/polemicWidget.js Mon Jan 09 11:15:13 2012 +0100 @@ -136,23 +136,24 @@ this._serializer.sync(function(data) { loaded_callback.call(self, data) }); function loaded_callback (json) { - - var view_type = this._serializer.getTweetIds()[0]; + var view_type = this._serializer.getTweets(); + if (typeof(view_type) === "undefined") { - // default to guessing if nothing else works. - view = json.views[0]; - - // - tweet_annot_type = null; - if(typeof(view.annotation_types) !== "undefined") { - if (view.annotation_types.length >= 1) { - view_type = view.annotation_types[0]; - } else { - console.log("PolemicWidget: invalid file"); - } - } + var view_type = this._serializer.getTweetIds()[0]; + if (typeof(view_type) === "undefined") { + // default to guessing if nothing else works. + view = json.views[0]; + + if(typeof(view.annotation_types) !== "undefined") { + if (view.annotation_types.length >= 1) { + view_type = view.annotation_types[0]; + } else { + console.log("PolemicWidget: invalid file"); + } + } + } } - + for(var i = 0; i < json.annotations.length; i++) { var item = json.annotations[i]; var MyTime = Math.floor(item.begin/duration*lineSize); diff -r 96af41097260 -r 29d86e6c61a6 test/integration/polemic-platform.htm --- a/test/integration/polemic-platform.htm Fri Jan 06 17:20:39 2012 +0100 +++ b/test/integration/polemic-platform.htm Mon Jan 09 11:15:13 2012 +0100 @@ -21,6 +21,7 @@