Added Trace information V01.95
authorRaphael Velt <raph.velt@gmail.com>
Wed, 25 Jul 2012 18:03:07 +0200
changeset 668 eb7e39c732c6
parent 667 b6b48e73d440
child 669 42157d120519
Added Trace information
web/res/metadataplayer/AnnotationsList.js
web/res/metadataplayer/Polemic.js
web/res/metadataplayer/Segments.js
web/res/metadataplayer/Trace.js
--- a/web/res/metadataplayer/AnnotationsList.js	Tue Jul 24 18:01:16 2012 +0200
+++ b/web/res/metadataplayer/AnnotationsList.js	Wed Jul 25 18:03:07 2012 +0200
@@ -47,7 +47,7 @@
     '<div class="Ldt-AnnotationsListWidget">'
     + '<ul class="Ldt-AnnotationsList-ul">'
     + '{{#annotations}}'
-    + '<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}" style="{{specific_style}}">'
+    + '<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}}">'
     + '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />'
@@ -206,6 +206,7 @@
                     });
                     var _res = {
                         id : _annotation.id,
+                        media_id : _annotation.getMedia().id,
                         title : _title,
                         description : _description,
                         begin : _annotation.begin.toString(),
--- a/web/res/metadataplayer/Polemic.js	Tue Jul 24 18:01:16 2012 +0200
+++ b/web/res/metadataplayer/Polemic.js	Wed Jul 25 18:03:07 2012 +0200
@@ -25,18 +25,22 @@
     foundcolor : "#fc00ff",
     polemics : [
         {
+            "name" : "OK",
             "keywords" : [ "++" ],
             "color" : "#1D973D"
         },
         {
+            "name" : "KO",
             "keywords" : [ "--" ],
             "color" : "#CE0A15"
         },
         {
+            "name" : "REF",
             "keywords" : [ "==", "http://" ],
             "color" : "#C5A62D"  
         },
         {
+            "name" : "Q",
             "keywords" : [ "?" ],
             "color" : "#036AAE"
         }
@@ -144,12 +148,14 @@
             var _x = 0,
                 _html = '';
             
-            function displayElement(_x, _y, _color, _id, _title) {
+            function displayElement(_x, _y, _color, _id, _title, _polemic) {
                 _html += Mustache.to_html(
-                    '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-id:{{id}}" annotation-id="{{id}}" tweet-title="{{title}}" pos-x="{{posx}}" pos-y="{{top}}" polemic-color="{{color}}"'
+                    '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id={{media_id}}, polemic={{polemic}}" annotation-id="{{id}}" tweet-title="{{title}}" pos-x="{{posx}}" pos-y="{{top}}" polemic-color="{{color}}"'
                     + ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
                 {
                     id: _id,
+                    media_id: _this.source.currentMedia.id,
+                    polemic: _polemic,
                     title: _title,
                     posx: Math.floor(_x + (_this.element_width - 1) / 2),
                     left: _x,
@@ -164,13 +170,14 @@
                 var _y = _this.height;
                 _slice.annotations.forEach(function(_annotation) {
                     _y -= _this.element_height;
-                    displayElement(_x, _y, _this.defaultcolor, _annotation.id, _annotation.title);
+                    displayElement(_x, _y, _this.defaultcolor, _annotation.id, _annotation.title, "none");
                 });
                 IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
-                    var _color = _this.polemics[_j].color;
+                    var _color = _this.polemics[_j].color,
+                        _polemic = _this.polemics[_j].name;
                     _annotations.forEach(function(_annotation) {
                         _y -= _this.element_height;
-                        displayElement(_x, _y, _color, _annotation.id, _annotation.title);
+                        displayElement(_x, _y, _color, _annotation.id, _annotation.title, _polemic);
                     });
                 });
                 _x += _this.element_width;
@@ -215,13 +222,15 @@
             _html = '',
             _scale = this.max_elements * this.element_height / _max;
             
-        function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end) {
+        function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end, _polemic) {
             _html += Mustache.to_html(
-                '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-block,time:{{begin}}" pos-x="{{posx}}" pos-y="{{top}}" annotation-counts="{{nums}}" begin-time="{{begin}}" end-time="{{end}}"'
+                '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-block, media-id={{media_id}}, polemic={{polemic}}, time:{{begin}}" pos-x="{{posx}}" pos-y="{{top}}" annotation-counts="{{nums}}" begin-time="{{begin}}" end-time="{{end}}"'
                 + ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
             {
                 nums: _nums,
                 posx: Math.floor(_x + (_this.element_width - 1) / 2),
+                media_id: _this.source.currentMedia.id,
+                polemic: _polemic,
                 left: _x,
                 top: _y,
                 color: _color,
@@ -240,14 +249,15 @@
             if (_slice.annotations.length) {
                 var _h = Math.ceil(_scale * _slice.annotations.length);
                 _y -= _h;
-                displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end);
+                displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end, "none");
             }
             IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
                 if (_annotations.length) {
                     var _color = _this.polemics[_j].color,
+                        _polemic = _this.polemics[_j].name,
                         _h = Math.ceil(_scale * _annotations.length);
                     _y -= _h;
-                    displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end);
+                    displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end, _polemic);
                 }
             });
             _x += _this.element_width;
--- a/web/res/metadataplayer/Segments.js	Tue Jul 24 18:01:16 2012 +0200
+++ b/web/res/metadataplayer/Segments.js	Wed Jul 25 18:03:07 2012 +0200
@@ -14,7 +14,7 @@
 
 IriSP.Widgets.Segments.prototype.template =
     '<div class="Ldt-Segments-List">{{#segments}}'
-    + '<div class="Ldt-Segments-Segment Ldt-TraceMe" trace-info="segment-id:{{id}}" segment-id="{{id}}" segment-text="{{text}}" segment-color="{{color}}" center-pos="{{center}}" begin-seconds="{{beginseconds}}"'
+    + '<div class="Ldt-Segments-Segment Ldt-TraceMe" trace-info="segment-id:{{id}}, media-id:{{media_id}}" segment-id="{{id}}" segment-text="{{text}}" segment-color="{{color}}" center-pos="{{center}}" begin-seconds="{{beginseconds}}"'
     + 'style="left:{{left}}px; width:{{width}}px; background:{{color}}"></div>'
     + '{{/segments}}</div>'
     + '<div class="Ldt-Segments-Position"></div>'
@@ -41,13 +41,14 @@
                 _center = _left + _width / 2,
                 _fulltext = _annotation.title + ( _annotation.description ? ( '<br/>' + _annotation.description ) : '' );
             return {
-                text : _fulltext.replace(/(^.{120,140})[\s].+$/,'$1&hellip;'),
+                text : _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1&hellip;'),
                 color : ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.colors[_k % _this.colors.length] ),
                 beginseconds : _annotation.begin.getSeconds() ,
                 left : Math.floor( _left ),
                 width : Math.floor( _width ),
                 center : Math.floor( _center ),
-                id : _annotation.id
+                id : _annotation.id,
+                media_id : _annotation.getMedia().id
             }
         })
     }));
--- a/web/res/metadataplayer/Trace.js	Tue Jul 24 18:01:16 2012 +0200
+++ b/web/res/metadataplayer/Trace.js	Wed Jul 25 18:03:07 2012 +0200
@@ -85,7 +85,7 @@
             _traceInfo = _target.attr("trace-info"),
             _lastTarget = _name + (_id && _id.length ? '#' + IriSP.jqEscape(_id) : '') + (_class && _class.length ? ('.' + IriSP.jqEscape(_class).replace(/\s/g,'.')).replace(/\.Ldt-(Widget|TraceMe)/g,'') : '');
         _data.target = _lastTarget
-        if (typeof _traceInfo == "string" && _traceInfo.length && _traceInfo.length < 140) {
+        if (typeof _traceInfo == "string" && _traceInfo.length) {
             _data.traceInfo = _traceInfo;
             _lastTarget += ( ";" + _traceInfo );
         }