src/widgets/Polemic.js
changeset 1071 02c04d2c8fd8
parent 1070 36517cb225fe
child 1072 ac1eacb3aa33
equal deleted inserted replaced
1070:36517cb225fe 1071:02c04d2c8fd8
   142                 _polDef,
   142                 _polDef,
   143                 _rgxp;
   143                 _rgxp;
   144 
   144 
   145             for(var _j = 0; _j < _polemics.length; _j++) {
   145             for(var _j = 0; _j < _polemics.length; _j++) {
   146                 _pol = _polemics[_j];
   146                 _pol = _polemics[_j];
   147                 _rgxp = _pol.rgxp || (_pol.rgxp = IriSP.Model.regexpFromTextOrArray(_pol.keywords));
   147                 _rgxp = IriSP.Model.regexpFromTextOrArray(_pol.keywords);
   148                 if(_rgxp.test(_annotation.description)) {
   148                 if(_rgxp.test(_annotation.description)) {
   149                     colAr.push(_pol.color);
   149                     colAr.push(_pol.color);
   150                 }
   150                 }
   151             }
   151             }
   152 
   152 
   344                     return _annotation.begin >= _begin && _annotation.begin < _end;
   344                     return _annotation.begin >= _begin && _annotation.begin < _end;
   345                 }),
   345                 }),
   346                 polemicStacks : {}
   346                 polemicStacks : {}
   347             };
   347             };
   348 
   348 
   349         _count = _res.annotations.length;
       
   350         _res.annotations = _res.annotations.filter(function(_annotation) {
   349         _res.annotations = _res.annotations.filter(function(_annotation) {
   351             var _polemicVersion = (_annotation.content && _annotation.content.polemic_version) || _this.default_version,
   350             var _polemicVersion = (_annotation.content && _annotation.content.polemic_version) || _this.default_version,
   352                 _polemics = _this.getPolemics(_polemicVersion) || [],
   351                 _polemics = _this.getPolemics(_polemicVersion) || [],
   353                 _pol,
   352                 _pol,
   354                 _polKey,
   353                 _polKey,
   355                 _polDef,
   354                 _polDef,
   356                 _rgxp;
   355                 _rgxp,
       
   356                 _notMatched = true;
   357 
   357 
   358             for(var _j = 0; _j < _polemics.length; _j++) {
   358             for(var _j = 0; _j < _polemics.length; _j++) {
   359                 _pol = _polemics[_j];
   359                 _pol = _polemics[_j];
   360                 _rgxp = _pol.rgxp || (_pol.rgxp = IriSP.Model.regexpFromTextOrArray(_pol.keywords));
   360                 _rgxp = IriSP.Model.regexpFromTextOrArray(_pol.keywords);
       
   361 
   361                 if(_rgxp.test(_annotation.description)) {
   362                 if(_rgxp.test(_annotation.description)) {
   362                     _polKey = _polemicVersion + "_" + _pol.name;
   363                     _polKey = _polemicVersion + "_" + _pol.name;
   363                     _polDef = _res.polemicStacks[_polKey] || (_res.polemicStacks[_polKey] = { 'polemicDef' : _pol, 'annotations': []});
   364                     _polDef = _res.polemicStacks[_polKey] || (_res.polemicStacks[_polKey] = { 'polemicDef' : _pol, 'annotations': []});
   364                     _polDef.annotations.push(_annotation);
   365                     _polDef.annotations.push(_annotation);
   365                     return false;
   366                     _notMatched = false;
       
   367                     _count++;
   366                 }
   368                 }
   367             }
   369             }
   368             return true;
   370             return _notMatched;
   369         });
   371         });
       
   372         _count += _res.annotations.length;
   370 
   373 
   371         _max = Math.max(_max, _count);
   374         _max = Math.max(_max, _count);
   372         _slices.push(_res);
   375         _slices.push(_res);
   373     }
   376     }
   374 
   377