--- 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…'),
+ text : _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1…'),
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
}
})
}));