--- a/integration/js/edition.js Wed Jun 05 11:56:20 2013 +0200
+++ b/integration/js/edition.js Wed Jun 05 12:05:53 2013 +0200
@@ -1,6 +1,6 @@
-var myMedia = null,
- currentChapter = null,
- currentAnnotation = null,
+var myMedia = undefined,
+ currentChapter = undefined,
+ currentAnnotation = undefined,
chapters = [],
annotations = [];
@@ -9,10 +9,10 @@
var global = {
colorsIndex : 0,
colors :
- ['#f39c12', '#2ecc71', '#3498db', '#9b59b6',
- '#f1c40f', '#e67e22', '#e74c3c',
- '#16a085', '#27ae60', '#2980b9', '#8e44ad',
- '#d35400', '#c0392b', '#bdc3c7']
+ ['#1abc9c', '#3498db', '#9b59b6', '#2ecc71',
+ '#f1c40f', '#ecf0f1', '#e67e22', '#e74c3c', '#95a5a6',
+ '#16a085', '#2980b9', '#8e44ad', '#27ae60',
+ '#f39c12', '#c0392b', '#bdc3c7', '#d35400', '#7f8c8d']
};
@@ -102,47 +102,57 @@
}else{
btnCutChapter.css("left",pos);
}
-
//annotations view
- var currentAnnotationsDisplay = new Array();
- $.each(annotations, function(k, v){
-
- if(v.begin <= t && v.end >= t){
- currentAnnotationsDisplay.push(v.id);
- if(!$('#item-current-annotation-'+v.id).length){
- var itemAnnotation =
- $('<li>')
- .attr('id', 'item-current-annotation-'+v.id)
- .attr('data-id', v.id)
- .append(
- $('<a>')
- .css('backgroundColor', v.color)
- .attr('data-id', v.id)
- .attr('href', '#')
- .append(
- $('<i>').addClass('icon-'+getIcon(v.type))
- )
- );
- $('.list-current-annotations').append(itemAnnotation)
- }
- }
- });
- $.each($('.list-current-annotations li'), function(k, v){
- var idAnnotation = $(this).attr('data-id'),
- annotationDisplayView = $('.annotation-display-view');
- if($.inArray(idAnnotation, currentAnnotationsDisplay)<0){//il ne doit plus être affiché
- $('#item-current-annotation-'+idAnnotation).remove();
- if(annotationDisplayView.attr('data-id') == idAnnotation && annotationDisplayView.is(":visible")){
- annotationDisplayView.hide();
- }
- }
- });
-
+ refreshAnnotationDisplay(t);
});//timeupdate
});//myProject.onLoad
+function refreshAnnotationDisplay(t){
+
+ var currentAnnotationsDisplay = new Array();
+ $.each(annotations, function(k, v){
+
+ if(v.begin <= t && v.end >= t){
+ currentAnnotationsDisplay.push(v.id);
+ if(!$('#item-current-annotation-'+v.id).length){
+ var itemAnnotation =
+ $('<li>')
+ .attr('id', 'item-current-annotation-'+v.id)
+ .attr('data-id', v.id)
+ .append(
+ $('<a>')
+ .css('backgroundColor', v.color)
+ .attr('data-id', v.id)
+ .attr('href', '#')
+ .append(
+ $('<i>').addClass('icon-'+getIcon(v.type))
+ )
+ );
+ $('.list-current-annotations').append(itemAnnotation)
+ }
+ }
+ });
+ $.each($('.list-current-annotations li'), function(k, v){
+ var idAnnotation = $(this).attr('data-id'),
+ annotationDisplayView = $('.annotation-display-view');
+ if($.inArray(idAnnotation, currentAnnotationsDisplay)<0){//il ne doit plus être affiché
+ $('#item-current-annotation-'+idAnnotation).remove();
+ if(annotationDisplayView.attr('data-id') == idAnnotation && annotationDisplayView.is(":visible")){
+ annotationDisplayView.hide();
+ }
+ }
+ });
+ if(currentAnnotation !== undefined){
+ showCurrentAnnotationInTimeline(currentAnnotation.id);
+ }
+}
+
+function showCurrentAnnotationInTimeline(idAnnotation){
+ $('.timeline-annotations .annotation').empty();
+ $('#annotation-timeline-'+idAnnotation).text('en cours');
+}
//display annotation view
$('.list-current-annotations').on('click', 'a', function(e){
e.preventDefault();
@@ -176,9 +186,6 @@
//select on bibliotheque
-
-
-
//confirmation suppression
$("#modal-confirm").on('click', '#btn-delete-modal', function(e){
@@ -203,7 +210,10 @@
var input = $('<input type="text" />');
input.val(html);
$('.project-title').replaceWith(input);
- input.focus();
+ input.focus().keypress(function(e){
+ code = (e.keyCode ? e.keyCode : e.which);
+ if (code == 13) $(this).blur();
+ });
});
$(document).on('blur', '.project-title-editor input', function(){
var newTitle = $(this).val();
@@ -500,7 +510,7 @@
}
});
- $('.tab-content').on('keyup', 'input[name=title], textarea', function(e){
+ $('.tab-content').on('keyup', '.form-info-general-annotation input[name=title], .form-info-general-annotation textarea', function(e){
var name = $(this).attr('name'),
value = $(this).val();
currentAnnotation[name] = value;
@@ -547,7 +557,7 @@
});
function openTab(type, data){
-
+
var dataView;
if(_.isUndefined(data)){//nouveau
var currentTimePlusUnMin = 60 * 1000 + myMedia.currentTime,
@@ -571,14 +581,13 @@
iconTab;
currentAnnotation = _.find(annotations, function(c){ return c.id == idAnnotation; });
-
-
-
+ showCurrentAnnotationInTimeline(idAnnotation);
//head commun à tous
var tplHead = getTemplate('#tpl-head');
var output = Mustache.render(tplHead, dataView);
$(tabContent).append(output);
$(tabContent).find(".slider-duration").slider(configSlider(dataView));
+ $(tabContent).find(".ui-slider-range.ui-widget-header.ui-corner-all").css('background', dataView.color);
$(tabContent).find('.tag-it').tagit(tagitParam);
//type
var viewType = {
@@ -680,10 +689,12 @@
$('#onglet-annotations').on('show', 'a[data-toggle="annotation"]', function (e) {
var idAnnotation = $(e.target).attr('data-id');
currentAnnotation = _.find(annotations, function(c){ return c.id == idAnnotation; });
+ showCurrentAnnotationInTimeline(idAnnotation);
});
//rafraichit annotations au retour sur la liste
$('#onglet-annotations').on('show', 'a[data-toggle="list-annotations"]', function (e) {
+ currentAnnotation = undefined;
renderAnnotation();
});
@@ -768,6 +779,41 @@
};
+ //edit title / description
+ $('.tab-content').on('click', '.title-slideshow-row', function(){
+ if($(this).find('input').length) return;
+ var html = $(this).find('span').html();
+ var input = $('<input type="text" />').addClass('input-mini').attr('name', 'title');
+ input.val(html);
+ $(this).find('span').replaceWith(input);
+ input.focus().keypress(function(e){
+ code = (e.keyCode ? e.keyCode : e.which);
+ if (code == 13) $(this).blur();
+ });
+ });
+
+ $('.tab-content').on('click', '.description-slideshow-row', function(){
+ if($(this).find('textarea').length) return;
+ var html = $(this).find('span').html();
+ var input = $('<textarea>').attr('name', 'description');
+ input.val(html);
+ $(this).find('span').replaceWith(input);
+ input.focus().keypress(function(e){
+ code = (e.keyCode ? e.keyCode : e.which);
+ if (code == 13) $(this).blur();
+ });
+ });
+
+ $(document).on('blur', '.title-slideshow-row input, .description-slideshow-row textarea', function(){
+ var newValue = $(this).val(),
+ name = $(this).attr('name'),
+ span = $('<span>').html(newValue),
+ indexRow = $(this).parents('.row-image-diaporama').index();
+ $(this).replaceWith(span);
+
+ currentAnnotation.content.images[indexRow][name] = newValue;
+ });
+
//bouton up / down
$(document).on('click', '.ui-sortable .btn-sort', function(e){
e.preventDefault();
@@ -946,7 +992,8 @@
annotationTimeline.css('z-index',100);
},
stop : function(){
- renderAnnotation()
+ renderAnnotation();
+ refreshAnnotationDisplay(myMedia.getCurrentTime());
}
};
}