src/js/pop.js
branchpopcorn-port
changeset 475 5c254621cd9c
parent 463 7ef123b2410f
child 477 1e51d638e7ea
equal deleted inserted replaced
474:c1998d5d552e 475:5c254621cd9c
   142   var i = 0;
   142   var i = 0;
   143   for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
   143   for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
   144      var c = IriSP.PopcornReplacement.__codes[i];
   144      var c = IriSP.PopcornReplacement.__codes[i];
   145      
   145      
   146      if (pos >= c.start && pos < c.end && 
   146      if (pos >= c.start && pos < c.end && 
   147          pos - 0.1 <= c.start) {
   147          pos - 0.1 <= c.start) {       
   148         c.onStart();
   148         c.onStart();
   149      }
   149      }
   150  
   150  
   151      if (pos >= c.start && pos >= c.end && 
   151      if (pos > c.start && pos > c.end && 
   152          pos - 0.1 <= c.end) {
   152          pos - 0.1 <= c.end) {
       
   153          console.log("eonedn");
   153         c.onEnd();
   154         c.onEnd();
   154      }
   155      }
   155    
   156    
   156   }
   157   }
   157  
   158  
   158   IriSP.PopcornReplacement.trigger("timeupdate");
   159   IriSP.PopcornReplacement.trigger("timeupdate");
   159 };
   160 };
   160 
   161 
   161 IriSP.PopcornReplacement.__seekHandler = function(event) { 
   162 IriSP.PopcornReplacement.__seekHandler = function(event) {
       
   163   console.log(IriSP.PopcornReplacement.__codes.length);
       
   164   
   162   var i = 0;
   165   var i = 0;
       
   166   
   163   for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
   167   for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
   164      var c = IriSP.PopcornReplacement.__codes[i];
   168      var c = IriSP.PopcornReplacement.__codes[i];
   165     
   169     
   166      if (event.position >= c.start && event.position < c.end) {
   170      if (event.position >= c.start && event.position < c.end) {        
   167         c.onEnd();
   171         c.onEnd();
   168      }
   172      }         
   169     
   173    }
       
   174 
       
   175    for(i = 0; i < IriSP.PopcornReplacement.__codes.length; i++) {
       
   176      var c = IriSP.PopcornReplacement.__codes[i];
       
   177 
   170      if (typeof(event.offset) === "undefined")
   178      if (typeof(event.offset) === "undefined")
   171        event.offset = 0;
   179        event.offset = 0;
   172      if (event.offset >= c.start && event.offset < c.end) {
   180            
       
   181      if (event.offset >= c.start && event.offset < c.end) { 
   173        c.onStart();
   182        c.onStart();
   174      }
   183      }
   175      
   184      
   176    }
   185    }
   177 
   186