src/js/widgets/annotationsListWidget.js
branchpopcorn-port
changeset 674 835f5f454595
parent 642 37693f217f8c
child 698 329333e07267
equal deleted inserted replaced
673:18318dd611c2 674:835f5f454595
     1 IriSP.AnnotationsListWidget = function(Popcorn, config, Serializer) {
     1 IriSP.AnnotationsListWidget = function(Popcorn, config, Serializer) {
     2   IriSP.Widget.call(this, Popcorn, config, Serializer);
     2   IriSP.Widget.call(this, Popcorn, config, Serializer);
     3   this.__counter = 0;
     3   this.__counter = 0;
     4   this.__oldList = [];
     4   this.__oldList = [];
       
     5   
       
     6   this.ajax_mode = IriSP.widgetsDefaults["AnnotationsListWidget"].ajax_mode;
     5 };
     7 };
     6 
     8 
     7 
     9 
     8 IriSP.AnnotationsListWidget.prototype = new IriSP.Widget();
    10 IriSP.AnnotationsListWidget.prototype = new IriSP.Widget();
     9 
    11 
    20 };
    22 };
    21 
    23 
    22 /** draw the annotation list */
    24 /** draw the annotation list */
    23 IriSP.AnnotationsListWidget.prototype.drawList = function(force_redraw) {
    25 IriSP.AnnotationsListWidget.prototype.drawList = function(force_redraw) {
    24   var _this = this;
    26   var _this = this;
    25 
    27   
    26   var view_type = this._serializer.getContributions();
    28   var view_type = this._serializer.getContributions();
    27   var annotations = this._serializer._data.annotations;
    29   var annotations = this._serializer._data.annotations;
    28   var currentTime = this._Popcorn.currentTime();
    30   var currentTime = this._Popcorn.currentTime();
    29     
    31     
    30   var list = [];
    32   var list = [];
    86     this.do_redraw(list);
    88     this.do_redraw(list);
    87   }
    89   }
    88   
    90   
    89 };
    91 };
    90 
    92 
       
    93 IriSP.AnnotationsListWidget.prototype.ajaxRedraw = function(timecode) {
       
    94   var pre_url = IriSP.widgetsDefaults["AnnotationsListWidget"].ajax_url;
       
    95   var templ = "{{pre_url}}/{{content_id}}/{{begin_timecode}}/{{end_timecode}}/";
       
    96 };
       
    97 
    91 IriSP.AnnotationsListWidget.prototype.draw = function() {
    98 IriSP.AnnotationsListWidget.prototype.draw = function() {
    92 
    99 
    93   this.drawList();
   100   this.drawList();
    94   this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, function() { this.drawList(true); }));
   101     
       
   102   if (!this._ajax_mode) {    
       
   103     this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, function() { this.drawList(true); }));
       
   104   } else {
       
   105     this._Popcorn.listen("IriSP.StackGraphWidget.mouseOver", IriSP.wrap(this, this.ajaxRedraw));
       
   106   }
    95   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.redraw));
   107   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.redraw));
    96 };
   108 };
    97 
   109 
    98 IriSP.AnnotationsListWidget.prototype.redraw = function() {
   110 IriSP.AnnotationsListWidget.prototype.redraw = function() {
    99   this.drawList();
   111   this.drawList();