diff -r f4a03f8bc37a -r 458cc4576415 integration/js/contentplayer.js --- a/integration/js/contentplayer.js Fri Dec 21 15:45:10 2012 +0100 +++ b/integration/js/contentplayer.js Fri Jan 04 18:10:03 2013 +0100 @@ -30,31 +30,14 @@ var timeSlider = $("#progressBar"), slidersRange = 1000, wasPaused = true, - lastVal = 0, - isClicking = false; + lastVal = 0; timeSlider.slider({ range: "min", value: 0, min: 0, max: slidersRange, slide: function(event, ui) { - if (isClicking && Math.abs(lastVal - ui.value) > 10) { - isClicking = false; - } - if (!isClicking && currentMedia) { - currentMedia.setCurrentTime(currentMedia.duration * ui.value / slidersRange); - } - }, - start: function(event, ui) { - isClicking = true; - lastVal = ui.value; - }, - stop: function(event, ui) { - if (isClicking && currentMedia) { - timeSlider.slider("value", slidersRange * currentMedia.getCurrentTime() / currentMedia.duration); - playOrPause(); - } - isClicking = false; + currentMedia.setCurrentTime(currentMedia.duration * ui.value / slidersRange); } }); @@ -129,28 +112,41 @@ $(window).on("resize", resizeTagsDrag); resizeTagsDrag(); - var taginput = $("#form_tag input[type=text]"); + var taginput = $("#form_tag input[type=text]"), + replacerx; taginput.autocomplete({ source: function(params, response) { - var rx = new RegExp(params.term,"gi"); + var charsub = [ '[aáàâä]', '[cç]', '[eéèêë]', '[iíìîï]', '[oóòôö]' ], + term = params.term.replace(/([\\\*\+\?\|\{\[\}\]\(\)\^\$\.\#\/])/gm, '\\$1'); + _(charsub).each(function(chars) { + var tmprx = new RegExp(chars,"gim"); + term = term.replace(tmprx, chars); + }); + var searchrx = new RegExp("(^|\\s)" + term, "i"); + replacerx = new RegExp("(^|\\s)(" + term + ")", "gi"); response( _(globalTags) .chain() .keys() .filter(function(tag) { - return rx.test(tag) + return searchrx.test(tag) }) - .shuffle() - .first(5) + .sortBy(_.identity) .value() ); } - }); + }).data("autocomplete")._renderItem = function(ul, item) { + return $( "
  • " ) + .data( "item.autocomplete", item ) + .append( "" + item.label.replace(replacerx, '$1$2') + "" ) + .appendTo( ul ); + }; taginput.on("keyup input paste", function() { taginput.val(taginput.val().toUpperCase()); }); $("#form_tag").on("submit", function() { var _tagvalue = taginput.val().toUpperCase(); + taginput.val(""); if (_tagvalue && currentSegment) { /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */ var _exportedAnnotations = new IriSP.Model.List(directory), @@ -177,15 +173,14 @@ _annotation.setAnnotationType(_annotationType.id); - _annotation.title = _tagvalue; + _annotation.title = currentSegment.title; _annotation.created = new Date(); /* Date de création de l'annotation */ _annotation.description = _tagvalue; _annotation.setTags([_tag.id]); /*Liste des ids de tags */ - /* Les données créateur/date de création sont envoyées non pas dans l'annotation, mais dans le projet */ - _export.creator = "theend"; - _export.created = new Date(); + _annotation.creator = "theend"; + _annotation.created = new Date(); /* Ajout de l'annotation à la liste à exporter */ _exportedAnnotations.push(_annotation); /* Ajout de la liste à exporter à l'objet Source */ @@ -299,21 +294,12 @@ } var videoid = "video_" + media.id, videoEl = $('