src/js/widgets/annotationsListWidget.js
branchpopcorn-port
changeset 836 526f91f5253e
parent 835 a8af9da7c622
child 838 03b03865eb9b
equal deleted inserted replaced
835:a8af9da7c622 836:526f91f5253e
   121   /* the platform gives us a special url - of the type : http://path/{media}/{begin}/{end}
   121   /* the platform gives us a special url - of the type : http://path/{media}/{begin}/{end}
   122      we double the braces using regexps and we feed it to mustache to build the correct url
   122      we double the braces using regexps and we feed it to mustache to build the correct url
   123      we have to do that because the platform only knows at run time what view it's displaying.
   123      we have to do that because the platform only knows at run time what view it's displaying.
   124   */
   124   */
   125      
   125      
   126   var platf_url = IriSP.widgetsDefaults["AnnotationsListWidget"].ajax_url
   126   var platf_url = IriSP.widgetsDefaults.AnnotationsListWidget.ajax_url
   127                                       .replace(/\{/g, '{{').replace(/\}/g, '}}');
   127                                       .replace(/\{/g, '{{').replace(/\}/g, '}}');
   128   var media_id = this._serializer.currentMedia()["id"];
   128   var media_id = this._serializer.currentMedia()["id"];
   129   var duration = this._serializer.getDuration();
   129   var duration = this._serializer.getDuration();
   130   
   130   
   131   var begin_timecode = (Math.floor(tcode) - 300) * 1000;
   131   var begin_timecode = (Math.floor(tcode) - 300) * 1000;
   159   
   159   
   160   var media = this._serializer.currentMedia()["id"];
   160   var media = this._serializer.currentMedia()["id"];
   161   
   161   
   162   for (i = 0; i < annotations.length; i++) {
   162   for (i = 0; i < annotations.length; i++) {
   163     var obj = this.transformAnnotation(annotations[i])
   163     var obj = this.transformAnnotation(annotations[i])
   164 
   164       if (typeof obj.url == "undefined" || !obj.url) {
   165       /* only if the annotation isn't present in the document create an
   165           /* only if the annotation isn't present in the document create an
   166          external link */
   166              external link */
   167       if (!this.annotations_ids.indexOf(obj["id"]) != -1) {
   167           if (!this.annotations_ids.indexOf(obj.id) != -1) {
   168         // braindead url; jacques didn't want to create a new one in the platform,
   168             // braindead url; jacques didn't want to create a new one in the platform,
   169         // so we append the cutting id to the url.
   169             // so we append the cutting id to the url.
   170         obj["url"] = this.project_url + "/" + media + "/" + 
   170             obj.url = this.project_url + "/" + media + "/" + 
   171                      annotation.meta["project"] + "/" +
   171                          annotations[i].meta.project + "/" +
   172                      annotation.meta["id-ref"];
   172                          annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
   173         
   173             
   174         // obj["url"] = document.location.href.split("#")[0] + "/" + annotation.meta["project"];
   174             // obj.url = document.location.href.split("#")[0] + "/" + annotation.meta.project;
   175       }
   175           }
   176       
   176           }
   177       l.push(obj);
   177       l.push(obj);
   178   }
   178   }
   179 
   179 
   180   this.do_redraw(l);
   180   this.do_redraw(l);
   181 };
   181 };