integration/js/edition.js
changeset 55 cedadc7d039a
parent 54 2a7064b70693
child 58 9e14b6f964fe
--- a/integration/js/edition.js	Tue May 28 16:42:55 2013 +0200
+++ b/integration/js/edition.js	Tue May 28 17:42:15 2013 +0200
@@ -17,14 +17,38 @@
 };
 
 
+
+
 myProject.onLoad(function() {
 
+
+
+
+//load Annotations
+myProject.getAnnotationsByTypeTitle("annotations");
+
+
     $(".project-title").text(myProject.title);
     
     myMedia = myProject.getCurrentMedia();
-    
+
+//load Chapitre
+var _chapters = myProject.getAnnotationsByTypeTitle("chapitrage");
+if(_chapters.length){
+    $.each(_chapters, function(k, v){
+        var render = false;
+        if((k+1) == _chapters.length){
+            render = true;
+        }
+        newChapter(v, render);
+    });
+}
+
+
+
+
     //chargement des chapitres et annotations existants
-    loadInitChapters();
+  //  loadInitChapters();
     loadInitAnnotation();
 
     IriSP.htmlPlayer(
@@ -266,7 +290,7 @@
 });
 
 //nouveau chapitre
-    function newChapter(dataChapter){
+    function newChapter(dataChapter, render){
         var chapter = new IriSP.Model.Annotation(false, myProject);
             chapter.setMedia(myMedia.id);
             chapter.setBegin(dataChapter.begin);
@@ -277,7 +301,7 @@
             chapter.color = global.colors[(global.colorsIndex<global.colors.length) ? global.colorsIndex++ : (global.colorsIndex=0)];
     
         chapters.push(chapter);
-        renderChapter();
+        if(render){renderChapter();}
         loadFormChapter(chapter.id);
     }
 
@@ -292,7 +316,7 @@
                 keywords : ['tag1','tag2']
             };
 
-        newChapter(dataChapter);
+        newChapter(dataChapter, true);
 
     });