diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/Annotation.js --- a/src/widgets/Annotation.js Tue May 15 15:50:19 2012 +0200 +++ b/src/widgets/Annotation.js Fri May 18 18:23:51 2012 +0200 @@ -35,7 +35,7 @@ + '

{{l10n.excerpt_from}} ' + '( - )

' + '

' - + '
{{l10n.tags}}
'; + + '
{{l10n.tags}}
'; IriSP.Widgets.Annotation.prototype.defaults = { annotation_type : "chap", @@ -86,6 +86,18 @@ }).join(""); this.$.find(".Ldt-Annotation-Tags").html(_html); this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-NoTags"); + + /* Correct the empty tag bug */ + this.$.find('.Ldt-Annotation-TagLabel').each(function() { + var _el = IriSP.jQuery(this); + if (!_el.text().replace(/(^\s+|\s+$)/g,'')) { + _el.detach(); + } + }); + + this.$.find('.Ldt-Annotation-TagLabel').click(function() { + _this.player.popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); + }); } else { this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-NoTags"); }