integration/js/edition.js
changeset 55 cedadc7d039a
parent 54 2a7064b70693
child 58 9e14b6f964fe
equal deleted inserted replaced
54:2a7064b70693 55:cedadc7d039a
    15         '#16a085', '#27ae60', '#2980b9', '#8e44ad', 
    15         '#16a085', '#27ae60', '#2980b9', '#8e44ad', 
    16         '#f39c12', '#d35400', '#c0392b', '#bdc3c7']
    16         '#f39c12', '#d35400', '#c0392b', '#bdc3c7']
    17 };
    17 };
    18 
    18 
    19 
    19 
       
    20 
       
    21 
    20 myProject.onLoad(function() {
    22 myProject.onLoad(function() {
    21 
    23 
       
    24 
       
    25 
       
    26 
       
    27 //load Annotations
       
    28 myProject.getAnnotationsByTypeTitle("annotations");
       
    29 
       
    30 
    22     $(".project-title").text(myProject.title);
    31     $(".project-title").text(myProject.title);
    23     
    32     
    24     myMedia = myProject.getCurrentMedia();
    33     myMedia = myProject.getCurrentMedia();
    25     
    34 
       
    35 //load Chapitre
       
    36 var _chapters = myProject.getAnnotationsByTypeTitle("chapitrage");
       
    37 if(_chapters.length){
       
    38     $.each(_chapters, function(k, v){
       
    39         var render = false;
       
    40         if((k+1) == _chapters.length){
       
    41             render = true;
       
    42         }
       
    43         newChapter(v, render);
       
    44     });
       
    45 }
       
    46 
       
    47 
       
    48 
       
    49 
    26     //chargement des chapitres et annotations existants
    50     //chargement des chapitres et annotations existants
    27     loadInitChapters();
    51   //  loadInitChapters();
    28     loadInitAnnotation();
    52     loadInitAnnotation();
    29 
    53 
    30     IriSP.htmlPlayer(
    54     IriSP.htmlPlayer(
    31         myMedia,
    55         myMedia,
    32         $(".main-video"),
    56         $(".main-video"),
   264         $('#form-chapter-edit-'+idChapter).remove();
   288         $('#form-chapter-edit-'+idChapter).remove();
   265     }
   289     }
   266 });
   290 });
   267 
   291 
   268 //nouveau chapitre
   292 //nouveau chapitre
   269     function newChapter(dataChapter){
   293     function newChapter(dataChapter, render){
   270         var chapter = new IriSP.Model.Annotation(false, myProject);
   294         var chapter = new IriSP.Model.Annotation(false, myProject);
   271             chapter.setMedia(myMedia.id);
   295             chapter.setMedia(myMedia.id);
   272             chapter.setBegin(dataChapter.begin);
   296             chapter.setBegin(dataChapter.begin);
   273             chapter.setEnd(dataChapter.end);
   297             chapter.setEnd(dataChapter.end);
   274             chapter.title = dataChapter.title;
   298             chapter.title = dataChapter.title;
   275             chapter.description = dataChapter.description;
   299             chapter.description = dataChapter.description;
   276             chapter.keywords = dataChapter.keywords;
   300             chapter.keywords = dataChapter.keywords;
   277             chapter.color = global.colors[(global.colorsIndex<global.colors.length) ? global.colorsIndex++ : (global.colorsIndex=0)];
   301             chapter.color = global.colors[(global.colorsIndex<global.colors.length) ? global.colorsIndex++ : (global.colorsIndex=0)];
   278     
   302     
   279         chapters.push(chapter);
   303         chapters.push(chapter);
   280         renderChapter();
   304         if(render){renderChapter();}
   281         loadFormChapter(chapter.id);
   305         loadFormChapter(chapter.id);
   282     }
   306     }
   283 
   307 
   284     $('.chapter-widget').on('click', '.btn-cut-chapter', function(e){
   308     $('.chapter-widget').on('click', '.btn-cut-chapter', function(e){
   285         e.preventDefault();
   309         e.preventDefault();
   290                 end : organizeNewChapter(myMedia.currentTime),
   314                 end : organizeNewChapter(myMedia.currentTime),
   291                 description : 'description',
   315                 description : 'description',
   292                 keywords : ['tag1','tag2']
   316                 keywords : ['tag1','tag2']
   293             };
   317             };
   294 
   318 
   295         newChapter(dataChapter);
   319         newChapter(dataChapter, true);
   296 
   320 
   297     });
   321     });
   298     
   322     
   299     function organizeNewChapter(beginNew){
   323     function organizeNewChapter(beginNew){
   300 
   324