# HG changeset patch # User veltr # Date 1331036811 -3600 # Node ID ae16691d183d3dd438f210e1a2b2021f55c21767 # Parent bcf0c2bdcb8e2f0334963d5fb81cff458f29d03a Corrected segments widget, added excludePattern option to tagcloud widget diff -r bcf0c2bdcb8e -r ae16691d183d src/js/widgets/segmentsWidget.js --- a/src/js/widgets/segmentsWidget.js Mon Mar 05 18:11:58 2012 +0100 +++ b/src/js/widgets/segmentsWidget.js Tue Mar 06 13:26:51 2012 +0100 @@ -50,7 +50,7 @@ if (typeof(view_type) === "undefined") { view_type = this._serializer.getNonTweetIds()[0]; } - this.positionMarker = this.selector.children(":first"); + this.positionMarker = this.selector.find(".Ldt-SegmentPositionMarker"); this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater)); diff -r bcf0c2bdcb8e -r ae16691d183d src/js/widgets/tagCloudWidget.js --- a/src/js/widgets/tagCloudWidget.js Mon Mar 05 18:11:58 2012 +0100 +++ b/src/js/widgets/tagCloudWidget.js Tue Mar 06 13:26:51 2012 +0100 @@ -6,23 +6,29 @@ IriSP.TagCloudWidget.prototype.draw = function() { - var _stopwords = [ - 'aussi', 'and', 'avec', 'aux', 'car', 'cette', 'comme', 'dans', 'donc', 'des', 'elle', 'est', - 'être', 'eux', 'fait', 'ici', 'ils', 'les', 'leur', 'leurs', 'mais', 'mes', 'même', 'mon', 'notre', - 'non', 'nos', 'nous', 'ont', 'par', 'pas', 'peu', 'pour', 'que', 'qui', 'ses' ,'son', 'sont', 'sur', - 'tes', 'très', 'the', 'ton', 'tous', 'tout', 'une', 'votre', 'vos', 'vous' - ], + var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g, + _stopWords = [ + 'aussi', 'and', 'avec', 'aux', 'bien', 'car', 'cette', 'comme', 'dans', 'donc', 'des', 'elle', 'encore', 'est', + 'être', 'eux', 'faire', 'fait', 'http', 'ici', 'ils', 'les', 'leur', 'leurs', 'mais', 'mes', 'même', 'mon', 'notre', + 'non', 'nos', 'nous', 'ont', 'par', 'pas', 'peu', 'peut', 'plus', 'pour', 'que', 'qui', 'ses' ,'son', 'sont', 'sur', + 'tes', 'très', 'the', 'ton', 'tous', 'tout', 'une', 'votre', 'vos', 'vous' ], _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g, _words = {}, _showTitle = !this._config.excludeTitle, _showDescription = !this._config.excludeDescription, + _excludePattern = this._config.excludePattern || null, _tagCount = this._config.tagCount || 30; + if (typeof this._config.excludeWords !== "undefined" && this._config.excludeWords.length) { + IriSP._(this._config.excludeWords).each(function(_w) { + _stopWords.push(_w.toLowerCase()); + }); + } IriSP._(this._serializer._data.annotations).each(function(_annotation) { if (_annotation.content && _annotation.content.description) { var _txt = (_showTitle ? _annotation.content.title : '') + ' ' + (_showDescription ? _annotation.content.description : '') - IriSP._(_txt.toLowerCase().match(_regexpword)).each(function(_mot) { - if (_stopwords.indexOf(_mot) == -1) { + IriSP._(_txt.toLowerCase().replace(_urlRegExp, '').match(_regexpword)).each(function(_mot) { + if (_stopWords.indexOf(_mot) == -1 && (_excludePattern == null || !_excludePattern.test(_mot))) { _words[_mot] = 1 + (_words[_mot] || 0); } }) diff -r bcf0c2bdcb8e -r ae16691d183d test/integration/polemic.htm --- a/test/integration/polemic.htm Mon Mar 05 18:11:58 2012 +0100 +++ b/test/integration/polemic.htm Tue Mar 06 13:26:51 2012 +0100 @@ -18,7 +18,7 @@
-
+