src/widgets/Tagcloud.js
changeset 1027 9ae9453bad73
parent 1026 420608a77566
child 1028 08f6d6b3aea8
equal deleted inserted replaced
1026:420608a77566 1027:9ae9453bad73
    20     exclude_pattern: false,
    20     exclude_pattern: false,
    21     annotation_type: false,
    21     annotation_type: false,
    22     segment_annotation_type: false,
    22     segment_annotation_type: false,
    23     min_font_size: 10,
    23     min_font_size: 10,
    24     max_font_size: 26,
    24     max_font_size: 26,
    25     min_count: 2
    25     min_count: 2,
       
    26     remove_zero_duration: false
    26 };
    27 };
    27 
    28 
    28 IriSP.Widgets.Tagcloud.prototype.stopword_lists = {
    29 IriSP.Widgets.Tagcloud.prototype.stopword_lists = {
    29     "fr" : [
    30     "fr" : [
    30         'aussi', 'avec', 'aux', 'bien', 'car', 'cette', 'comme', 'dans', 'des', 'donc', 'dont', 'elle', 'encore', 'entre', 'est',
    31         'aussi', 'avec', 'aux', 'bien', 'car', 'cette', 'comme', 'dans', 'des', 'donc', 'dont', 'elle', 'encore', 'entre', 'est',
    53     }
    54     }
    54 };
    55 };
    55 
    56 
    56 IriSP.Widgets.Tagcloud.prototype.redraw = function(_from, _to) {
    57 IriSP.Widgets.Tagcloud.prototype.redraw = function(_from, _to) {
    57     var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
    58     var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
    58         _regexpword = /[^\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
       
    59         _words = {},
    59         _words = {},
    60         _this = this,
    60         _this = this,
    61         _annotations = this.getWidgetAnnotations();
    61         _annotations = this.getWidgetAnnotations();
       
    62     
       
    63     if(!this.include_titles && !this.include_descriptions){
       
    64     	var _regexpword = /[^\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»\/]{3,}/g;
       
    65     }
       
    66     else{
       
    67     	var _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g;
       
    68     }
    62         
    69         
    63     if (typeof _from !== "undefined" && typeof _to !== "undefined") {
    70     if (typeof _from !== "undefined" && typeof _to !== "undefined") {
    64         _annotations = _annotations.filter(function(_annotation) {
    71         _annotations = _annotations.filter(function(_annotation) {
    65             return _annotation.begin >= _from && _annotation.end <= _to;
    72             return _annotation.begin >= _from && _annotation.end <= _to;
    66         });
    73         });
    67     }
    74     }
       
    75     
       
    76     if(this.remove_zero_duration){
       
    77     	_annotations = _annotations.filter(function(_annotation) {
       
    78 	        return _annotation.getDuration()>0;
       
    79 	    });
       
    80     }
       
    81     
    68     _annotations.forEach(function(_annotation) {
    82     _annotations.forEach(function(_annotation) {
    69        var _txt =
    83        var _txt =
    70             (_this.include_titles ? _annotation.title : '')
    84             (_this.include_titles ? _annotation.title : '')
    71             + ' '
    85             + ' '
    72             + (_this.include_descriptions ? _annotation.description : '')
    86             + (_this.include_descriptions ? _annotation.description : '')