8 serializer: IriSP.serializers.medialist |
18 serializer: IriSP.serializers.medialist |
9 }), |
19 }), |
10 mashup = new IriSP.Model.Mashup(false, project), |
20 mashup = new IriSP.Model.Mashup(false, project), |
11 mediatemplate = _.template('<li class="item-video" data-media-id="<%= id %>"><img src="<%= thumbnail %>" alt="<%= title %>" />' |
21 mediatemplate = _.template('<li class="item-video" data-media-id="<%= id %>"><img src="<%= thumbnail %>" alt="<%= title %>" />' |
12 + '<span class="video-info"><span class="title-video"><%= title %></span><span class="author"><%= description %></span>' |
22 + '<span class="video-info"><span class="title-video"><%= title %></span><span class="author"><%= description %></span>' |
13 + '<span class="time-length">Durée : <span><%= duration.toString() %></span></span></span></li>'), |
23 + '<span class="time-length"><%= IriSP.hc_messages.duration_ %> <span><%= duration.toString() %></span></span></span></li>'), |
14 segmenttemplate = _.template('<li class="item-video" data-segment-id="<%= annotation.id %>" data-media-id="<%= annotation.getMedia().id %>">' |
24 segmenttemplate = _.template('<li class="item-video" data-segment-id="<%= annotation.id %>" data-media-id="<%= annotation.getMedia().id %>">' |
15 + '<img src="<%= annotation.getMedia().thumbnail %>" alt="<%= annotation.getMedia().title %>" />' |
25 + '<img src="<%= annotation.getMedia().thumbnail %>" alt="<%= annotation.getMedia().title %>" />' |
16 + '<span class="video-info"><span class="title-video"><%= annotation.getMedia().title %></span>' |
26 + '<span class="video-info"><span class="title-video"><%= annotation.getMedia().title %></span>' |
17 + '<span class="subtitle"><%= annotation.title %></span><span class="duration"><%= annotation.begin.toString() %> - <%= annotation.end.toString() %> (<%= annotation.getDuration().toString() %>)</span>' |
27 + '<span class="subtitle"><%= annotation.title %></span><span class="duration"><%= annotation.begin.toString() %> - <%= annotation.end.toString() %> (<%= annotation.getDuration().toString() %>)</span>' |
18 + '<ul class="tools"><li><a class="edit" href="#" title="Éditer le segment"></a></li><li><a class="bottom" href="#" title="Descendre le segment"></a></li>' |
28 + '<ul class="tools"><li><a class="edit" href="#" title="<%= IriSP.hc_messages.edit_segment %>"></a></li><li><a class="bottom" href="#" title="<%= IriSP.hc_messages.segment_down %>"></a></li>' |
19 + '<li><a class="top" href="#" title="Remonter le segment"></a></li><li><a class="delete" href="#" title="Supprimer le segment"></a></li></ul></span></li>'), |
29 + '<li><a class="top" href="#" title="<%= IriSP.hc_messages.segment_up %>"></a></li><li><a class="delete" href="#" title="<%= IriSP.hc_messages.delete_segment %>"></a></li></ul></span></li>'), |
20 viztemplate = _.template('<div class="frise-segment" style="background-color:<%= color %>; left:<%= left %>%; width:<%= width %>%;"></div>'), |
30 viztemplate = _.template('<div class="frise-segment" data-segment-id="<%= segmentid %>" style="background-color:<%= color %>; left:<%= left %>%; width:<%= width %>%;"></div>'), |
21 intervaltemplate = _.template('<span class="frise-indication" style="left:<%= left %>%;"><%= time.toString() %></span>'), |
31 intervaltemplate = _.template('<span class="frise-indication" style="left:<%= left %>%;"><%= time.toString() %></span>'), |
22 mediasegmenttemplate = _.template('<div class="media-segments-list"><div class="media-segment">' |
32 mediasegmenttemplate = _.template('<div class="media-segments-list"><div class="media-segment">' |
23 + '<div class="media-section media-segment-section" style="left:<%= left %>px; width:<%= width %>px; background:<%= annotation.getMedia().color %>"></div>' |
33 + '<div class="media-section media-segment-section" style="left:<%= left %>px; width:<%= width %>px; background:<%= annotation.getMedia().color %>"></div>' |
24 + '<div class="media-section media-current-section" style="left:<%= currentleft %>px; width:<%= currentwidth %>px;"><div class="media-current-section-inner"></div></div>' |
34 + '<div class="media-section media-current-section" style="left:<%= currentleft %>px; width:<%= currentwidth %>px;"><div class="media-current-section-inner"></div></div>' |
25 + '<div class="popin media-segment-popin" style="left:<%= popleft %>px"><img style="left:<%= pointerpos %>px;" class="pointer" src="img/popin-triangle.png" alt="" /><div class="popin-content">' |
35 + '<div class="popin media-segment-popin" style="left:<%= popleft %>px"><img style="left:<%= pointerpos %>px;" class="pointer" src="img/popin-triangle.png" alt="" /><div class="popin-content">' |
443 } |
459 } |
444 |
460 |
445 var addMode; |
461 var addMode; |
446 |
462 |
447 function setMedia(media) { |
463 function setMedia(media) { |
448 $(".col-left .item-video").removeClass("active"); |
|
449 $(".tutorial").hide(); |
|
450 //TODO: Show Tutorial when Hashcut is empty |
|
451 if (currentMedia) { |
464 if (currentMedia) { |
452 currentMedia.pause(); |
465 currentMedia.pause(); |
453 } |
466 } |
454 currentMedia = media; |
467 currentMedia = media; |
455 if (currentMedia.elementType == "media") { |
468 if (currentMedia.elementType == "media") { |
456 $("video").hide(); |
469 $("video").hide(); |
457 $(".col-left .item-video[data-media-id='" + currentMedia.id + "']").addClass("active"); |
|
458 showSegmentation(); |
470 showSegmentation(); |
|
471 if (!currentMedia.loaded) { |
|
472 seekdiv.show(); |
|
473 } |
459 var currentvideo = $('#video_' + currentMedia.id); |
474 var currentvideo = $('#video_' + currentMedia.id); |
460 if (!currentvideo.length) { |
475 if (!currentvideo.length) { |
461 addMediaPlayer(currentMedia); |
476 addMediaPlayer(currentMedia); |
462 } |
477 } |
463 $(".tab-media-title").text(currentMedia.title); |
478 $(".tab-media-title").text(currentMedia.title); |
834 var ids = $(".organize-segments .item-video").map(function(){return $(this).attr("data-segment-id")}); |
858 var ids = $(".organize-segments .item-video").map(function(){return $(this).attr("data-segment-id")}); |
835 mashup.setAnnotationsById(ids); |
859 mashup.setAnnotationsById(ids); |
836 } |
860 } |
837 |
861 |
838 function highlightCurrentSegment() { |
862 function highlightCurrentSegment() { |
839 $(".organize-segments .item-video").removeClass("active"); |
863 $(".organize-segments .item-video, .col-left .item-video, .frise-segment").removeClass("active"); |
|
864 var segmentid = undefined; |
840 if (currentMedia && currentSegment) { |
865 if (currentMedia && currentSegment) { |
841 $(".item-video[data-segment-id='" + currentSegment.id + "']").addClass("active"); |
866 segmentid = currentSegment.id; |
842 } |
867 } |
843 } |
868 if (currentMedia === mashup && mashupCurrentAnnotation) { |
844 |
869 segmentid = mashupCurrentAnnotation.annotation.id; |
845 $(".organize-segments").sortable({ |
870 } |
|
871 $(".item-video[data-segment-id='" + segmentid + "']").addClass("active"); |
|
872 var mediaid = undefined; |
|
873 if (currentMedia) { |
|
874 mediaid = currentMedia.id; |
|
875 } |
|
876 if (currentMedia === mashup && mashupCurrentMedia) { |
|
877 mediaid = mashupCurrentMedia.id |
|
878 } |
|
879 $(".col-left .item-video[data-media-id='" + mediaid + "']").addClass("active"); |
|
880 } |
|
881 |
|
882 function hoverSegment() { |
|
883 var segmentid = $(this).attr("data-segment-id"); |
|
884 $(".organize-segments .item-video, .frise-segment").removeClass("active"); |
|
885 $(".item-video[data-segment-id='" + segmentid + "'], .frise-segment[data-segment-id='" + segmentid + "']").addClass("active"); |
|
886 } |
|
887 |
|
888 $(".frise") |
|
889 .on("mouseover", ".frise-segment", hoverSegment) |
|
890 .on("mouseout", ".frise-segment", highlightCurrentSegment) |
|
891 |
|
892 $(".organize-segments") |
|
893 .sortable({ |
846 stop : reorganizeMashup |
894 stop : reorganizeMashup |
847 }); |
895 }) |
848 |
896 .on("mouseover", ".item-video", hoverSegment) |
849 $(".organize-segments").on("click", ".item-video", function(e) { |
897 .on("mouseout", ".item-video", highlightCurrentSegment) |
|
898 .on("click", ".item-video", function(e) { |
850 var el = $(this), |
899 var el = $(this), |
851 segment = mashup.getAnnotationById(el.attr("data-segment-id")); |
900 segment = mashup.getAnnotationById(el.attr("data-segment-id")); |
852 setMedia(mashup); |
901 setMedia(mashup); |
853 if (segment) { |
902 if (segment) { |
854 mashup.setCurrentTime(segment.begin); |
903 mashup.setCurrentTime(segment.begin); |
855 } |
904 } |
856 return false; |
905 return false; |
857 }); |
906 }) |
858 |
907 .on("click", ".edit", function(e) { |
859 $(".organize-segments").on("click", ".edit", function(e) { |
|
860 var currentItem = $(this).parents(".item-video"), |
908 var currentItem = $(this).parents(".item-video"), |
861 media = project.getElement(currentItem.attr("data-media-id")), |
909 media = project.getElement(currentItem.attr("data-media-id")), |
862 segment = project.getElement(currentItem.attr("data-segment-id")); |
910 segment = project.getElement(currentItem.attr("data-segment-id")); |
863 currentSegment = segment; |
911 currentSegment = segment; |
864 setMedia(media); |
912 setMedia(media); |
865 return false; |
913 return false; |
866 }); |
914 }) |
867 |
915 .on("click", ".top", function(e){ |
868 $(".organize-segments").on("click", ".top", function(e){ |
|
869 var currentItem = $(this).parents(".item-video"); |
916 var currentItem = $(this).parents(".item-video"); |
870 currentItem.insertBefore(currentItem.prev()); |
917 currentItem.insertBefore(currentItem.prev()); |
871 reorganizeMashup(); |
918 reorganizeMashup(); |
872 return false; |
919 return false; |
873 }); |
920 }) |
874 |
921 .on("click", ".bottom", function(e){ |
875 $(".organize-segments").on("click", ".bottom", function(e){ |
|
876 var currentItem = $(this).parents(".item-video"); |
922 var currentItem = $(this).parents(".item-video"); |
877 currentItem.insertAfter(currentItem.next()); |
923 currentItem.insertAfter(currentItem.next()); |
878 reorganizeMashup(); |
924 reorganizeMashup(); |
879 return false; |
925 return false; |
880 }); |
926 }) |
881 |
927 .on("click", ".delete", function(e){ |
882 $(".organize-segments").on("click", ".delete", function(e){ |
|
883 var id = $(this).parents(".item-video").attr("data-segment-id"); |
928 var id = $(this).parents(".item-video").attr("data-segment-id"); |
884 mashup.removeAnnotationById(id); |
929 mashup.removeAnnotationById(id); |
|
930 if (!mashup.segments.length) { |
|
931 showEmpty(); |
|
932 } |
885 return false; |
933 return false; |
886 }); |
934 }); |
887 |
935 |
888 /* Tangles */ |
936 /* Tangles */ |
889 var tangleMsPerPixel = 100, |
937 var tangleMsPerPixel = 100, |