src/widgets/Segments.js
changeset 1033 c20df1c080e6
parent 1026 420608a77566
child 1044 d8339b45edc4
equal deleted inserted replaced
1032:74ac0be7655c 1033:c20df1c080e6
    11     colors: ["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],
    11     colors: ["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],
    12     line_height: 8,
    12     line_height: 8,
    13     background: "#e0e0e0",
    13     background: "#e0e0e0",
    14     overlap: .25,
    14     overlap: .25,
    15     found_color: "#FF00FC",
    15     found_color: "#FF00FC",
    16     faded_found_color: "#ff80fc"
    16     faded_found_color: "#ff80fc",
       
    17     // Display creator info in segment tooltip
       
    18     show_creator: true
    17 };
    19 };
    18 
    20 
    19 IriSP.Widgets.Segments.prototype.template =
    21 IriSP.Widgets.Segments.prototype.template =
    20     '<div class="Ldt-Segments-List"></div>'
    22     '<div class="Ldt-Segments-List"></div>'
    21     + '<div class="Ldt-Segments-Position"></div>'
    23     + '<div class="Ldt-Segments-Position"></div>'
    75             lowcolor = saturate(r, g, b, .2);
    77             lowcolor = saturate(r, g, b, .2);
    76         var _data = {
    78         var _data = {
    77             color : color,
    79             color : color,
    78             medcolor: medcolor,
    80             medcolor: medcolor,
    79             lowcolor: lowcolor,
    81             lowcolor: lowcolor,
    80             text: (_annotation.creator ? (_annotation.creator + " : ") : "" ) + _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1&hellip;'),
    82             text: ((_this.show_creator && _annotation.creator) ? (_annotation.creator + " : ") : "" ) + _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1&hellip;'),
    81             left : _left,
    83             left : _left,
    82             width : _width,
    84             width : _width,
    83             top: _top,
    85             top: _top,
    84             height: _this.line_height - 1,
    86             height: _this.line_height - 1,
    85             id : _annotation.id,
    87             id : _annotation.id,
    87             from: _annotation.begin.toString(),
    89             from: _annotation.begin.toString(),
    88             to: _annotation.end.toString()
    90             to: _annotation.end.toString()
    89         };
    91         };
    90         var _html = Mustache.to_html(_this.annotationTemplate, _data),
    92         var _html = Mustache.to_html(_this.annotationTemplate, _data),
    91             _el = IriSP.jQuery(_html);
    93             _el = IriSP.jQuery(_html);
    92         _el.mouseover(function() {
    94             _el.mouseover(function() {
    93                 _annotation.trigger("select");
    95                 _annotation.trigger("select");
       
    96                 _this.player.trigger('annotation-select', _annotation);
    94             })
    97             })
    95             .mouseout(function() {
    98             .mouseout(function() {
    96                 _annotation.trigger("unselect");
    99                 _annotation.trigger("unselect");
       
   100                 _this.player.trigger('annotation-unselect', _annotation);
    97             })
   101             })
    98             .click(function() {
   102             .click(function() {
    99                 _annotation.trigger("click");
   103                 _annotation.trigger("click");
       
   104                 _this.player.trigger('annotation-click', _annotation);
   100             })
   105             })
   101             .appendTo(list_$);
   106             .appendTo(list_$);
   102         IriSP.attachDndData(_el, {
   107         IriSP.attachDndData(_el, {
   103         	title: _annotation.title,
   108         	title: _annotation.title,
   104         	description: _annotation.description,
   109         	description: _annotation.description,