update widgets after enhance in annotation platform.
--- a/src/widgets/AnnotationsList.js Fri Oct 25 01:32:13 2013 +0200
+++ b/src/widgets/AnnotationsList.js Thu Jan 02 16:54:22 2014 +0100
@@ -183,15 +183,19 @@
: document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id
)
);
- var _title = (_annotation.title || "").replace(_annotation.description,''),
+ var _title = "",
_description = _annotation.description,
_thumbnail = (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail);
- if (!_annotation.title) {
- _title = _annotation.creator;
+ // Update : display creator
+ if (_annotation.creator) {
+ _title = _annotation.creator;
}
- if (!_annotation.description && _annotation.creator) {
- _description = _annotation.title;
- _title = _annotation.creator;
+ if (_annotation.title) {
+ var tempTitle = _annotation.title;
+ if( tempTitle.substr(0, _title.length + 1) == (_title + ":") ){
+ _title = "";
+ }
+ _title = _title + ( (_title=="") ? "" : ": ") + _annotation.title;
}
var _bgcolor;
IriSP._(_this.polemics).each(function(_polemic) {
--- a/src/widgets/Arrow.js Fri Oct 25 01:32:13 2013 +0200
+++ b/src/widgets/Arrow.js Thu Jan 02 16:54:22 2014 +0100
@@ -25,6 +25,7 @@
overflow: "hidden"
});
this.paper = new Raphael(this.container, this.width, 1+this.height );
+ window.myArrow = this;
this.svgArrow = this.paper.path('M0,' + this.height + 'L' + this.width + ',' + this.height);
this.svgArrow.attr({
stroke: this.stroke_color,
--- a/src/widgets/CreateAnnotation.js Fri Oct 25 01:32:13 2013 +0200
+++ b/src/widgets/CreateAnnotation.js Thu Jan 02 16:54:22 2014 +0100
@@ -56,7 +56,7 @@
at_time: "at",
submit: "Submit",
add_keywords_: "Add keywords:",
- add_polemic_keywords_: "Add polemic keywords:",
+ add_polemic_keywords_: "Add polemic attributes :",
your_name_: "Your name:",
annotate_video: "Annotate this video",
type_title: "Annotation title",
@@ -77,7 +77,7 @@
at_time: "à",
submit: "Envoyer",
add_keywords_: "Ajouter des mots-clés\u00a0:",
- add_polemic_keywords_: "Ajouter des mots-clés polémiques\u00a0:",
+ add_polemic_keywords_: "Ajouter des attributs polémiques\u00a0:",
your_name_: "Votre nom\u00a0:",
annotate_video: "Annoter cette vidéo",
type_title: "Titre de l'annotation",
@@ -150,18 +150,24 @@
this.tag_prefix = this.tag_prefix || "";
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, true);
- if (_tags.length) {
- _tag = _tags[0];
- } else {
- _tag = new IriSP.Model.Tag(false, _this.source);
- _this.source.getTags().push(_tag);
- _tag.title = _tag_title;
- }
- return _tag;
- });
+ if(!(this.tag_titles.length==1 && this.tag_titles[0]=="")){
+ this.tags = IriSP._(this.tag_titles).map(function(_tag_title) {
+ var _tag,
+ _tags = _this.source.getTags().searchByTitle(_tag_title, true);
+ if (_tags.length) {
+ _tag = _tags[0];
+ } else {
+ _tag = new IriSP.Model.Tag(false, _this.source);
+ _this.source.getTags().push(_tag);
+ _tag.title = _tag_title;
+ }
+ return _tag;
+ });
+ }
+ else{
+ // we forced no tags if this.tag_titles = [''] (and not false)
+ this.tags = true;
+ }
}
if (!this.tags) {
this.tags = this.source.getTags()
--- a/src/widgets/MultiSegments.js Fri Oct 25 01:32:13 2013 +0200
+++ b/src/widgets/MultiSegments.js Thu Jan 02 16:54:22 2014 +0100
@@ -6,7 +6,7 @@
IriSP.Widgets.MultiSegments.prototype.defaults = {
annotation_show_arrow: true,
- annotation_start_minimized: true,
+ annotation_start_minimized: false,
annotation_show_annotation_type: true,
show_all: false
};
@@ -96,10 +96,26 @@
lines.push(line);
}
});
- var _annotationWidgets = _this.$.find(".Ldt-MultiSegments-Annotation");
+
+ // open line on segment click
+ $j(document).on("click",".Ldt-Segments-Segment",function(e){
+ if (!_this.show_all && currentLine && !currentLine.hasSegmentsNow()) {
+ currentLine = undefined;
+ }
+ IriSP._(lines).each(function(line) {
+ if($j(e.target).parent().parent()[0]==line.segmentWidget[0]){
+ currentLine = line;
+ line.show();
+ } else {
+ line.hide();
+ }
+ });
+ });
+
+ //var _annotationWidgets = _this.$.find(".Ldt-MultiSegments-Annotation");
function checkVisibilities(_time) {
- if (!_this.show_all && currentLine && !currentLine.hasSegmentsNow()) {
+ /*if (!_this.show_all && currentLine && !currentLine.hasSegmentsNow()) {
currentLine = undefined;
}
IriSP._(lines).each(function(line) {
@@ -115,8 +131,6 @@
} else {
line.hide();
}
- });
+ });*/
}
-
- this.onMediaEvent("timeupdate", checkVisibilities);
};
\ No newline at end of file
--- a/src/widgets/Polemic.js Fri Oct 25 01:32:13 2013 +0200
+++ b/src/widgets/Polemic.js Thu Jan 02 16:54:22 2014 +0100
@@ -22,7 +22,6 @@
element_height : 5,
max_elements: 20,
annotation_type : "tweet",
- only_allow_zero_duration_annotations: true,
defaultcolor : "#585858",
foundcolor : "#fc00ff",
polemics : [
@@ -68,18 +67,13 @@
this.$zone.append(this.$elapsed);
+ // we don't filter with null duration anymore
var _slices = [],
_slice_count = Math.floor( this.width / this.element_width ),
_duration = this.source.getDuration(),
_max = 0,
- _this = this,
- _list = this.getWidgetAnnotations();
-
- if (this.only_allow_zero_duration_annotations) {
- _list = _list.filter(function(_a) {
- return !_a.getDuration().milliseconds;
- });
- }
+ _list = this.getWidgetAnnotations(),
+ _this = this;
for (var _i = 0; _i < _slice_count; _i++) {
var _begin = new IriSP.Model.Time( _i * _duration / _slice_count ),
@@ -145,20 +139,28 @@
return false;
});
IriSP.attachDndData(_el, {
- title: _annotation.title,
- description: _annotation.description,
- image: _annotation.thumbnail,
- uri: (typeof _annotation.url !== "undefined"
- ? _annotation.url
- : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id))
+ title: _annotation.title,
+ description: _annotation.description,
+ image: _annotation.thumbnail,
+ uri: (typeof _annotation.url !== "undefined"
+ ? _annotation.url
+ : (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id))
});
+ // test if annotation has several colors.
+ var colAr = [];
+ for (var _j = 0; _j < _this.polemics.length; _j++) {
+ if( IriSP.Model.regexpFromTextOrArray( _this.polemics[_j].keywords ).test( _annotation.title ) ){
+ colAr.push(_this.polemics[_j].color);
+ }
+ }
+ // display annotation
_annotation.on("select", function() {
if (_this.tooltip) {
_this.tooltip.show(
+ Math.floor(_elx + (_this.element_width - 1) / 2),
+ _ely,
_annotation.title,
- _col
+ ( (colAr.length>1) ? colAr : _col )
);
}
_this.$tweets.each(function() {
--- a/src/widgets/Slider.css Fri Oct 25 01:32:13 2013 +0200
+++ b/src/widgets/Slider.css Thu Jan 02 16:54:22 2014 +0100
@@ -15,5 +15,5 @@
.Ldt-Slider-Time {
position: absolute; top: -16px; background: #ffffc0; color: #000000; border-radius: 3px; z-index: 8;
font-size: 10px; width: 34px; border: 1px solid #999999; padding: 1px; margin-left: -20px;
- display: none; text-align: center; font-weight: bold;
+ display: none; text-align: center; font-weight: bold; pointer-events: none;
}
--- a/src/widgets/Slider.js Fri Oct 25 01:32:13 2013 +0200
+++ b/src/widgets/Slider.js Thu Jan 02 16:54:22 2014 +0100
@@ -10,7 +10,7 @@
IriSP.Widgets.Slider.prototype.defaults = {
minimized_height : 4,
- maximized_height : 10,
+ maximized_height : 4,
minimize_timeout : 1500 /* time before minimizing slider after mouseout,
set to zero for fixed slider */
};
--- a/src/widgets/Tooltip.js Fri Oct 25 01:32:13 2013 +0200
+++ b/src/widgets/Tooltip.js Thu Jan 02 16:54:22 2014 +0100
@@ -28,7 +28,7 @@
this.$tip = this.$.find(".Ldt-Tooltip-Tip");
this.$sw = this.$.find(".Ldt-Tooltip-Border-SW");
this.$se = this.$.find(".Ldt-Tooltip-Border-SE");
- this.__halfWidth = Math.floor(this.$.find(".Ldt-Tooltip-Main").width()/2);
+ this.__halfWidth = Math.floor(( this.$.find(".Ldt-Tooltip-Main").width() || 192)/2);
this.__borderWidth = this.$.find(".Ldt-Tooltip-Border-Left").width();
this.__tipDelta = this.__halfWidth - Math.floor(this.$tip.width()/2);
this.__maxShift = this.__tipDelta - this.__borderWidth;
@@ -41,7 +41,21 @@
IriSP.Widgets.Tooltip.prototype.show = function(x, y, text, color) {
if (typeof color !== "undefined") {
- this.$.find(".Ldt-Tooltip-Color").show().css("background-color", color);
+ // one color or array of colors
+ if (typeof color === "string") {
+ this.$.find(".Ldt-Tooltip-Color").html("");
+ this.$.find(".Ldt-Tooltip-Color").show().css("background-color", color);
+ this.$.find(".Ldt-Tooltip-Color").show().css("height", "");
+ }
+ else{
+ var d = this.$.find(".Ldt-Tooltip-Color");
+ d.html("");
+ d.show();
+ for(var i=0; i<color.length; i++){
+ d.append('<div style="float: left; height: 10px; width: 10px; background-color: ' + color[i] + '">')
+ }
+ this.$.find(".Ldt-Tooltip-Color").css("height", (color.length * 10) + "px");
+ }
} else {
this.$.find(".Ldt-Tooltip-Color").hide();
}