New metadataplayer + default "Multi segments" widget
authorveltr
Fri, 01 Mar 2013 18:05:02 +0100
changeset 1121 d56201bf1446
parent 1067 62be1eedf908
child 1122 3bda04d364dd
New metadataplayer + default "Multi segments" widget
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html
src/ldt/ldt/static/ldt/metadataplayer/AdaptivePlayer.js
src/ldt/ldt/static/ldt/metadataplayer/Annotation.css
src/ldt/ldt/static/ldt/metadataplayer/Annotation.js
src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css
src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js
src/ldt/ldt/static/ldt/metadataplayer/AutoPlayer.js
src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js
src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js
src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.css
src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js
src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js
src/ldt/ldt/static/ldt/metadataplayer/MultiSegments.js
src/ldt/ldt/static/ldt/metadataplayer/Polemic.js
src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js
src/ldt/ldt/static/ldt/metadataplayer/Segments.js
src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js
src/ldt/ldt/static/ldt/metadataplayer/Social.js
src/ldt/ldt/static/ldt/metadataplayer/Tooltip.css
src/ldt/ldt/static/ldt/metadataplayer/Tooltip.js
src/ldt/ldt/static/ldt/metadataplayer/Trace.js
src/ldt/ldt/static/ldt/metadataplayer/Tweet.js
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Fri Mar 01 18:05:02 2013 +0100
@@ -76,13 +76,7 @@
         },{
             type: "Controller"
         },{
-            type: "Segments",
-            annotation_type: ["chap","découpage"]
-        },{
-            type: "Annotation",
-            start_minimized: true,
-            site_name : "Lignes de Temps",
-            annotation_type: ["chap","découpage"]
+            type: "MultiSegments"
         },{
             type: "Tweet",
             hide_timeout: 5000
--- a/src/ldt/ldt/static/ldt/metadataplayer/AdaptivePlayer.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AdaptivePlayer.js	Fri Mar 01 18:05:02 2013 +0100
@@ -6,7 +6,7 @@
 
 IriSP.Widgets.AdaptivePlayer.prototype.defaults = {
     mime_type: "video/mp4",
-    normal_player: "PopcornPlayer",
+    normal_player: "HtmlPlayer",
     fallback_player: "JwpPlayer"
 }
 
--- a/src/ldt/ldt/static/ldt/metadataplayer/Annotation.css	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Annotation.css	Fri Mar 01 18:05:02 2013 +0100
@@ -6,10 +6,6 @@
     margin: 0;
 }
 
-.Ldt-Annotation-Highlight {
-    background: #ffa0fc;
-}
-
 .Ldt-Annotation-Widget.Ldt-Annotation-ShowTop {
     border-top-style: solid;
     padding-top: 1px;
--- a/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js	Fri Mar 01 18:05:02 2013 +0100
@@ -34,7 +34,7 @@
     + '<div class="Ldt-Annotation-Inner Ldt-Annotation-Empty{{#start_minimized}} Ldt-Annotation-Minimized{{/start_minimized}}">'
     + '<div class="Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-MaxMinButton"></div>'
     + '{{#show_social}}<div class="Ldt-Annotation-Social Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty"></div>{{/show_social}}'
-    + '<h3 class="Ldt-Annotation-HiddenWhenEmpty">{{#show_annotation_type}}<span class="Ldt-Annotation-Type"></span> » {{/show_annotation_type}}<span class="Ldt-Annotation-Title"></span> <span class="Ldt-Annotation-Time Ldt-Annotation-HiddenWhenMinimized">'
+    + '<h3 class="Ldt-Annotation-HiddenWhenEmpty" draggable="true">{{#show_annotation_type}}<span class="Ldt-Annotation-Type"></span> » {{/show_annotation_type}}<span class="Ldt-Annotation-Title"></span> <span class="Ldt-Annotation-Time Ldt-Annotation-HiddenWhenMinimized">'
     + '(<span class="Ldt-Annotation-Begin"></span> - <span class="Ldt-Annotation-End"></span>)</span></h3>'
     + '<h3 class="Ldt-Annotation-MashupOrigin Ldt-Annotation-HiddenWhenEmpty">{{l10n.excerpt_from}} <span class="Ldt-Annotation-MashupMedia"></span> <span class="Ldt-Annotation-Time Ldt-Annotation-HiddenWhenMinimized">'
     + '(<span class="Ldt-Annotation-MashupBegin"></span> - <span class="Ldt-Annotation-MashupEnd"></span>)</span></h3>'
@@ -76,17 +76,12 @@
             return;
         }
         var title = currentAnnotation.title,
-            description = currentAnnotation.description.replace(/(^\s+|\s+$)/g,'');
-        if (currentAnnotation.found) {
-            var rgxp = _this.source.getAnnotations().regexp || /^$/,
-                repl = '<span class="Ldt-Annotation-Highlight">$1</span>';
-            title = title.replace(rgxp,repl);
-            description = description.replace(rgxp,repl).replace(/[\n\r]+/gm,'<br />');
-        }
-        _this.$.find(".Ldt-Annotation-Title").html(title || "(" + _this.l10n.untitled + ")");
+            description = currentAnnotation.description.replace(/(^\s+|\s+$)/g,''),
+            rx = (currentAnnotation.found ? (_this.source.getAnnotations().regexp || false) : false);
+        _this.$.find(".Ldt-Annotation-Title").html(IriSP.textFieldHtml(title,rx)  || "(" + _this.l10n.untitled + ")");
         if (description) {
             _this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock");
-            _this.$.find(".Ldt-Annotation-Description").html(description);
+            _this.$.find(".Ldt-Annotation-Description").html(IriSP.textFieldHtml(description,rx));
         } else {
             _this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock");
         }
@@ -156,7 +151,7 @@
         this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget");
     }
     
-    this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow" }, "arrow");
+    this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow", width: this.width }, "arrow");
     this.onMediaEvent("timeupdate",timeupdate);
     this.onMdpEvent("Annotation.hide","hide");
     this.onMdpEvent("Annotation.show","show");
@@ -172,6 +167,17 @@
     this.source.getAnnotations().on("found", highlightTitleAndDescription);
     this.source.getAnnotations().on("not-found", highlightTitleAndDescription);
     this.source.getAnnotations().on("search-cleared", highlightTitleAndDescription);
+    this.$.find("[draggable]").on("dragstart", function(e) {
+    	var url = (typeof currentAnnotation.url !== "undefined" 
+                ? currentAnnotation.url
+                : (document.location.href.replace(/#.*$/,'') + '#id='  + currentAnnotation.id));
+    	e.originalEvent.dataTransfer.setData("text/x-iri-title",currentAnnotation.title);
+    	e.originalEvent.dataTransfer.setData("text/x-iri-description",currentAnnotation.description);
+    	e.originalEvent.dataTransfer.setData("text/x-iri-uri",url);
+    	if (typeof currentAnnotation.thumbnail !== "undefined" && currentAnnotation.thumbnail) {
+    		e.originalEvent.dataTransfer.setData("text/x-iri-image",currentAnnotation.thumbnail);
+    	}
+    });
 }
 
 IriSP.Widgets.Annotation.prototype.sendBounds = function() {
--- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css	Fri Mar 01 18:05:02 2013 +0100
@@ -28,9 +28,6 @@
 .Ldt-AnnotationsList-li.selected {
     background-image: url(img/pinstripe-grey.png);
 }
-.Ldt-AnnotationsList-highlight {
-    background: #FFA0FC;
-}
 .Ldt-AnnotationsList-ThumbContainer {
     float: left;
     width: 80px;
@@ -57,14 +54,25 @@
     margin: 2px 2px 0 82px;
     font-weight: bold;
 }
-h3.Ldt-AnnotationsList-Title a {
+
+.Ldt-AnnotationsList-Title a {
     color: #0068c4;
 }
+
 p.Ldt-AnnotationsList-Description {
     margin: 2px 0 2px 82px;
     font-size: 12px;
     color: #333333;
 }
+
+.Ldt-AnnotationsList-Description a {
+    color: #0068c4;
+}
+
+.Ldt-AnnotationsList-Description a:hover {
+    text-decoration: underline; color: #800000;
+}
+
 ul.Ldt-AnnotationsList-Tags {
     list-style: none;
     padding: 0;
--- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js	Fri Mar 01 18:05:02 2013 +0100
@@ -65,15 +65,15 @@
 IriSP.Widgets.AnnotationsList.prototype.annotationTemplate = 
     '<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">'
     + '<div class="Ldt-AnnotationsList-ThumbContainer">'
-    + '<a href="{{url}}">'
+    + '<a href="{{url}}" draggable="true">'
     + '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />'
     + '</a>'
     + '</div>'
     + '<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>'
-    + '<h3 class="Ldt-AnnotationsList-Title">'
-    + '<a href="{{url}}">{{title}}</a>'
+    + '<h3 class="Ldt-AnnotationsList-Title" draggable="true">'
+    + '<a href="{{url}}">{{{htitle}}}</a>'
     + '</h3>'
-    + '<p class="Ldt-AnnotationsList-Description">{{description}}</p>'
+    + '<p class="Ldt-AnnotationsList-Description">{{{hdescription}}}</p>'
     + '{{#tags.length}}'
     + '<ul class="Ldt-AnnotationsList-Tags">'
     + '{{#tags}}'
@@ -180,11 +180,12 @@
                             annotationType : _annotation.annotationType.id
                         }
                     )
-                    : '#id=' + _annotation.id
+                    : document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id
                     )
             );
             var _title = (_annotation.title || "").replace(_annotation.description,''),
-                _description = _annotation.description;
+                _description = _annotation.description,
+                _thumbnail = (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail);
             if (!_annotation.title) {
                 _title = _annotation.creator;
             }
@@ -202,11 +203,11 @@
             var _data = {
                 id : _annotation.id,
                 media_id : _annotation.getMedia().id,
-                title : _title,
-                description : _description,
+                htitle : IriSP.textFieldHtml(_title),
+                hdescription : IriSP.textFieldHtml(_description),
                 begin : _annotation.begin.toString(),
                 end : _annotation.end.toString(),
-                thumbnail : typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail,
+                thumbnail : _thumbnail,
                 url : _url,
                 tags : _annotation.getTagTexts(),
                 specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""),
@@ -229,6 +230,14 @@
                     _annotation.trigger("unselect");
                 })
                 .appendTo(_this.list_$);
+            _el.find("[draggable]").on("dragstart", function(e) {
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-title",_title);
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-description",_description);
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-uri",_url);
+	        	if (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail) {
+	        		e.originalEvent.dataTransfer.setData("text/x-iri-image",_annotation.thumbnail);
+	        	}
+	        });
             _el.on("remove", function() {
                 _annotation.off("select", _onselect);
                 _annotation.off("unselect", _onunselect);
@@ -265,10 +274,11 @@
         });
         
         if (this.source.getAnnotations().searching) {
+            var rx = _this.source.getAnnotations().regexp || false;
             this.$.find(".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description").each(function() {
                 var _$ = IriSP.jQuery(this);
-                _$.html(_$.text().replace(/(^\s+|\s+$)/g,'').replace(_this.source.getAnnotations().regexp, '<span class="Ldt-AnnotationsList-highlight">$1</span>'))
-            })
+                _$.html(IriSP.textFieldHtml(_$.text(), rx));
+            });
         }
     }
     
--- a/src/ldt/ldt/static/ldt/metadataplayer/AutoPlayer.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AutoPlayer.js	Fri Mar 01 18:05:02 2013 +0100
@@ -27,7 +27,7 @@
             },
             {
                 regexp: /\.(ogg|ogv|webm)$/,
-                type: "PopcornPlayer"
+                type: "HtmlPlayer"
             },
             {
                 regexp: /^(https?:\/\/)?(www\.)?youtube\.com/,
@@ -57,7 +57,7 @@
     
     if (_opts.type === "AdaptivePlayer") {
         var _canPlayType = document.createElement('video').canPlayType("video/mp4");
-        _opts.type = (_canPlayType == "maybe" || _canPlayType == "probably") ? "PopcornPlayer" : "JwpPlayer";
+        _opts.type = (_canPlayType == "maybe" || _canPlayType == "probably") ? "HtmlPlayer" : "JwpPlayer";
     }
     
     if (_rtmprgx.test(this.video)) {
--- a/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js	Fri Mar 01 18:05:02 2013 +0100
@@ -149,7 +149,7 @@
     if (this.tag_titles && !this.tags) {
         this.tags = IriSP._(this.tag_titles).map(function(_tag_title) {
             var _tag,
-                _tags = _this.source.getTags().searchByTitle(_tag_title);
+                _tags = _this.source.getTags().searchByTitle(_tag_title, true);
             if (_tags.length) {
                 _tag = _tags[0];
             } else {
@@ -370,10 +370,11 @@
         this.recorder.stopRecord();
     }
     
-    var _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */
+    var _this = this,
+        _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */
         _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* Création d'un objet source utilisant un sérialiseur spécifique pour l'export */
         _annotation = new IriSP.Model.Annotation(false, _export), /* Création d'une annotation dans cette source avec un ID généré à la volée (param. false) */
-        _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type), /* Récupération du type d'annotation dans lequel l'annotation doit être ajoutée */
+        _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* Récupération du type d'annotation dans lequel l'annotation doit être ajoutée */
         _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), /* Si le Type d'Annotation n'existe pas, il est créé à la volée */
         _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId}); /* Génération de l'URL à laquelle l'annotation doit être envoyée, qui doit inclure l'ID du projet */
     
@@ -400,8 +401,24 @@
     }
     _annotation.created = new Date(); /* Date de création de l'annotation */
     _annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); /* Champ description */
-    _annotation.setTags(this.$.find(".Ldt-CreateAnnotation-TagLi.selected")
-        .map(function() { return IriSP.jQuery(this).attr("tag-id")})); /*Liste des ids de tags */
+   
+    var tagIds = this.$.find(".Ldt-CreateAnnotation-TagLi.selected")
+        .map(function() { return IriSP.jQuery(this).attr("tag-id")});
+    
+    IriSP._(_annotation.description.match(/#[\w\d]+/g)).each(function(_tt) {
+        var _tag,
+            _tag_title = _tt.replace(/^#/,'')
+            _tags = _this.source.getTags().searchByTitle(_tag_title, true);
+        if (_tags.length) {
+            _tag = _tags[0];
+        } else {
+            _tag = new IriSP.Model.Tag(false, _this.source);
+            _tag.title = _tag_title;
+        }
+        tagIds.push(_tag.id);
+    })
+   
+    _annotation.setTags(IriSP._(tagIds).uniq()); /*Liste des ids de tags */
     if (this.audio_url) {
         _annotation.audio = {
             src: "mic",
--- a/src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js	Fri Mar 01 18:05:02 2013 +0100
@@ -36,7 +36,9 @@
     _opts.flashplayer = IriSP.getLib("jwPlayerSWF");
     _opts["controlbar.position"] = "none";
     _opts.width = this.width;
-    _opts.height = this.height || Math.floor(.643*this.width);
+    if (this.height) {
+        _opts.height = this.height;
+    }
     
     for (var i = 0; i < _props.length; i++) {
         if (typeof this[_props[i]] !== "undefined") {
--- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.css	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.css	Fri Mar 01 18:05:02 2013 +0100
@@ -12,4 +12,8 @@
 /*    font-family: Arial, Helvetica, sans-serif; */
     color: black;
     font-size: 12px;
-}
\ No newline at end of file
+}
+
+.Ldt-Highlight {
+    background: #ffa0fc;
+}
--- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Fri Mar 01 18:05:02 2013 +0100
@@ -126,17 +126,17 @@
     });
     this.$.find('.Ldt-Loader').detach();
     
-    var endload = false;
+    this.widgetsLoaded = false;
     
     this.on("widget-loaded", function() {
-        if (endload) {
+        if (_this.widgetsLoaded) {
             return;
         }
         var isloaded = !IriSP._(_this.widgets).any(function(w) {
             return !(w && w.isLoaded())
         });
         if (isloaded) {
-            endload = true;
+            _this.widgetsLoaded = true;
             _this.trigger("widgets-loaded");
         }
     });   
@@ -246,6 +246,79 @@
     }
 }
 
+IriSP.textFieldHtml = function(_text, _regexp, _extend) {
+    var list = [],
+        positions = [],
+        text = _text.replace(/(^\s+|\s+$)/g,'');
+    
+    function addToList(_rx, _startHtml, _endHtml) {
+        while(true) {
+            var result = _rx.exec(text);
+            if (!result) {
+                break;
+            }
+            var end = _rx.lastIndex,
+                start = result.index;
+            list.push({
+                start: start,
+                end: end,
+                startHtml: (typeof _startHtml === "function" ? _startHtml(result) : _startHtml),
+                endHtml: (typeof _endHtml === "function" ? _endHtml(result) : _endHtml)
+            });
+            positions.push(start);
+            positions.push(end);
+        }
+    }
+    
+    if (_regexp) {
+        addToList(_regexp, '<span class="Ldt-Highlight">', '</span>');
+    }
+    
+    addToList(/(https?:\/\/)?\w+\.\w+\S+/gm, function(matches) {
+        return '<a href="' + (matches[1] ? '' : 'http://') + matches[0] + '" target="_blank">'
+    }, '</a>');
+    addToList(/@([\d\w]{1,15})/gm, function(matches) {
+        return '<a href="http://twitter.com/' + matches[1] + '" target="_blank">'
+    }, '</a>');
+    addToList(/\*[^*]+\*/gm, '<b>', '</b>');
+    addToList(/[\n\r]+/gm, '', '<br />');
+    
+    IriSP._(_extend).each(function(x) {
+        addToList.apply(null, x);
+    });
+    
+    positions = IriSP._(positions)
+        .chain()
+        .uniq()
+        .sortBy(function(p) { return parseInt(p) })
+        .value();
+    
+    var res = "", lastIndex = 0;
+    
+    for (var i = 0; i < positions.length; i++) {
+        var pos = positions[i];
+        res += text.substring(lastIndex, pos);
+        for (var j = list.length - 1; j >= 0; j--) {
+            var item = list[j];
+            if (item.start < pos && item.end >= pos) {
+                res += item.endHtml;
+            }
+        }
+        for (var j = 0; j < list.length; j++) {
+            var item = list[j];
+            if (item.start <= pos && item.end > pos) {
+                res += item.startHtml;
+            }
+        }
+        lastIndex = pos;
+    }
+    
+    res += text.substring(lastIndex);
+    
+    return res;
+    
+}
+
 IriSP.log = function() {
     if (typeof console !== "undefined" && typeof IriSP.logging !== "undefined" && IriSP.logging) {
         console.log.apply(console, arguments);
@@ -272,11 +345,12 @@
     var uidbase = rand16(8) + "-" + rand16(4) + "-", uidincrement = Math.floor(Math.random()*0x10000);
     
     var charsub = [
-        [ 'a', 'á', 'à', 'â', 'ä' ],
-        [ 'c', 'ç' ],
-        [ 'e', 'é', 'è', 'ê', 'ë' ],
-        [ 'i', 'í', 'ì', 'î', 'ï' ],
-        [ 'o', 'ó', 'ò', 'ô', 'ö' ]
+        '[aáàâä]',
+        '[cç]',
+        '[eéèêë]',
+        '[iíìîï]',
+        '[oóòôö]',
+        '[uùûü]'
     ];
     
     var removeChars = [
@@ -324,10 +398,7 @@
             remrx = new RegExp(remsrc,"gm"),
             txt = _text.toLowerCase().replace(remrx,"")
             res = [],
-            charsrc = ns._(charsub).map(function(c) {
-                return "(" + c.join("|") + ")";
-            }),
-            charsrx = ns._(charsrc).map(function(c) {
+            charsrx = ns._(charsub).map(function(c) {
                 return new RegExp(c);
             }),
             src = "";
@@ -336,7 +407,7 @@
                 src += remsrc + "*";
             }
             var l = txt[j];
-            ns._(charsrc).each(function(v, k) {
+            ns._(charsub).each(function(v, k) {
                 l = l.replace(charsrx[k], v);
             });
             src += l;
@@ -476,7 +547,7 @@
  */
 Model.List.prototype.searchByTitle = function(_text, _iexact) {
     var _iexact = _iexact || false,
-        _rgxp = Model.regexpFromTextOrArray(_text, true);
+        _rgxp = Model.regexpFromTextOrArray(_text, true, _iexact);
     return this.filter(function(_element) {
         return _rgxp.test(_element.title);
     });
@@ -484,7 +555,7 @@
 
 Model.List.prototype.searchByDescription = function(_text, _iexact) {
     var _iexact = _iexact || false,
-        _rgxp = Model.regexpFromTextOrArray(_text, true);
+        _rgxp = Model.regexpFromTextOrArray(_text, true, _iexact);
     return this.filter(function(_element) {
         return _rgxp.test(_element.description);
     });
@@ -492,7 +563,7 @@
 
 Model.List.prototype.searchByTextFields = function(_text, _iexact) {
     var _iexact = _iexact || false,
-        _rgxp =  Model.regexpFromTextOrArray(_text, true);
+        _rgxp =  Model.regexpFromTextOrArray(_text, true, _iexact);
     return this.filter(function(_element) {
         var keywords = (_element.keywords || _element.getTagTexts() || []).join(", ");
         return _rgxp.test(_element.description) || _rgxp.test(_element.title) || _rgxp.test(keywords);
@@ -801,6 +872,7 @@
     this.volume = .5;
     this.paused = true;
     this.muted = false;
+    this.loadedMetadata = false;
     var _this = this;
     this.on("play", function() {
         _this.paused = false;
@@ -825,6 +897,9 @@
             _this.trigger("enter-annotation",_a);
         });
     });
+    this.on("loadedmetadata", function() {
+        _this.loadedMetadata = true;
+    })
 }
 
 Model.Playable.prototype = new Model.Element();
@@ -1068,17 +1143,6 @@
 
 Model.Mashup.prototype = new Model.Playable();
 
-Model.Mashup.prototype.checkLoaded = function() {
-    var loaded = !!this.segments.length;
-    this.getMedias().forEach(function(_m) {
-        loaded = loaded && _m.loaded;
-    });
-    this.loaded = loaded;
-    if (loaded) {
-        this.trigger("loadedmetadata");
-    }
-}
-
 Model.Mashup.prototype.updateTimes = function() {
     var _time = 0;
     this.segments.forEach(function(_segment) {
@@ -1446,6 +1510,9 @@
 return Model;
 
 })(IriSP);
+
+/* END model.js */
+
 IriSP.language = 'en';
 
 IriSP.libFiles = {
@@ -1591,8 +1658,16 @@
        _this[_key] = _value;
     });
     
+    this.$ = IriSP.jQuery('#' + this.container);
+    
     if (typeof this.width === "undefined") {
-        this.width = player.config.width;
+        this.width = this.$.width();
+    } else {
+        this.$.css("width", this.width);
+    }
+    
+    if (typeof this.height !== "undefined") {
+        this.$.css("height", this.height);
     }
     
     /* Setting this.player at the end in case it's been overriden
@@ -1601,7 +1676,6 @@
     this.player = player;
     
     /* Adding classes and html attributes */
-    this.$ = IriSP.jQuery('#' + this.container);
     this.$.addClass("Ldt-TraceMe Ldt-Widget").attr("widget-type", _type);
     
     this.l10n = (
--- a/src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js	Fri Mar 01 18:05:02 2013 +0100
@@ -18,16 +18,18 @@
 IriSP.Widgets.Mediafragment.prototype = new IriSP.Widgets.Widget();
 
 IriSP.Widgets.Mediafragment.prototype.draw = function() {
-    this.onMediaEvent("pause","setHashToTime");
+    this.onMediaEvent("setpause","setHashToTime");
     var _this = this;
     this.getWidgetAnnotations().forEach(function(_annotation) {
         _annotation.on("click", function() {
             _this.setHashToAnnotation(_annotation.id);
         })
     });
-    this.player.on("widgets-loaded", function() {
-        _this.goToHash();
-    });
+    if (this.media.loadedMetadata) {
+        this.goToHash();
+    } else {
+        this.onMediaEvent("loadedmetadata","goToHash");
+    }
 }
 
 IriSP.Widgets.Mediafragment.prototype.setWindowHash = function(_hash) {
--- a/src/ldt/ldt/static/ldt/metadataplayer/MultiSegments.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/MultiSegments.js	Fri Mar 01 18:05:02 2013 +0100
@@ -79,7 +79,8 @@
                 line.segmentWidget,
                 IriSP._({
                     type: "Segments",
-                    annotation_type: _anntype
+                    annotation_type: _anntype,
+                    width: _this.width
                 }).extend(segmentsopts)
             );
             
@@ -87,7 +88,8 @@
                 line.annotationWidget,
                 IriSP._({
                     type: "Annotation",
-                    annotation_type: _anntype
+                    annotation_type: _anntype,
+                    width: _this.width
                 }).extend(annotationopts)
             );
             
--- a/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js	Fri Mar 01 18:05:02 2013 +0100
@@ -19,7 +19,7 @@
 IriSP.Widgets.Polemic.prototype.defaults = {
     element_width : 5,
     element_height : 5,
-    max_elements : 15,
+    max_elements: 20,
     annotation_type : "tweet",
     defaultcolor : "#585858",
     foundcolor : "#fc00ff",
@@ -113,7 +113,7 @@
             
             function displayAnnotation(_elx, _ely, _pol, _col, _annotation) {
                 var _html = Mustache.to_html(
-                    '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id={{media_id}}, polemic={{polemic}}" polemic-color="{{color}}"'
+                    '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" draggable="true" trace-info="annotation-id:{{id}}, media-id:{{media_id}}, polemic:{{polemic}}, time:{{time}}" polemic-color="{{color}}"'
                     + ' tweet-title="{{title}}" annotation-id="{{id}}" style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
                 {
                     id: _annotation.id,
@@ -124,7 +124,8 @@
                     color: _col,
                     width: (_this.element_width-1),
                     height: _this.element_height,
-                    title: _annotation.title
+                    title: _annotation.title,
+                    time: _annotation.begin.toString()
                 });
                 var _el = IriSP.jQuery(_html);
                 _el.mouseover(function() {
@@ -133,12 +134,22 @@
                     _annotation.trigger("unselect");
                 }).click(function() {
                     _annotation.trigger("click");
-                });
+                }).on("dragstart", function(e) {
+			    	var url = (typeof _annotation.url !== "undefined" 
+			                ? _annotation.url
+			                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id));
+			        	e.originalEvent.dataTransfer.setData("text/x-iri-title",_annotation.title);
+			        	e.originalEvent.dataTransfer.setData("text/x-iri-description",_annotation.description);
+			        	e.originalEvent.dataTransfer.setData("text/x-iri-uri",url);
+			        	if (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail) {
+			        		e.originalEvent.dataTransfer.setData("text/x-iri-image",_annotation.thumbnail);
+			        	}
+			        });
                 _annotation.on("select", function() {
                     if (_this.tooltip) {
                         _this.tooltip.show(
-                            Math.floor(_elx + (_this.element_width - 1) / 2),
-                            _ely,
+                            + Math.floor(_elx + (_this.element_width - 1) / 2),
+                            + _ely,
                             _annotation.title,
                             _col
                         );
@@ -272,10 +283,10 @@
                     _html = '<p>' + _this.l10n.from_ + _el.attr("begin-time") + _this.l10n._to_ + _el.attr("end-time") + '</p>';
                 for (var _i = 0; _i <= _this.polemics.length; _i++) {
                     var _color = _i ? _this.polemics[_i - 1].color : _this.defaultcolor;
-                    _html += '<div class="Ldt-Tooltip-Color" style="background: ' + _color + '"></div><p>' + _nums[_i] + _this.l10n._annotations + '</p>'
+                    _html += '<div class="Ldt-Tooltip-AltColor" style="background: ' + _color + '"></div><p>' + _nums[_i] + _this.l10n._annotations + '</p>'
                 }
                 if (_this.tooltip) {
-                    _this.tooltip.show(_el.attr("pos-x"), _el.attr("pos-y"), _html);
+                    _this.tooltip.show(+ _el.attr("pos-x"), + _el.attr("pos-y"), _html);
                 }
             })
             .mouseout(function() {
--- a/src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js	Fri Mar 01 18:05:02 2013 +0100
@@ -7,7 +7,6 @@
 /* A Popcorn-based player for HTML5 Video, Youtube and Vimeo */
 
 IriSP.Widgets.PopcornPlayer.prototype.defaults = {
-    aspect_ratio: 14/9
 }
 
 IriSP.Widgets.PopcornPlayer.prototype.draw = function() {
@@ -21,13 +20,6 @@
         this.video = this.url_transform(this.video);
     }
     
-    if (!this.height) {
-        this.height = Math.floor(this.width/this.aspect_ratio);
-        this.$.css({
-                height: this.height
-            });
-    }
-    
     if (/^(https?:\/\/)?(www\.)?vimeo\.com/.test(this.video)) {
         
         /* VIMEO */
@@ -62,7 +54,7 @@
         _videoEl.attr({
             id : _tmpId,
             width : this.width,
-            height : this.height
+            height : this.height || undefined
         });
         if(typeof this.video === "string"){
             _videoEl.attr("src",this.video);
--- a/src/ldt/ldt/static/ldt/metadataplayer/Segments.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Segments.js	Fri Mar 01 18:05:02 2013 +0100
@@ -22,7 +22,7 @@
     + '<div class="Ldt-Segments-Tooltip"></div>';
 
 IriSP.Widgets.Segments.prototype.annotationTemplate =
-    '<div class="Ldt-Segments-Segment Ldt-TraceMe" trace-info="segment-id:{{id}}, media-id:{{media_id}}" segment-text="{{text}}"'
+    '<div class="Ldt-Segments-Segment Ldt-TraceMe" draggable="true" trace-info="segment-id:{{id}}, media-id:{{media_id}}, from:{{from}}, to:{{to}}" segment-text="{{text}}"'
     + 'style="top:{{top}}px; height:{{height}}px; left:{{left}}px; width:{{width}}px; background:{{medcolor}}" data-base-color="{{color}}" data-low-color="{{lowcolor}}" data-medium-color="{{medcolor}}"></div>'
 
 
@@ -83,7 +83,9 @@
             top: _top,
             height: _this.line_height - 1,
             id : _annotation.id,
-            media_id : _annotation.getMedia().id
+            media_id : _annotation.getMedia().id,
+            from: _annotation.begin.toString(),
+            to: _annotation.end.toString()
         };
         var _html = Mustache.to_html(_this.annotationTemplate, _data),
             _el = IriSP.jQuery(_html);
@@ -96,6 +98,17 @@
             .click(function() {
                 _annotation.trigger("click");
             })
+            .on("dragstart", function(e) {
+	    	var url = (typeof _annotation.url !== "undefined" 
+	                ? _annotation.url
+	                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id));
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-title",_annotation.title);
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-description",_annotation.description);
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-uri",url);
+	        	if (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail) {
+	        		e.originalEvent.dataTransfer.setData("text/x-iri-image",_annotation.thumbnail);
+	        	}
+	        })
             .appendTo(list_$)
         _annotation.on("select", function() {
             _this.$segments.each(function() {
--- a/src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js	Fri Mar 01 18:05:02 2013 +0100
@@ -9,16 +9,14 @@
 IriSP.Widgets.Slideshare.prototype.defaults = {
     annotation_type: "slide",
     sync: true,
-    embed_width: 400,
-    embed_height: 300
 }
 
 IriSP.Widgets.Slideshare.prototype.messages = {
     fr: {
-        slides_ : "Diapositives&nbsp;:"
+        slides_ : "Diapositives"
     },
     en: {
-        slides_ : "Slides:"
+        slides_ : "Slides"
     }
 }
 
@@ -27,14 +25,9 @@
 
 IriSP.Widgets.Slideshare.prototype.draw = function() {
     
-    var _embedObject = null,
-        $container,
-        _lastEmbedded = "",
-        _this = this;
-    
     function insertSlideshare(_presentation, _slide) {
         if (_lastEmbedded === _presentation) {
-            if (_.embedObject && typeof _embedObject.jumpTo === "function") {
+            if (_embedObject && typeof _embedObject.jumpTo === "function") {
                 _embedObject.jumpTo(parseInt(_slide));
             }
         } else {
@@ -75,8 +68,13 @@
         var _lastPres = "",
             _embedObject = null,
             _oembedCache = {},
-            _this = this;
-        $container = this.$.find(".Ldt-SlideShare-Container");
+            _lastEmbedded = "",
+            _this = this
+            $container = this.$.find(".Ldt-SlideShare-Container");
+            
+        this.embed_width = this.embed_width || $container.innerWidth();
+        this.embed_height = this.embed_height || Math.floor(this.embed_width * 3/4);
+        
         _annotations.forEach(function(_a) {
             _a.on("leave", function() {
                 $container.hide();
--- a/src/ldt/ldt/static/ldt/metadataplayer/Social.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Social.js	Fri Mar 01 18:05:02 2013 +0100
@@ -18,7 +18,7 @@
 }
 
 IriSP.Widgets.Social.prototype.template =
-    '<span class="Ldt-Social">{{#show_url}}<div class="Ldt-Social-Url-Container"><a href="#" target="_blank" class="Ldt-Social-Square Ldt-Social-Url Ldt-TraceMe" title="{{l10n.share_link}}">'
+    '<span class="Ldt-Social">{{#show_url}}<div class="Ldt-Social-Url-Container"><a href="#" draggable="true" target="_blank" class="Ldt-Social-Square Ldt-Social-Url Ldt-TraceMe" title="{{l10n.share_link}}">'
     + '</a><div class="Ldt-Social-UrlPop"><input class="Ldt-Social-Input"/><div class="Ldt-Social-CopyBtn">{{l10n.copy}}</div></div></div>{{/show_url}}'
     + '{{#show_fb}}<a href="#" target="_blank" class="Ldt-Social-Fb Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Facebook"></a>{{/show_fb}}'
     + '{{#show_twitter}}<a href="#" target="_blank" class="Ldt-Social-Twitter Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Twitter"></a>{{/show_twitter}}'
@@ -48,6 +48,9 @@
     this.$.find(".Ldt-Social-Url").click(function() {
         _this.toggleCopy();
         return false;
+    }).on("dragstart", function(e) {
+    	e.originalEvent.dataTransfer.setData("text/x-iri-title",_this.text);
+    	e.originalEvent.dataTransfer.setData("text/x-iri-uri",_this.url);
     });
     this.$.find(".Ldt-Social-Input").focus(function() {
         this.select();
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.css	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.css	Fri Mar 01 18:05:02 2013 +0100
@@ -108,6 +108,10 @@
     float: left; margin: 8px 2px 2px 8px; width: 10px; height: 10px;
 }
 
+.Ldt-Tooltip-AltColor {
+    float: left; margin: 2px 2px 2px 3px; width: 10px; height: 10px;
+}
+
 .Ldt-Tooltip img {
     max-width: 140px; max-height: 80px; margin: 2px 20px;
 }
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.js	Fri Mar 01 18:05:02 2013 +0100
@@ -56,8 +56,8 @@
         shift = Math.max(x - this.__halfWidth - this.min_x, - this.__maxShift);
     }
     
-    if (typeof this.max_x !== "undefined" && (x + this.__halfWidth > this.max_x)) {
-        shift = Math.min(x + this.__halfWidth - this.max_x, this.__maxShift);
+    if (typeof this.max_x !== "undefined" && (+x + this.__halfWidth > this.max_x)) {
+        shift = Math.min(+ x + this.__halfWidth - this.max_x, this.__maxShift);
     }
     
     this.$tooltip.css({
--- a/src/ldt/ldt/static/ldt/metadataplayer/Trace.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Trace.js	Fri Mar 01 18:05:02 2013 +0100
@@ -29,6 +29,10 @@
         "play" : 0,
         "pause" : 0,
         "timeupdate" : 10000
+    },
+    _annlisteners = {
+        search: 0,
+        "search-cleared": 0
     };
     IriSP._(_medialisteners).each(function(_ms, _listener) {
         var _f = function(_arg) {
@@ -39,6 +43,16 @@
         }
         _this.media.on(_listener, _f);
     });
+    var _annotations = this.source.getAnnotations();
+    IriSP._(_annlisteners).each(function(_ms, _listener) {
+        var _f = function(_arg) {
+            _this.eventHandler(_listener, _arg);
+        }
+        if (_ms) {
+            _f = IriSP._.throttle(_f, _ms);
+        }
+        _annotations.on(_listener, _f);
+    });
     
     if (!this.tracer) {
     
@@ -51,6 +65,8 @@
     
     }
     
+    
+    
     this.tracer.trace("TraceWidgetInit", {});
     
     this.mouseLocation = '';
@@ -60,8 +76,6 @@
         var _widget = _target.attr("widget-type") || _target.parents(".Ldt-Widget").attr("widget-type"),
             _data = {
                 "type": _e.type,
-                "x": _e.clientX,
-                "y": _e.clientY,
                 "widget": _widget
             },
             _targetEl = _target[0],
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js	Wed Jan 16 05:34:21 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js	Fri Mar 01 18:05:02 2013 +0100
@@ -6,7 +6,7 @@
 IriSP.Widgets.Tweet.prototype = new IriSP.Widgets.Widget();
 
 IriSP.Widgets.Tweet.prototype.defaults = {
-    hide_timeout: 5000,
+    hide_timeout: 10000,
     polemics : [
         {
             "keywords" : [ "++" ],
@@ -93,87 +93,51 @@
 
 IriSP.Widgets.Tweet.prototype.show = function(_tweet) {
     if (typeof _tweet !== "undefined" && typeof _tweet.source !== "undefined") {
-        var _entities = [];
-        for (var _i = 0; _i < _tweet.source.entities.hashtags.length; _i++) {
-            var _hash = _tweet.source.entities.hashtags[_i];
-            _entities.push({
-                is_link: true,
-                text: '#' + _hash.text,
-                url: 'http://twitter.com/search?q=%23' + encodeURIComponent(_hash.text),
-                indices: _hash.indices
-            });
-        }
-        for (var _i = 0; _i < _tweet.source.entities.urls.length; _i++) {
-            var _url = _tweet.source.entities.urls[_i],
-                _displayurl = (typeof _url.display_url !== "undefined" && _url.display_url !== null ? _url.display_url : _url.url),
-                _linkurl = (typeof _url.expanded_url !== "undefined" && _url.expanded_url !== null ? _url.expanded_url : _url.url);
-            _displayurl = _displayurl.replace(/^\w+:\/\//,'');
-            if (!/^\w+:\/\//.test(_linkurl)) {
-                _linkurl = 'http://' + _linkurl;
-            }
-            _entities.push({
-                is_link: true,
-                text: _displayurl,
-                url: _linkurl,
-                indices: _url.indices
-            });
-        }
-        for (var _i = 0; _i < _tweet.source.entities.user_mentions.length; _i++) {
-            var _user = _tweet.source.entities.user_mentions[_i];
-            _entities.push({
-                is_link: true,
-                text: '@' + _user.screen_name,
-                url: 'http://twitter.com/' + encodeURIComponent(_user.screen_name),
-                indices: _user.indices
-            });
-        }
-        for (var _i = 0; _i < this.polemics.length; _i++) {
-            for (var _j = 0; _j < this.polemics[_i].keywords.length; _j++) {
-                var _p = _tweet.source.text.indexOf(this.polemics[_i].keywords[_j]);
-                while (_p !== -1) {
-                    var _end = (_p + this.polemics[_i].keywords[_j].length);
-                    _entities.push({
-                        is_link: false,
-                        text: this.polemics[_i].keywords[_j],
-                        color: this.polemics[_i].color,
-                        indices: [_p, _end]
-                    });
-                    _p = _tweet.source.text.indexOf(this.polemics[_i].keywords[_j], _end);
-                }
-            }
-        }
-        _entities = IriSP._(_entities).sortBy(function(_entity) {
+        var extend = [
+            [
+                /#(\w+)/gm,
+                function(matches) {
+                    return '<a href="http://twitter.com/search?q=%23' + matches[1] + '" target="_blank">'
+                },
+                '</a>'
+            ]
+        ];
+        var _urls = IriSP._(_tweet.source.entities.urls).sortBy(function(_entity) {
             return _entity.indices[0];
         });
+        
         var _currentPos = 0,
             _txt = '';
-        for (var _i = 0; _i < _entities.length; _i++) {
-            if (_entities[_i].indices[0] >= _currentPos) {
-                _txt += _tweet.source.text.substring(_currentPos, _entities[_i].indices[0]);
-                _currentPos = _entities[_i].indices[1];
-                if (_entities[_i].is_link) {
-                    _txt += '<a href="' + _entities[_i].url + '" target="_blank">';
-                } else {
-                    _txt += '<span style="background:' + _entities[_i].color + '">';
-                }
-                _txt += _entities[_i].text;
-                if (_entities[_i].is_link) {
-                    _txt += '</a>';
-                } else {
-                    _txt += '</span>';
-                }
+        IriSP._(_urls).each(function(_url) {
+            if (_url.indices[0] >= _currentPos) {
+                _txt += _tweet.source.text.substring(_currentPos, _url.indices[0]);
+                _txt += (typeof _url.expanded_url !== "undefined" && _url.expanded_url !== null ? _url.expanded_url : _url.url);
+                _currentPos = _url.indices[1];
             }
-        }
+        });
         _txt += _tweet.source.text.substring(_currentPos);
-        this.$.find(".Ldt-Tweet-Avatar").attr("src",_tweet.source.user.profile_image_url);
-        this.$.find(".Ldt-Tweet-ScreenName").html('@'+_tweet.source.user.screen_name);
-        this.$.find(".Ldt-Tweet-ProfileLink").attr("href", "https://twitter.com/" + _tweet.source.user.screen_name);
-        this.$.find(".Ldt-Tweet-FullName").html(_tweet.source.user.name);
-        this.$.find(".Ldt-Tweet-Contents").html(_txt);
+        
+        for (var _i = 0; _i < this.polemics.length; _i++) {
+            var rx = IriSP.Model.regexpFromTextOrArray(this.polemics[_i].keywords);
+            extend.push([
+                rx,
+                '<span style="background: ' + this.polemics[_i].color + '">',
+                '</span>'
+            ]);
+        }
+        var rx = (_tweet.found ? (_this.source.getAnnotations().regexp || false) : false),
+            profile_url = _tweet.source.user ? _tweet.source.user.profile_image_url : _tweet.source.profile_image_url,
+            screen_name = _tweet.source.user ? _tweet.source.user.screen_name :_tweet.source.from_user,
+            user_name = _tweet.source.user ? _tweet.source.user.name :_tweet.source.from_user_name;
+        this.$.find(".Ldt-Tweet-Avatar").attr("src", profile_url);
+        this.$.find(".Ldt-Tweet-ScreenName").html('@' + screen_name);
+        this.$.find(".Ldt-Tweet-ProfileLink").attr("href", "https://twitter.com/" + screen_name);
+        this.$.find(".Ldt-Tweet-FullName").html(user_name);
+        this.$.find(".Ldt-Tweet-Contents").html(IriSP.textFieldHtml(_txt, rx, extend));
         this.$.find(".Ldt-Tweet-Time").html(this.l10n.original_time + new Date(_tweet.source.created_at).toLocaleTimeString() + " / " + this.l10n.video_time + _tweet.begin.toString());
         this.$.find(".Ldt-Tweet-Retweet").attr("href", "https://twitter.com/intent/retweet?tweet_id=" + _tweet.source.id_str);
         this.$.find(".Ldt-Tweet-Reply").attr("href", "https://twitter.com/intent/tweet?in_reply_to=" + _tweet.source.id_str);
-        this.$.find(".Ldt-Tweet-Original").attr("href", "https://twitter.com/" + _tweet.source.user.screen_name + "/status/" + _tweet.source.id_str);
+        this.$.find(".Ldt-Tweet-Original").attr("href", "https://twitter.com/" + screen_name + "/status/" + _tweet.source.id_str);
         this.player.trigger("Annotation.minimize");
         this.$.slideDown();
         this.cancelTimeout();