src/js/widgets/annotationsWidget.js
branchpopcorn-port
changeset 538 b778b2f93ef4
parent 493 f7333cdf5320
child 541 f7667a1dde8e
equal deleted inserted replaced
537:61fd3968ab06 538:b778b2f93ef4
    52 IriSP.AnnotationsWidget.prototype.draw = function() {
    52 IriSP.AnnotationsWidget.prototype.draw = function() {
    53   var _this = this;
    53   var _this = this;
    54 
    54 
    55   var annotationMarkup = IriSP.templToHTML(IriSP.annotationWidget_template);
    55   var annotationMarkup = IriSP.templToHTML(IriSP.annotationWidget_template);
    56 	this.selector.append(annotationMarkup);
    56 	this.selector.append(annotationMarkup);
    57   var view;
    57   
    58 
    58   var legal_ids = this._serializer.getNonTweetIds();
    59   if (typeof(this._serializer._data.views) !== "undefined" && this._serializer._data.views !== null)
    59   
    60      view = this._serializer._data.views[0];
       
    61 
       
    62   var view_type = "";
       
    63 
       
    64   if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) {
       
    65           view_type = view.annotation_types[0];
       
    66   }
       
    67  
       
    68   var annotations = this._serializer._data.annotations;
    60   var annotations = this._serializer._data.annotations;
    69   var i;
    61   var i;
    70   
    62   
    71 	for (i in annotations) {    
    63 	for (i in annotations) {    
    72     var annotation = annotations[i];
    64     var annotation = annotations[i];
    73     var begin = Math.round((+ annotation.begin) / 1000);
    65     var begin = Math.round((+ annotation.begin) / 1000);
    74     var end = Math.round((+ annotation.end) / 1000);
    66     var end = Math.round((+ annotation.end) / 1000);
    75 
    67 
    76     if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
    68     if (typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
    77           && annotation.meta["id-ref"] != view_type) {
    69           && !IriSP.underscore.include(legal_ids, annotation.meta["id-ref"])) {
    78         continue;
    70         continue;
    79     }
    71     }
    80 
    72 
    81 
    73 
    82     var conf = {start: begin, end: end, 
    74     var conf = {start: begin, end: end,