--- a/integration/js/edition.js Thu Jun 06 17:58:16 2013 +0200
+++ b/integration/js/edition.js Thu Jun 06 18:04:50 2013 +0200
@@ -24,8 +24,9 @@
}
});
-$('.timeline-annotations').bind('click', function(e){
- var x = e.pageX - $(this).offset().left;
+$('.timeline-annotations').on('click', '.annotation', function(e){
+ e.preventDefault();
+
myMedia.setCurrentTime(myMedia.duration * x / $(this).width());
});
@@ -301,7 +302,8 @@
//var newEnd = new IriSP.Model.Time(chapter.end)
chapterModify.setEnd(chapter.end);
}
- chapters = _(chapters).reject(function(c) { return c.id == idChapter; });
+ chapters.removeId(idChapter);
+ myProject.getAnnotations().removeId(idChapter, true);
renderChapter();
//si le formulaire est visible
if($('#form-chapter-edit-'+idChapter).length){
@@ -325,6 +327,7 @@
chapter.color = getRandomColor();
chapters.push(chapter);
+ myProject.getAnnotations().push(chapter);
renderChapter();
loadFormChapter(chapter.id);
}
@@ -366,7 +369,7 @@
wChapterSegmentWrap = chapterSegmentWrap.width(),
chapterList = $('.list-chapter-rows-wrap');
- chapters = _.sortBy(chapters, function(c){
+ chapters = chapters.sortBy(function(c){
return c.begin;
});
@@ -412,6 +415,7 @@
annotation.keywords = dataAnnotation.keywords;
annotation.content = getContentAnnotationByType(dataAnnotation.type);
+ myProject.getAnnotations().push(annotation);
annotations.push(annotation);
return annotation;
@@ -424,7 +428,7 @@
wTimeline = timeline.width(),
annotationList = $('#list-annotations-rows');
- annotations = _.sortBy(annotations, function(c){
+ annotations = annotations.sortBy(function(c){
return c.begin;
});
@@ -440,7 +444,9 @@
left : left,
width : width,
backgroundColor : v.color
- }).addClass('annotation').attr('id', 'annotation-timeline-'+v.id);
+ }).addClass('annotation')
+ .attr('data-id', v.id)
+ .attr('id', 'annotation-timeline-'+v.id);
var isInTimeline = false;
$.each(timeline.find('li'), function(a, b){
@@ -505,6 +511,7 @@
if(name == 'title'){
var idAnnotation = $(this).parents('form').attr('data-id');
$('#onglet-title-'+idAnnotation).text(value);
+ $(this).parents('form').find('.btn-delete-annotation').attr('data-title', value);
}
});
@@ -521,7 +528,8 @@
function deleteAnnotation(idAnnotation){
disabledPreview();
$("#modal-confirm").modal('hide');
- annotations = _(annotations).reject(function(c) { return c.id == idAnnotation; });
+ annotations.removeId(idAnnotation);
+ myProject.getAnnotations().removeId(idAnnotation, true);
closeTab(idAnnotation);
renderAnnotation();
}
@@ -706,7 +714,7 @@
getVideoPlayer(dataVideo.url, videoWrap);
}
- $('.popup').on('click', '.bibliotheque-video a', function(e){
+ $('.popup').on('click', '.bibliotheque-video a:not(.pagination a)', function(e){
e.preventDefault();
var url = $(this).attr('data-url'),
@@ -721,14 +729,13 @@
var videoWrap = $('#tab-annotation-'+currentAnnotation.id).find('.annotation-video-content');
renderVideoInfo(videoWrap, currentAnnotation.content);
-
});
//diaporama
//bibliotheque
- $('.popup').on('click', '.bibliotheque-image a', function(e){
+ $('.popup').on('click', '.bibliotheque-image a:not(.pagination a)', function(e){
e.preventDefault();
var url = $(this).attr('data-url'),
@@ -891,7 +898,7 @@
$('.btn-save-project').bind('click', function(e){
$('.btn-apercu-projet').removeClass('disabled');
- console.log(myProject.serialize());
+ console.log(JSON.parse(myProject.serialize()));
/*
$.ajax({
type: "POST",
@@ -950,7 +957,7 @@
fonts: "Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond," +
"Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",
sizes: "1,2,3,4,5,6,7",
- styles: [["Paragraph", "<p>"], ["Header 1", "<h1>"], ["Header 2", "<h2>"],
+ styles: [["Paragraph", "<p>"], ["Header 2", "<h2>"],
["Header 3", "<h3>"], ["Header 4","<h4>"], ["Header 5","<h5>"],
["Header 6","<h6>"]],
docType: '<!DOCTYPE HTML>',