src/js/widgets/segmentsWidget.js
branchpopcorn-port
changeset 154 6e115a094858
parent 152 5950ab2855a8
child 157 73bce42a3ed3
equal deleted inserted replaced
153:43f6de365ed4 154:6e115a094858
     5   this.oldSearchMatches = [];
     5   this.oldSearchMatches = [];
     6   
     6   
     7   // event handlers
     7   // event handlers
     8   this._Popcorn.listen("IriSP.search", function(searchString) { self.searchHandler.call(self, searchString); });
     8   this._Popcorn.listen("IriSP.search", function(searchString) { self.searchHandler.call(self, searchString); });
     9   this._Popcorn.listen("IriSP.search.closed", function() { self.searchFieldClosedHandler.call(self); });
     9   this._Popcorn.listen("IriSP.search.closed", function() { self.searchFieldClosedHandler.call(self); });
       
    10   this._Popcorn.listen("IriSP.search.cleared", function() { self.searchFieldClearedHandler.call(self); });
    10 };
    11 };
    11 
    12 
    12 IriSP.SegmentsWidget.prototype = new IriSP.Widget();
    13 IriSP.SegmentsWidget.prototype = new IriSP.Widget();
    13 
    14 
    14 IriSP.SegmentsWidget.prototype.draw = function() {
    15 IriSP.SegmentsWidget.prototype.draw = function() {
    70                 };
    71                 };
    71     this._Popcorn = this._Popcorn.code(conf);
    72     this._Popcorn = this._Popcorn.code(conf);
    72   } 
    73   } 
    73 };
    74 };
    74 
    75 
       
    76 /* restores the view after a search */
       
    77 IriSP.SegmentsWidget.prototype.clear = function() {
       
    78   // reinit the fields
       
    79   for (var id in this.oldSearchMatches) {     
       
    80       
       
    81       IriSP.jQuery("#"+id).dequeue();
       
    82 			IriSP.jQuery("#"+id).animate({height:0},100);	
       
    83 			IriSP.jQuery("#"+id).css('border','0px');
       
    84 			IriSP.jQuery("#"+id).css('border-color','red');
       
    85 			IriSP.jQuery("#"+id).animate({opacity:0.3},100);
       
    86   }   
       
    87 };
       
    88 
    75 IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
    89 IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
    76   var begin = Math.round((+ annotation.begin) / 1000);
    90   var begin = Math.round((+ annotation.begin) / 1000);
    77   this._Popcorn.currentTime(begin)
    91   this._Popcorn.currentTime(begin)
    78 };
    92 };
    79 
    93 
   106     }
   120     }
   107   }
   121   }
   108   this.oldSearchMatches = matches;
   122   this.oldSearchMatches = matches;
   109 };
   123 };
   110 
   124 
       
   125 IriSP.SegmentsWidget.prototype.searchFieldClearedHandler = function() {
       
   126   this.clear();
       
   127 };
       
   128 
   111 IriSP.SegmentsWidget.prototype.searchFieldClosedHandler = function() {
   129 IriSP.SegmentsWidget.prototype.searchFieldClosedHandler = function() {
   112   // reinit the fields
   130   this.clear();
   113   for (var id in this.oldSearchMatches) {     
       
   114       
       
   115       IriSP.jQuery("#"+id).dequeue();
       
   116 			IriSP.jQuery("#"+id).animate({height:0},100);	
       
   117 			IriSP.jQuery("#"+id).css('border','0px');
       
   118 			IriSP.jQuery("#"+id).css('border-color','red');
       
   119 			IriSP.jQuery("#"+id).animate({opacity:0.3},100);
       
   120   }
       
   121   
       
   122   
       
   123 };
   131 };