24 } |
24 } |
25 }); |
25 }); |
26 |
26 |
27 $('.timeline-annotations').on('click', '.annotation', function(e){ |
27 $('.timeline-annotations').on('click', '.annotation', function(e){ |
28 e.preventDefault(); |
28 e.preventDefault(); |
29 |
29 var idAnnotation = $(this).attr('data-id'), |
30 myMedia.setCurrentTime(myMedia.duration * x / $(this).width()); |
30 annotation = _.find(annotations, function(c){ return c.id == idAnnotation; }); |
|
31 myMedia.setCurrentTime(annotation.begin); |
|
32 openTab(annotation.type, annotation); |
31 }); |
33 }); |
32 |
34 |
33 myProject.onLoad(function() { |
35 myProject.onLoad(function() { |
34 |
36 |
35 $(".project-title").text(myProject.title); |
37 $(".project-title").text(myProject.title); |
153 showCurrentAnnotationInTimeline(currentAnnotation.id); |
155 showCurrentAnnotationInTimeline(currentAnnotation.id); |
154 } |
156 } |
155 } |
157 } |
156 |
158 |
157 function showCurrentAnnotationInTimeline(idAnnotation){ |
159 function showCurrentAnnotationInTimeline(idAnnotation){ |
158 $('.timeline-annotations .annotation').empty(); |
160 $('.timeline-annotations .annotation span').hide(); |
159 $('#annotation-timeline-'+idAnnotation).html('<i class="icon-pencil"></i> '+textCurrentAnnotationEditT); |
161 $('#annotation-timeline-'+idAnnotation+' span').show(); |
160 } |
162 } |
161 //display annotation view |
163 //display annotation view |
162 $('.list-current-annotations').on('click', 'a', function(e){ |
164 $('.list-current-annotations').on('click', 'a', function(e){ |
163 e.preventDefault(); |
165 e.preventDefault(); |
164 var annotationDisplayView = $('.annotation-display-view'), |
166 var annotationDisplayView = $('.annotation-display-view'), |
438 $.each(annotations, function(k, v){ |
440 $.each(annotations, function(k, v){ |
439 |
441 |
440 //timeline |
442 //timeline |
441 var width = Math.floor(v.getDuration() * wTimeline / myMedia.duration), |
443 var width = Math.floor(v.getDuration() * wTimeline / myMedia.duration), |
442 left = Math.floor(v.begin * wTimeline / myMedia.duration), |
444 left = Math.floor(v.begin * wTimeline / myMedia.duration), |
443 segment = $('<div>').css({ |
445 dataAnntim = { |
|
446 left : left, |
|
447 width : width, |
|
448 color : v.color, |
|
449 id : v.id |
|
450 }, |
|
451 segment = getTemplate('#tpl-annotation-in-timeline'); |
|
452 segment = Mustache.render(segment, dataAnntim); |
|
453 |
|
454 /* |
|
455 segment = $('<a>').css({ |
444 left : left, |
456 left : left, |
445 width : width, |
457 width : width, |
446 backgroundColor : v.color |
458 backgroundColor : v.color |
447 }).addClass('annotation') |
459 }).addClass('annotation') |
448 .attr('data-id', v.id) |
460 .attr('data-id', v.id) |
449 .attr('id', 'annotation-timeline-'+v.id); |
461 .attr('id', 'annotation-timeline-'+v.id); |
450 |
462 */ |
451 var isInTimeline = false; |
463 var isInTimeline = false; |
452 $.each(timeline.find('li'), function(a, b){ |
464 $.each(timeline.find('li'), function(a, b){ |
453 if(isInTimeline) return; |
465 if(isInTimeline) return; |
454 var row = $(this); |
466 var row = $(this); |
455 if(row.children().length){ |
467 if(row.children().length){ |
594 //particularité selon type |
606 //particularité selon type |
595 switch(type){ |
607 switch(type){ |
596 case 'audio': |
608 case 'audio': |
597 break; |
609 break; |
598 case 'video': |
610 case 'video': |
|
611 var labelModify = $(tabContent).find('.label-modify-video'), |
|
612 labelAdd = $(tabContent).find('.label-add-video'); |
599 if(viewType.content.url != ""){ |
613 if(viewType.content.url != ""){ |
600 var videoWrap = $(tabContent).find('.annotation-video-content'); |
614 var videoWrap = $(tabContent).find('.annotation-video-content'); |
601 renderVideoInfo(videoWrap, viewType.content); |
615 renderVideoInfo(videoWrap, viewType.content); |
|
616 labelModify.show(); |
|
617 }else{ |
|
618 labelAdd.show(); |
602 } |
619 } |
603 break; |
620 break; |
604 case 'text': |
621 case 'text': |
605 var cledit = $(tabContent).find('.wysiwyg').cleditor(wysiwygConfig)[0]; |
622 var cledit = $(tabContent).find('.wysiwyg').cleditor(wysiwygConfig)[0]; |
606 break; |
623 break; |
727 |
744 |
728 $('.popup').modal('hide'); |
745 $('.popup').modal('hide'); |
729 |
746 |
730 var videoWrap = $('#tab-annotation-'+currentAnnotation.id).find('.annotation-video-content'); |
747 var videoWrap = $('#tab-annotation-'+currentAnnotation.id).find('.annotation-video-content'); |
731 renderVideoInfo(videoWrap, currentAnnotation.content); |
748 renderVideoInfo(videoWrap, currentAnnotation.content); |
|
749 |
|
750 var labelModify = $('#tab-annotation-'+currentAnnotation.id).find('.label-modify-video'), |
|
751 labelAdd = $('#tab-annotation-'+currentAnnotation.id).find('.label-add-video'); |
|
752 |
|
753 labelModify.show(); |
|
754 labelAdd.hide(); |
732 |
755 |
733 }); |
756 }); |
734 |
757 |
735 //diaporama |
758 //diaporama |
736 |
759 |