src/js/widgets/polemicWidget.js
branchpopcorn-port
changeset 595 29d86e6c61a6
parent 567 ada550479aaf
child 624 177dfeacc7a6
equal deleted inserted replaced
594:96af41097260 595:29d86e6c61a6
   134     
   134     
   135 
   135 
   136       this._serializer.sync(function(data) { loaded_callback.call(self, data) });
   136       this._serializer.sync(function(data) { loaded_callback.call(self, data) });
   137       
   137       
   138       function loaded_callback (json) {
   138       function loaded_callback (json) {
   139         
   139       var view_type = this._serializer.getTweets();
   140       var view_type = this._serializer.getTweetIds()[0];        
   140 
   141       if (typeof(view_type) === "undefined") {
   141       if (typeof(view_type) === "undefined") {
   142         // default to guessing if nothing else works.
   142         var view_type = this._serializer.getTweetIds()[0];      
   143         view = json.views[0];
   143         if (typeof(view_type) === "undefined") {
   144         
   144           // default to guessing if nothing else works.
   145         // 
   145           view = json.views[0];
   146         tweet_annot_type = null;
   146           
   147         if(typeof(view.annotation_types) !== "undefined") {
   147           if(typeof(view.annotation_types) !== "undefined") {
   148           if (view.annotation_types.length >= 1) {
   148             if (view.annotation_types.length >= 1) {
   149             view_type = view.annotation_types[0];
   149               view_type = view.annotation_types[0];
   150           } else {
   150             } else {
   151             console.log("PolemicWidget: invalid file");
   151               console.log("PolemicWidget: invalid file");
   152           }
   152             }
   153         }      
   153           }      
       
   154         }
   154       }
   155       }
   155         
   156       
   156       for(var i = 0; i < json.annotations.length; i++) {
   157       for(var i = 0; i < json.annotations.length; i++) {
   157         var item = json.annotations[i];        
   158         var item = json.annotations[i];        
   158         var MyTime  = Math.floor(item.begin/duration*lineSize);
   159         var MyTime  = Math.floor(item.begin/duration*lineSize);
   159         var Myframe = Math.floor(MyTime/lineSize*frameLength);
   160         var Myframe = Math.floor(MyTime/lineSize*frameLength);
   160 
   161