src/js/widgets/annotationsListWidget.js
branchpopcorn-port
changeset 588 78cf49152d4a
parent 585 44a4a4a179c1
child 595 29d86e6c61a6
equal deleted inserted replaced
587:cd051898866e 588:78cf49152d4a
     6 IriSP.AnnotationsListWidget.prototype = new IriSP.Widget();
     6 IriSP.AnnotationsListWidget.prototype = new IriSP.Widget();
     7 
     7 
     8 IriSP.AnnotationsListWidget.prototype.clear = function() {
     8 IriSP.AnnotationsListWidget.prototype.clear = function() {
     9 };
     9 };
    10 
    10 
    11 IriSP.AnnotationsListWidget.prototype.clearWidget = function() {   
    11 IriSP.AnnotationsListWidget.prototype.clearWidget = function() {
    12 };
    12 };
    13 
    13 
    14 IriSP.AnnotationsListWidget.prototype.draw = function() {
    14 IriSP.AnnotationsListWidget.prototype.draw = function() {
    15   var _this = this;
    15   var _this = this;
    16 
    16 
    17   var view_type = this._serializer.getNonTweetIds()[0];
    17   var view_type = this._serializer.getNonTweetIds()[0];
    18   var annotations = this._serializer._data.annotations;
    18   var annotations = this._serializer._data.annotations;
    19   var list = [];
    19   var list = [];
    20   
    20 
    21   if (typeof(view_type) === "undefined") {
    21   if (typeof(view_type) === "undefined") {
    22     console.log("not type suitable for display");
    22     console.log("not type suitable for display");
    23     return;
    23     return;
    24   }
    24   }
    25   
    25 
    26   for (i = 0; i < annotations.length; i++) {
    26   for (i = 0; i < annotations.length; i++) {
    27     var annotation = annotations[i];
    27     var annotation = annotations[i];
    28 
    28 
    29     /* filter the annotations whose type is not the one we want */
    29     /* filter the annotations whose type is not the one we want */
    30     if (typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
    30     if (typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
    32         continue;
    32         continue;
    33     }
    33     }
    34 
    34 
    35     var a = annotation;
    35     var a = annotation;
    36     var obj = {};
    36     var obj = {};
    37     console.log(a);
    37 
    38     obj["id"] = a.id;
    38     obj["id"] = a.id;
    39     obj["title"] = a.content.title;
    39     obj["title"] = a.content.title;
    40     obj["desc"] = a.content.description;
    40     obj["desc"] = a.content.description;
    41     obj["begin"] = IriSP.msToTime(a.begin);
    41     obj["begin"] = IriSP.msToTime(a.begin);
    42     obj["end"] = IriSP.msToTime(a.end);
    42     obj["end"] = IriSP.msToTime(a.end);
    43     
    43 
    44     list.push(obj);
    44     list.push(obj);
    45   }
    45   }
    46 
    46 
    47   var widgetMarkup = IriSP.templToHTML(IriSP.annotationsListWidget_template, {annotations: list});
    47   var widgetMarkup = IriSP.templToHTML(IriSP.annotationsListWidget_template, {annotations: list});
    48   this.selector.append(widgetMarkup);
    48   this.selector.append(widgetMarkup);