src/js/widgets/tagCloudWidget.js
branchpopcorn-port
changeset 830 18ca612e9ff0
parent 829 ae16691d183d
equal deleted inserted replaced
829:ae16691d183d 830:18ca612e9ff0
     6 
     6 
     7 IriSP.TagCloudWidget.prototype.draw = function() {
     7 IriSP.TagCloudWidget.prototype.draw = function() {
     8     
     8     
     9     var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
     9     var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
    10         _stopWords = [
    10         _stopWords = [
    11             'aussi', 'and', 'avec', 'aux', 'bien', 'car', 'cette', 'comme', 'dans', 'donc', 'des', 'elle', 'encore', 'est',
    11             'aussi', 'and', 'avec', 'aux', 'bien', 'car', 'cette', 'comme', 'dans', 'donc', 'des', 'elle', 'encore', 'entre', 'est',
    12             'être', 'eux', 'faire', 'fait', 'http', 'ici', 'ils', 'les', 'leur', 'leurs', 'mais', 'mes', 'même', 'mon', 'notre',
    12             'être', 'eux', 'faire', 'fait', 'http', 'ici', 'ils', 'les', 'leur', 'leurs', 'mais', 'mes', 'même', 'mon', 'notre',
    13             'non', 'nos', 'nous', 'ont', 'par', 'pas', 'peu', 'peut', 'plus', 'pour', 'que', 'qui', 'ses' ,'son', 'sont', 'sur',
    13             'non', 'nos', 'nous', 'ont', 'par', 'pas', 'peu', 'peut', 'plus', 'pour', 'que', 'qui', 'sans', 'ses' ,'son', 'sont', 'sur',
    14             'tes', 'très', 'the', 'ton', 'tous', 'tout', 'une', 'votre', 'vos', 'vous' ],
    14             'tes', 'très', 'the', 'ton', 'tous', 'tout', 'une', 'votre', 'vos', 'vous' ],
    15         _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
    15         _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
    16         _words = {},
    16         _words = {},
    17         _showTitle = !this._config.excludeTitle,
    17         _showTitle = !this._config.excludeTitle,
    18         _showDescription = !this._config.excludeDescription,
    18         _showDescription = !this._config.excludeDescription,
    59             + IriSP._(_words)
    59             + IriSP._(_words)
    60                 .chain()
    60                 .chain()
    61                 .shuffle()
    61                 .shuffle()
    62                 .map(function(_word) {
    62                 .map(function(_word) {
    63                     var _size = 10 + _scale * Math.sqrt(_word.count - _min);
    63                     var _size = 10 + _scale * Math.sqrt(_word.count - _min);
    64                     return '<li style="font-size:'
    64                     return '<li class="Ldt-TraceMe" style="font-size:'
    65                         + _size
    65                         + _size
    66                         + 'px;">'
    66                         + 'px;">'
    67                         + _word.word
    67                         + _word.word
    68                         + '</li>'
    68                         + '</li>'
    69                 })
    69                 })
    79     });
    79     });
    80     this._Popcorn.listen("IriSP.search", IriSP.wrap(this, function(searchString) {
    80     this._Popcorn.listen("IriSP.search", IriSP.wrap(this, function(searchString) {
    81         var _rgxp = new RegExp("(" + searchString.replace(/(\W)/g,'\\$1') + ")","gi");
    81         var _rgxp = new RegExp("(" + searchString.replace(/(\W)/g,'\\$1') + ")","gi");
    82         this.selector.find("li").each(function(_i, _e) {
    82         this.selector.find("li").each(function(_i, _e) {
    83             _e.innerHTML = searchString.length ?
    83             _e.innerHTML = searchString.length ?
    84                 _e.textContent.replace(_rgxp,'<span class="Ldt-TagCloud-actif">$1</span>')
    84                 _e.textContent.replace(_rgxp,'<span class="Ldt-TagCloud-actif Ldt-TraceMe">$1</span>')
    85                 : _e.textContent;
    85                 : _e.textContent;
    86         });
    86         });
    87     }));
    87     }));
    88     this._Popcorn.listen("IriSP.search.closed", IriSP.wrap(this, this.endsearch));
    88     this._Popcorn.listen("IriSP.search.closed", IriSP.wrap(this, this.endsearch));
    89     this._Popcorn.listen("IriSP.search.cleared", IriSP.wrap(this, this.endsearch));
    89     this._Popcorn.listen("IriSP.search.cleared", IriSP.wrap(this, this.endsearch));