Transferred i18n data to widgets, corrected slider bug, added search in annotationslist popcorn-port
authorveltr
Mon, 26 Mar 2012 19:18:04 +0200
branchpopcorn-port
changeset 838 03b03865eb9b
parent 837 353a78021ebc
child 839 4357aac4eb19
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
src/css/LdtPlayer.css
src/js/i18n.js
src/js/widgets/annotationsListWidget.js
src/js/widgets/annotationsWidget.js
src/js/widgets/createAnnotationWidget.js
src/js/widgets/playerWidget.js
src/js/widgets/sliderWidget.js
test/integration/allocine_dossier_independant/js/LdtPlayer-release.js
test/integration/allocine_dossier_independant/polemic-allocine.htm
--- a/src/css/LdtPlayer.css	Thu Mar 22 18:42:31 2012 +0100
+++ b/src/css/LdtPlayer.css	Mon Mar 26 19:18:04 2012 +0200
@@ -860,6 +860,10 @@
   background-color: #e9e9e9;
 }
 
+.Ldt-AnnotationsList-highlight {
+    background: #cc80ff;
+}
+
 .Ldt-AnnotationsListWidget a {
   text-decoration: none;
 }
--- a/src/js/i18n.js	Thu Mar 22 18:42:31 2012 +0100
+++ b/src/js/i18n.js	Mon Mar 26 19:18:04 2012 +0200
@@ -42,66 +42,20 @@
     )
 }
 
-IriSP.i18n_factory.prototype.addLanguage = function(lang, messages) {
-    this.messages[lang] = messages;
+IriSP.i18n_factory.prototype.addMessage = function(lang, messagekey, messagevalue) {
+    if (typeof this.messages[lang] == "undefined") {
+        this.messages[lang] = {};
+    }
+    this.messages[lang][messagekey] = messagevalue;
 }
 
-IriSP.i18n_factory.prototype.addLanguages = function(messages) {
+IriSP.i18n_factory.prototype.addMessages = function(messagesObj) {
     var _this = this;
-    IriSP.underscore(messages).each(function(_messages, _lang) {
-        _this.addLanguage(_lang, _messages);
+    IriSP.underscore(messagesObj).each(function(_messages, _lang) {
+        IriSP.underscore(_messages).each(function(_value, _key) {
+            _this.addMessage(_lang, _key, _value);
+        })
     });
 }
 
 IriSP.i18n = new IriSP.i18n_factory();
-
-IriSP.i18n.addLanguages(
-    {
-        en: {
-            submit: "Submit",
-            add_keywords: "Add keywords",
-            add_polemic_keywords: "Add polemic keywords",
-            your_name: "Your name",
-            type_here: "Type your annotation here.",
-            wait_while_processed: "Please wait while your request is being processed...",
-            error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.",
-            empty_annotation: "Your annotation is empty. Please write something before submitting.",
-            annotation_saved: "Thank you, your annotation has been saved.",
-            share_annotation: "Would you like to share it on social networks ?",
-            share_on: "Share on",
-            play_pause: "Play/Pause",
-            mute_unmute: "Mute/Unmute",
-            play: "Play",
-            pause: "Pause",
-            mute: "Mute",
-            unmute: "Unmute",
-            annotate: "Annotate",
-            search: "Search",
-            elapsed_time: "Elapsed time",
-            total_time: "Total time"
-        },
-        fr: {
-            submit: "Envoyer",
-            add_keywords: "Ajouter des mots-clés",
-            add_polemic_keywords: "Ajouter des mots-clés polémiques",
-            your_name: "Votre nom",
-            type_here: "Rédigez votre annotation ici.",
-            wait_while_processed: "Veuillez patienter pendant le traitement de votre requête...",
-            error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée",
-            empty_annotation: "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.",
-            annotation_saved: "Merci, votre annotation a été enregistrée.",
-            share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?",
-            share_on: "Partager sur",
-            play_pause: "Lecture/Pause",
-            mute_unmute: "Couper/Activer le son",
-            play: "Lecture",
-            pause: "Pause",
-            mute: "Couper le son",
-            unmute: "Activer le son",
-            annotate: "Annoter",
-            search: "Rechercher",
-            elapsed_time: "Durée écoulée",
-            total_time: "Durée totale"
-        }
-    }
-);
--- a/src/js/widgets/annotationsListWidget.js	Thu Mar 22 18:42:31 2012 +0100
+++ b/src/js/widgets/annotationsListWidget.js	Mon Mar 26 19:18:04 2012 +0200
@@ -7,7 +7,19 @@
   this.checkOption('project_url');
   this.checkOption('default_thumbnail');
   this.checkOption("cinecast_version", false);
+  this.searchRe = null;
+  this._ajax_cache = [];
   var _this = this;
+  
+  this._Popcorn.listen("IriSP.search", function(searchString) {
+      _this.searchHandler(searchString);
+  });
+  this._Popcorn.listen("IriSP.search.closed", function() {
+      _this.searchHandler(false);
+  });
+  this._Popcorn.listen("IriSP.search.cleared", function() {
+      _this.searchHandler(false);
+  });
 };
 
 
@@ -19,10 +31,45 @@
 IriSP.AnnotationsListWidget.prototype.clearWidget = function() {
 };
 
+IriSP.AnnotationsListWidget.prototype.searchHandler = function(searchString) {
+  this.searchRe = (searchString && searchString.length) ? IriSP.regexpFromText(searchString) : null;
+  if (this.ajax_mode) {
+      var _this = this,
+        _annotations = (
+            this.searchRe === null
+            ? this._ajax_cache
+            : IriSP.underscore.filter(this._ajax_cache, function(_a) {
+               return (_this.searchRe.test(_a.desc) || _this.searchRe.test(_a.title)); 
+            })
+        );
+    this.do_redraw(_annotations);
+    if (_annotations.length) {
+        this._Popcorn.trigger("IriSP.search.matchFound");
+      } else {
+        this._Popcorn.trigger("IriSP.search.noMatchFound");
+      }    
+  } else {
+      this.drawList();
+  }
+}
+
 /** effectively redraw the widget - called by drawList */
 IriSP.AnnotationsListWidget.prototype.do_redraw = function(list) {
-    var widgetMarkup = IriSP.templToHTML(IriSP.annotationsListWidget_template, {annotations: list});
-    this.selector.html(widgetMarkup);
+    var _html = IriSP.templToHTML(
+        IriSP.annotationsListWidget_template, {
+            annotations: list
+        }),
+        _this = this;
+      
+    this.selector.html(_html);
+    
+    if (this.searchRe !== null) {
+        this.selector.find(".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description")
+            .each(function()  {
+                var _$ = IriSP.jQuery(this);
+                _$.html(_$.text().replace(_this.searchRe, '<span class="Ldt-AnnotationsList-highlight">$1</span>'))
+            })
+    }
 };
 
 IriSP.AnnotationsListWidget.prototype.transformAnnotation = function(a) {
@@ -83,6 +130,17 @@
     
   }
   
+    if (this.searchRe !== null) {
+        list = list.filter(function(_a) {
+            return (_this.searchRe.test(_a.desc) || _this.searchRe.test(_a.title)); 
+        });
+        if (list.length) {
+            this._Popcorn.trigger("IriSP.search.matchFound");
+          } else {
+            this._Popcorn.trigger("IriSP.search.noMatchFound");
+          }
+    }
+  
   list = IriSP.underscore(list)
     .chain()
     .sortBy(function(_o) {
@@ -176,7 +234,7 @@
           }
       l.push(obj);
   }
-
+  this._ajax_cache = l;
   this.do_redraw(l);
 };
 IriSP.AnnotationsListWidget.prototype.draw = function() {
@@ -192,16 +250,15 @@
     this.annotations_ids.push(annotations[i]["id"]);
   }
   
-  this.drawList();
-  
   var _this = this;
     
-  if (!this.ajax_mode) {
-      var _throttled = IriSP.underscore.throttle(function() {
-      _this.drawList();
-    }, 1500);
-    this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", _throttled);
-    this._Popcorn.listen("timeupdate", _throttled);
+    if (!this.ajax_mode) {
+        var _throttled = IriSP.underscore.throttle(function() {
+            _this.drawList();
+        }, 1500);
+        _throttled();
+        this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", _throttled);
+        this._Popcorn.listen("timeupdate", _throttled);
   } else {
     /* update the widget when the video has finished loading and when it's seeked and paused */
     this._Popcorn.listen("seeked", IriSP.wrap(this, this.ajaxRedraw));
--- a/src/js/widgets/annotationsWidget.js	Thu Mar 22 18:42:31 2012 +0100
+++ b/src/js/widgets/annotationsWidget.js	Mon Mar 26 19:18:04 2012 +0200
@@ -1,3 +1,16 @@
+/* Internationalization for this widget */
+
+IriSP.i18n.addMessages(
+    {
+        "fr": {
+            "keywords": "Mots-clés"
+        },
+        "en": {
+            "keywords": "Keywords"
+        }
+    }
+);
+
 IriSP.AnnotationsWidget = function(Popcorn, config, Serializer) {
   IriSP.Widget.call(this, Popcorn, config, Serializer);
   /* flag used when we're creating an annotation */
@@ -46,7 +59,7 @@
       }
     }
     
-    tags = "Keywords: " + tags.slice(0, tags.length - 2);
+    tags = IriSP.i18n.getMessage("keywords") + ": " + tags.slice(0, tags.length - 2);
     
     this.selector.find(".Ldt-SaKeywords").text(tags);
     
--- a/src/js/widgets/createAnnotationWidget.js	Thu Mar 22 18:42:31 2012 +0100
+++ b/src/js/widgets/createAnnotationWidget.js	Mon Mar 26 19:18:04 2012 +0200
@@ -1,3 +1,36 @@
+/* Internationalization for this widget */
+
+IriSP.i18n.addMessages(
+    {
+        "en": {
+            "submit": "Submit",
+            "add_keywords": "Add keywords",
+            "add_polemic_keywords": "Add polemic keywords",
+            "your_name": "Your name",
+            "type_here": "Type your annotation here.",
+            "wait_while_processed": "Please wait while your request is being processed...",
+            "error_while_contacting": "An error happened while contacting the server. Your annotation has not been saved.",
+            "empty_annotation": "Your annotation is empty. Please write something before submitting.",
+            "annotation_saved": "Thank you, your annotation has been saved.",
+            "share_annotation": "Would you like to share it on social networks ?",
+            "share_on": "Share on"
+        },
+        "fr": {
+            "submit": "Envoyer",
+            "add_keywords": "Ajouter des mots-clés",
+            "add_polemic_keywords": "Ajouter des mots-clés polémiques",
+            "your_name": "Votre nom",
+            "type_here": "Rédigez votre annotation ici.",
+            "wait_while_processed": "Veuillez patienter pendant le traitement de votre requête...",
+            "error_while_contacting": "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée",
+            "empty_annotation": "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.",
+            "annotation_saved": "Merci, votre annotation a été enregistrée.",
+            "share_annotation": "Souhaitez-vous la partager sur les réseaux sociaux ?",
+            "share_on": "Partager sur"
+        }
+    }
+);
+
 IriSP.createAnnotationWidget = function(Popcorn, config, Serializer) {
   IriSP.Widget.call(this, Popcorn, config, Serializer);
   this._hidden = true;
@@ -338,6 +371,15 @@
   annotation.type_title = "Contributions";
   annotation.content = {};
   annotation.content.data = contents;
+  if (this.cinecast_version) {
+      var _extract = IriSP.underscore(this._serializer._data.annotations)
+          .filter(function(_a) {
+              return (_a.begin <= annotation.begin && _a.end >= annotation.begin && _a.type == "cinecast:MovieExtract");
+          })
+      if (_extract.length) {
+          annotation.extract = _extract[0].id;
+      }
+  }
   
   var meta = apiJson.meta;
   
--- a/src/js/widgets/playerWidget.js	Thu Mar 22 18:42:31 2012 +0100
+++ b/src/js/widgets/playerWidget.js	Mon Mar 26 19:18:04 2012 +0200
@@ -1,3 +1,35 @@
+/* Internationalization for this widget */
+
+IriSP.i18n.addMessages(
+    {
+        "en": {
+            "play_pause": "Play/Pause",
+            "mute_unmute": "Mute/Unmute",
+            "play": "Play",
+            "pause": "Pause",
+            "mute": "Mute",
+            "unmute": "Unmute",
+            "annotate": "Annotate",
+            "search": "Search",
+            "elapsed_time": "Elapsed time",
+            "total_time": "Total time"
+        },
+        "fr": {
+            "play_pause": "Lecture/Pause",
+            "mute_unmute": "Couper/Activer le son",
+            "play": "Lecture",
+            "pause": "Pause",
+            "mute": "Couper le son",
+            "unmute": "Activer le son",
+            "annotate": "Annoter",
+            "search": "Rechercher",
+            "elapsed_time": "Durée écoulée",
+            "total_time": "Durée totale"
+        }
+    }
+);
+
+
 IriSP.PlayerWidget = function(Popcorn, config, Serializer) {
   IriSP.Widget.call(this, Popcorn, config, Serializer);
   
--- a/src/js/widgets/sliderWidget.js	Thu Mar 22 18:42:31 2012 +0100
+++ b/src/js/widgets/sliderWidget.js	Mon Mar 26 19:18:04 2012 +0200
@@ -154,16 +154,16 @@
 };
 
 IriSP.SliderWidget.prototype.positionMarkerDraggedHandler = function(event, ui) {   
-  this._disableUpdate = true; // disable slider position updates while dragging is ongoing.
+
+/*  this._disableUpdate = true; // disable slider position updates while dragging is ongoing.
   window.setTimeout(IriSP.wrap(this, function() { this._disableUpdate = false; }), 500);
-
+*/
   var parentOffset = this.sliderForeground.parent().offset();
   var width = this.sliderBackground.width();
-  var relX = event.pageX - parentOffset.left;
+  var relX = event.originalEvent.pageX - parentOffset.left;
 
   var duration = this._serializer.getDuration() / 1000;
   var newTime = ((relX / width) * duration).toFixed(2);
-
   this._Popcorn.currentTime(newTime);
   
   this.draggingOngoing = false;
--- a/test/integration/allocine_dossier_independant/js/LdtPlayer-release.js	Thu Mar 22 18:42:31 2012 +0100
+++ b/test/integration/allocine_dossier_independant/js/LdtPlayer-release.js	Mon Mar 26 19:18:04 2012 +0200
@@ -2293,69 +2293,23 @@
     )
 }
 
-IriSP.i18n_factory.prototype.addLanguage = function(lang, messages) {
-    this.messages[lang] = messages;
+IriSP.i18n_factory.prototype.addMessage = function(lang, messagekey, messagevalue) {
+    if (typeof this.messages[lang] == "undefined") {
+        this.messages[lang] = {};
+    }
+    this.messages[lang][messagekey] = messagevalue;
 }
 
-IriSP.i18n_factory.prototype.addLanguages = function(messages) {
+IriSP.i18n_factory.prototype.addMessages = function(messagesObj) {
     var _this = this;
-    IriSP.underscore(messages).each(function(_messages, _lang) {
-        _this.addLanguage(_lang, _messages);
+    IriSP.underscore(messagesObj).each(function(_messages, _lang) {
+        IriSP.underscore(_messages).each(function(_value, _key) {
+            _this.addMessage(_lang, _key, _value);
+        })
     });
 }
 
 IriSP.i18n = new IriSP.i18n_factory();
-
-IriSP.i18n.addLanguages(
-    {
-        en: {
-            submit: "Submit",
-            add_keywords: "Add keywords",
-            add_polemic_keywords: "Add polemic keywords",
-            your_name: "Your name",
-            type_here: "Type your annotation here.",
-            wait_while_processed: "Please wait while your request is being processed...",
-            error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.",
-            empty_annotation: "Your annotation is empty. Please write something before submitting.",
-            annotation_saved: "Thank you, your annotation has been saved.",
-            share_annotation: "Would you like to share it on social networks ?",
-            share_on: "Share on",
-            play_pause: "Play/Pause",
-            mute_unmute: "Mute/Unmute",
-            play: "Play",
-            pause: "Pause",
-            mute: "Mute",
-            unmute: "Unmute",
-            annotate: "Annotate",
-            search: "Search",
-            elapsed_time: "Elapsed time",
-            total_time: "Total time"
-        },
-        fr: {
-            submit: "Envoyer",
-            add_keywords: "Ajouter des mots-clés",
-            add_polemic_keywords: "Ajouter des mots-clés polémiques",
-            your_name: "Votre nom",
-            type_here: "Rédigez votre annotation ici.",
-            wait_while_processed: "Veuillez patienter pendant le traitement de votre requête...",
-            error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée",
-            empty_annotation: "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.",
-            annotation_saved: "Merci, votre annotation a été enregistrée.",
-            share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?",
-            share_on: "Partager sur",
-            play_pause: "Lecture/Pause",
-            mute_unmute: "Couper/Activer le son",
-            play: "Lecture",
-            pause: "Pause",
-            mute: "Couper le son",
-            unmute: "Activer le son",
-            annotate: "Annoter",
-            search: "Rechercher",
-            elapsed_time: "Durée écoulée",
-            total_time: "Durée totale"
-        }
-    }
-);
 /* To wrap a player the develop should create a new class derived from
 the IriSP.PopcornReplacement.player and defining the correct functions */
 
@@ -2777,7 +2731,19 @@
   this.checkOption('project_url');
   this.checkOption('default_thumbnail');
   this.checkOption("cinecast_version", false);
+  this.searchRe = null;
+  this._ajax_cache = [];
   var _this = this;
+  
+  this._Popcorn.listen("IriSP.search", function(searchString) {
+      _this.searchHandler(searchString);
+  });
+  this._Popcorn.listen("IriSP.search.closed", function() {
+      _this.searchHandler(false);
+  });
+  this._Popcorn.listen("IriSP.search.cleared", function() {
+      _this.searchHandler(false);
+  });
 };
 
 
@@ -2789,10 +2755,45 @@
 IriSP.AnnotationsListWidget.prototype.clearWidget = function() {
 };
 
+IriSP.AnnotationsListWidget.prototype.searchHandler = function(searchString) {
+  this.searchRe = (searchString && searchString.length) ? IriSP.regexpFromText(searchString) : null;
+  if (this.ajax_mode) {
+      var _this = this,
+        _annotations = (
+            this.searchRe === null
+            ? this._ajax_cache
+            : IriSP.underscore.filter(this._ajax_cache, function(_a) {
+               return (_this.searchRe.test(_a.desc) || _this.searchRe.test(_a.title)); 
+            })
+        );
+    this.do_redraw(_annotations);
+    if (_annotations.length) {
+        this._Popcorn.trigger("IriSP.search.matchFound");
+      } else {
+        this._Popcorn.trigger("IriSP.search.noMatchFound");
+      }    
+  } else {
+      this.drawList();
+  }
+}
+
 /** effectively redraw the widget - called by drawList */
 IriSP.AnnotationsListWidget.prototype.do_redraw = function(list) {
-    var widgetMarkup = IriSP.templToHTML(IriSP.annotationsListWidget_template, {annotations: list});
-    this.selector.html(widgetMarkup);
+    var _html = IriSP.templToHTML(
+        IriSP.annotationsListWidget_template, {
+            annotations: list
+        }),
+        _this = this;
+      
+    this.selector.html(_html);
+    
+    if (this.searchRe !== null) {
+        this.selector.find(".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description")
+            .each(function()  {
+                var _$ = IriSP.jQuery(this);
+                _$.html(_$.text().replace(_this.searchRe, '<span class="Ldt-AnnotationsList-highlight">$1</span>'))
+            })
+    }
 };
 
 IriSP.AnnotationsListWidget.prototype.transformAnnotation = function(a) {
@@ -2853,6 +2854,17 @@
     
   }
   
+    if (this.searchRe !== null) {
+        list = list.filter(function(_a) {
+            return (_this.searchRe.test(_a.desc) || _this.searchRe.test(_a.title)); 
+        });
+        if (list.length) {
+            this._Popcorn.trigger("IriSP.search.matchFound");
+          } else {
+            this._Popcorn.trigger("IriSP.search.noMatchFound");
+          }
+    }
+  
   list = IriSP.underscore(list)
     .chain()
     .sortBy(function(_o) {
@@ -2946,7 +2958,7 @@
           }
       l.push(obj);
   }
-
+  this._ajax_cache = l;
   this.do_redraw(l);
 };
 IriSP.AnnotationsListWidget.prototype.draw = function() {
@@ -2962,16 +2974,15 @@
     this.annotations_ids.push(annotations[i]["id"]);
   }
   
-  this.drawList();
-  
   var _this = this;
     
-  if (!this.ajax_mode) {
-      var _throttled = IriSP.underscore.throttle(function() {
-      _this.drawList();
-    }, 1500);
-    this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", _throttled);
-    this._Popcorn.listen("timeupdate", _throttled);
+    if (!this.ajax_mode) {
+        var _throttled = IriSP.underscore.throttle(function() {
+            _this.drawList();
+        }, 1500);
+        _throttled();
+        this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", _throttled);
+        this._Popcorn.listen("timeupdate", _throttled);
   } else {
     /* update the widget when the video has finished loading and when it's seeked and paused */
     this._Popcorn.listen("seeked", IriSP.wrap(this, this.ajaxRedraw));
@@ -2981,7 +2992,20 @@
     this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, this.ajaxRedraw));
   }
 
-};IriSP.AnnotationsWidget = function(Popcorn, config, Serializer) {
+};/* Internationalization for this widget */
+
+IriSP.i18n.addMessages(
+    {
+        "fr": {
+            "keywords": "Mots-clés"
+        },
+        "en": {
+            "keywords": "Keywords"
+        }
+    }
+);
+
+IriSP.AnnotationsWidget = function(Popcorn, config, Serializer) {
   IriSP.Widget.call(this, Popcorn, config, Serializer);
   /* flag used when we're creating an annotation */
   this._hidden = false;
@@ -3029,7 +3053,7 @@
       }
     }
     
-    tags = "Keywords: " + tags.slice(0, tags.length - 2);
+    tags = IriSP.i18n.getMessage("keywords") + ": " + tags.slice(0, tags.length - 2);
     
     this.selector.find(".Ldt-SaKeywords").text(tags);
     
@@ -3202,6 +3226,39 @@
 IriSP.ArrowWidget.prototype.releaseArrow = function() {
   this._blockArrow = false;   
 };
+/* Internationalization for this widget */
+
+IriSP.i18n.addMessages(
+    {
+        "en": {
+            "submit": "Submit",
+            "add_keywords": "Add keywords",
+            "add_polemic_keywords": "Add polemic keywords",
+            "your_name": "Your name",
+            "type_here": "Type your annotation here.",
+            "wait_while_processed": "Please wait while your request is being processed...",
+            "error_while_contacting": "An error happened while contacting the server. Your annotation has not been saved.",
+            "empty_annotation": "Your annotation is empty. Please write something before submitting.",
+            "annotation_saved": "Thank you, your annotation has been saved.",
+            "share_annotation": "Would you like to share it on social networks ?",
+            "share_on": "Share on"
+        },
+        "fr": {
+            "submit": "Envoyer",
+            "add_keywords": "Ajouter des mots-clés",
+            "add_polemic_keywords": "Ajouter des mots-clés polémiques",
+            "your_name": "Votre nom",
+            "type_here": "Rédigez votre annotation ici.",
+            "wait_while_processed": "Veuillez patienter pendant le traitement de votre requête...",
+            "error_while_contacting": "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée",
+            "empty_annotation": "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.",
+            "annotation_saved": "Merci, votre annotation a été enregistrée.",
+            "share_annotation": "Souhaitez-vous la partager sur les réseaux sociaux ?",
+            "share_on": "Partager sur"
+        }
+    }
+);
+
 IriSP.createAnnotationWidget = function(Popcorn, config, Serializer) {
   IriSP.Widget.call(this, Popcorn, config, Serializer);
   this._hidden = true;
@@ -3542,6 +3599,15 @@
   annotation.type_title = "Contributions";
   annotation.content = {};
   annotation.content.data = contents;
+  if (this.cinecast_version) {
+      var _extract = IriSP.underscore(this._serializer._data.annotations)
+          .filter(function(_a) {
+              return (_a.begin <= annotation.begin && _a.end >= annotation.begin && _a.type == "cinecast:MovieExtract");
+          })
+      if (_extract.length) {
+          annotation.extract = _extract[0].id;
+      }
+  }
   
   var meta = apiJson.meta;
   
@@ -3628,6 +3694,38 @@
         
     console.log(this);
 }
+/* Internationalization for this widget */
+
+IriSP.i18n.addMessages(
+    {
+        "en": {
+            "play_pause": "Play/Pause",
+            "mute_unmute": "Mute/Unmute",
+            "play": "Play",
+            "pause": "Pause",
+            "mute": "Mute",
+            "unmute": "Unmute",
+            "annotate": "Annotate",
+            "search": "Search",
+            "elapsed_time": "Elapsed time",
+            "total_time": "Total time"
+        },
+        "fr": {
+            "play_pause": "Lecture/Pause",
+            "mute_unmute": "Couper/Activer le son",
+            "play": "Lecture",
+            "pause": "Pause",
+            "mute": "Couper le son",
+            "unmute": "Activer le son",
+            "annotate": "Annoter",
+            "search": "Rechercher",
+            "elapsed_time": "Durée écoulée",
+            "total_time": "Durée totale"
+        }
+    }
+);
+
+
 IriSP.PlayerWidget = function(Popcorn, config, Serializer) {
   IriSP.Widget.call(this, Popcorn, config, Serializer);
   
@@ -4821,16 +4919,16 @@
 };
 
 IriSP.SliderWidget.prototype.positionMarkerDraggedHandler = function(event, ui) {   
-  this._disableUpdate = true; // disable slider position updates while dragging is ongoing.
+
+/*  this._disableUpdate = true; // disable slider position updates while dragging is ongoing.
   window.setTimeout(IriSP.wrap(this, function() { this._disableUpdate = false; }), 500);
-
+*/
   var parentOffset = this.sliderForeground.parent().offset();
   var width = this.sliderBackground.width();
-  var relX = event.pageX - parentOffset.left;
+  var relX = event.originalEvent.pageX - parentOffset.left;
 
   var duration = this._serializer.getDuration() / 1000;
   var newTime = ((relX / width) * duration).toFixed(2);
-
   this._Popcorn.currentTime(newTime);
   
   this.draggingOngoing = false;
--- a/test/integration/allocine_dossier_independant/polemic-allocine.htm	Thu Mar 22 18:42:31 2012 +0100
+++ b/test/integration/allocine_dossier_independant/polemic-allocine.htm	Mon Mar 26 19:18:04 2012 +0200
@@ -12,7 +12,7 @@
         <!-- SIMPLE PLAYER EXPERIMENTATION -->
         <script type="text/javascript" src="js/LdtPlayer-release.js" type="text/javascript"></script>
         <div id="video"></div>
-        <div id="LdtPlayer"></div>
+        <div id="LdtPlayer" style="float: left;"></div>
         <div id="Sparkline"></div>
         <script  type="text/javascript">
             var json_url = 'allocine_test/bamako.json';
@@ -28,7 +28,7 @@
             var config = {
                 gui : {
                     width : 610,
-                    height : 2100,
+                    height : 900,
                     container : 'LdtPlayer',
                     css : 'css/LdtPlayer.css',
                     default_options : {
@@ -42,7 +42,7 @@
                     },
                     widgets : [{
                         type : "AnnotationsListWidget",
-                        container : "AnnotationsListContainer",
+                        container : "MyListContainer",
                         ajax_mode : false
                     }, {
                         type : "SparklineWidget",
@@ -97,6 +97,6 @@
             IriSP.initPlayer(config, json_url);
 
         </script>
+    <div id="MyListContainer" style="float: left; width: 400px;"></div>
     </body>
-    <div id="AnnotationsListContainer" style="position: absolute; width: 400px; left: 660px; top: 105px;"></div>
 </html>