27 }]; |
27 }]; |
28 } |
28 } |
29 } |
29 } |
30 ); |
30 ); |
31 |
31 |
|
32 $(".media-duration").text(myMedia.duration); |
|
33 |
32 myMedia.on("timeupdate", function(t) { |
34 myMedia.on("timeupdate", function(t) { |
33 var pos = (100 * t / myMedia.duration) + "%"; |
35 var pos = (100 * t / myMedia.duration) + "%"; |
|
36 $(".media-position").text(t); |
34 $(".progress-indicator").css("left",pos); |
37 $(".progress-indicator").css("left",pos); |
35 $(".elapsed").css("width", pos); |
38 $(".elapsed").css("width", pos); |
36 }); |
39 }); |
37 myMedia.on("play", function() { |
40 myMedia.on("play", function() { |
38 $(".play-button").addClass("pause"); |
41 $(".play-button").addClass("pause"); |
42 }); |
45 }); |
43 |
46 |
44 function showAtMousePos(evt) { |
47 function showAtMousePos(evt) { |
45 var pos = evt.pageX - $(".timeline").offset().left; |
48 var pos = evt.pageX - $(".timeline").offset().left; |
46 $(".mouse-progress-indicator").css("left", pos); |
49 $(".mouse-progress-indicator").css("left", pos); |
47 return pos; |
50 var t = new IriSP.Model.Time(pos * myMedia.duration / $(".timeline").width()); |
|
51 $(".time-at-mouse").text(t); |
|
52 return t; |
48 } |
53 } |
49 |
54 |
50 $(".timeline").mouseenter(function(e) { |
55 $(".timeline").mouseenter(function(e) { |
51 $(".mouse-progress-indicator").show(); |
56 $(".mouse-progress-indicator").show(); |
52 showAtMousePos(e); |
57 showAtMousePos(e); |
53 }).mouseleave(function(e) { |
58 }).mouseleave(function(e) { |
54 $(".mouse-progress-indicator").hide(); |
59 $(".mouse-progress-indicator").hide(); |
55 }).mousemove(showAtMousePos) |
60 }).mousemove(showAtMousePos) |
56 .click(function(e) { |
61 .click(function(e) { |
57 myMedia.setCurrentTime( showAtMousePos(e) * myMedia.duration / $(".timeline").width()); |
62 myMedia.setCurrentTime( showAtMousePos(e) ); |
58 }); |
63 }); |
59 |
64 |
60 var tags = myProject.getTags().sortBy(function(t) { |
65 var tags = myProject.getTags().sortBy(function(t) { |
61 return - t.getRelated("annotation").length; |
66 return - t.getRelated("annotation").length; |
62 }).slice(0,20).sortBy(function(t) { |
67 }).slice(0,20).sortBy(function(t) { |
519 var text = annotationinfo.annotation.content.text || annotationinfo.annotation.description; |
524 var text = annotationinfo.annotation.content.text || annotationinfo.annotation.description; |
520 |
525 |
521 switch (annotationinfo.annotation.content.markup) { |
526 switch (annotationinfo.annotation.content.markup) { |
522 case "html": |
527 case "html": |
523 annotationDiv.find(".text-contents").html(text); |
528 annotationDiv.find(".text-contents").html(text); |
524 |
|
525 //annotationDiv.find(".text-contents [style]").attr("style",""); |
|
526 |
529 |
527 var ps = annotationDiv.find(".text-contents>p"), |
530 var ps = annotationDiv.find(".text-contents>p"), |
528 groups = [], |
531 groups = [], |
529 last, group; |
532 last, group; |
530 ps.each(function(i, e) { |
533 ps.each(function(i, e) { |
657 $(".video-container video").on("loadedmetadata",repositionElements); |
660 $(".video-container video").on("loadedmetadata",repositionElements); |
658 |
661 |
659 $(window).resize(repositionElements); |
662 $(window).resize(repositionElements); |
660 |
663 |
661 $(document).keydown(function(e) { |
664 $(document).keydown(function(e) { |
662 if (e.keyCode === 122) { |
665 if (e.keyCode === 122) { // F11 |
663 fullScreen(); |
666 fullScreen(); |
|
667 return false; |
|
668 } |
|
669 if (e.keyCode === 32) { // Space |
|
670 myMedia[myMedia.paused ? "play" : "pause"](); |
664 return false; |
671 return false; |
665 } |
672 } |
666 }); |
673 }); |
667 |
674 |
668 }); |
675 }); |