src/widgets/Annotation.js
changeset 988 eefd336335f9
parent 985 9859c4bae904
child 993 a7efd386872a
equal deleted inserted replaced
987:7b65bf78873a 988:eefd336335f9
    74     function highlightTitleAndDescription() {
    74     function highlightTitleAndDescription() {
    75         if (!currentAnnotation) {
    75         if (!currentAnnotation) {
    76             return;
    76             return;
    77         }
    77         }
    78         var title = currentAnnotation.title,
    78         var title = currentAnnotation.title,
    79             description = currentAnnotation.description.replace(/(^\s+|\s+$)/g,'');
    79             description = currentAnnotation.description.replace(/(^\s+|\s+$)/g,''),
    80         if (currentAnnotation.found) {
    80             rx = (currentAnnotation.found ? (_this.source.getAnnotations().regexp || false) : false);
    81             var rgxp = _this.source.getAnnotations().regexp || /^$/,
    81         _this.$.find(".Ldt-Annotation-Title").html(IriSP.textFieldHtml(title,rx)  || "(" + _this.l10n.untitled + ")");
    82                 repl = '<span class="Ldt-Annotation-Highlight">$1</span>';
       
    83             title = title.replace(rgxp,repl);
       
    84             description = description.replace(rgxp,repl).replace(/[\n\r]+/gm,'<br />');
       
    85         }
       
    86         _this.$.find(".Ldt-Annotation-Title").html(title || "(" + _this.l10n.untitled + ")");
       
    87         if (description) {
    82         if (description) {
    88             _this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock");
    83             _this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock");
    89             _this.$.find(".Ldt-Annotation-Description").html(description);
    84             _this.$.find(".Ldt-Annotation-Description").html(IriSP.textFieldHtml(description,rx));
    90         } else {
    85         } else {
    91             _this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock");
    86             _this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock");
    92         }
    87         }
    93     }
    88     }
    94     
    89     
   154     
   149     
   155     if (this.show_social) {
   150     if (this.show_social) {
   156         this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget");
   151         this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget");
   157     }
   152     }
   158     
   153     
   159     this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow" }, "arrow");
   154     this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow", width: this.width }, "arrow");
   160     this.onMediaEvent("timeupdate",timeupdate);
   155     this.onMediaEvent("timeupdate",timeupdate);
   161     this.onMdpEvent("Annotation.hide","hide");
   156     this.onMdpEvent("Annotation.hide","hide");
   162     this.onMdpEvent("Annotation.show","show");
   157     this.onMdpEvent("Annotation.show","show");
   163     this.onMdpEvent("Annotation.minimize","minimize");
   158     this.onMdpEvent("Annotation.minimize","minimize");
   164     this.onMdpEvent("Annotation.maximize","maximize");
   159     this.onMdpEvent("Annotation.maximize","maximize");