equal
deleted
inserted
replaced
45 "color" : "#036AAE" |
45 "color" : "#036AAE" |
46 } |
46 } |
47 ] |
47 ] |
48 }; |
48 }; |
49 |
49 |
50 IriSP.Widgets.Polemic.prototype.onSearch = function(searchString) { |
|
51 this.searchString = typeof searchString !== "undefined" ? searchString : ''; |
|
52 var _found = 0, |
|
53 _re = IriSP.Model.regexpFromTextOrArray(searchString, true), |
|
54 _this = this; |
|
55 this.$tweets.each(function() { |
|
56 var _el = IriSP.jQuery(this); |
|
57 if (_this.searchString) { |
|
58 if (_re.test(_el.attr("tweet-title"))) { |
|
59 _el.css({ |
|
60 "background" : _this.foundcolor, |
|
61 "opacity" : 1 |
|
62 }); |
|
63 _found++; |
|
64 } else { |
|
65 _el.css({ |
|
66 "background" : _el.attr("polemic-color"), |
|
67 "opacity" : .3 |
|
68 }); |
|
69 } |
|
70 } else { |
|
71 _el.css({ |
|
72 "background" : _el.attr("polemic-color"), |
|
73 "opacity" : 1 |
|
74 }); |
|
75 } |
|
76 }); |
|
77 if (this.searchString) { |
|
78 if (_found) { |
|
79 this.player.trigger("search.matchFound"); |
|
80 } else { |
|
81 this.player.trigger("search.noMatchFound"); |
|
82 } |
|
83 } |
|
84 } |
|
85 |
|
86 IriSP.Widgets.Polemic.prototype.draw = function() { |
50 IriSP.Widgets.Polemic.prototype.draw = function() { |
87 |
51 |
88 this.onMediaEvent("timeupdate", "onTimeupdate"); |
52 this.onMediaEvent("timeupdate", "onTimeupdate"); |
89 this.$zone = IriSP.jQuery('<div>'); |
53 this.$zone = IriSP.jQuery('<div>'); |
90 this.$zone.addClass("Ldt-Polemic"); |
54 this.$zone.addClass("Ldt-Polemic"); |
187 }); |
151 }); |
188 _annotation.on("unselect", function() { |
152 _annotation.on("unselect", function() { |
189 _this.tooltip.hide(); |
153 _this.tooltip.hide(); |
190 _this.$tweets.css("opacity",1); |
154 _this.$tweets.css("opacity",1); |
191 }); |
155 }); |
|
156 _annotation.on("found", function() { |
|
157 _el.css({ |
|
158 "background" : _this.foundcolor, |
|
159 "opacity" : 1 |
|
160 }); |
|
161 }); |
|
162 _annotation.on("not-found", function() { |
|
163 _el.css({ |
|
164 "background" : _col, |
|
165 "opacity" : .3 |
|
166 }); |
|
167 }); |
192 _this.$zone.append(_el); |
168 _this.$zone.append(_el); |
193 } |
169 } |
194 |
170 |
195 IriSP._(_slices).forEach(function(_slice) { |
171 IriSP._(_slices).forEach(function(_slice) { |
196 var _y = _this.height; |
172 var _y = _this.height; |
211 |
187 |
212 this.$zone.append(_html); |
188 this.$zone.append(_html); |
213 |
189 |
214 this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv"); |
190 this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv"); |
215 |
191 |
216 this.onMdpEvent("search", "onSearch"); |
192 this.source.getAnnotations().on("search-cleared", function() { |
217 this.onMdpEvent("search.closed", "onSearch"); |
193 _this.$tweets.each(function() { |
218 this.onMdpEvent("search.cleared", "onSearch"); |
194 var _el = IriSP.jQuery(this); |
|
195 _el.css({ |
|
196 "background" : _el.attr("polemic-color"), |
|
197 "opacity" : 1 |
|
198 }); |
|
199 }); |
|
200 }); |
219 |
201 |
220 } else { |
202 } else { |
221 this.$zone.hide(); |
203 this.$zone.hide(); |
222 } |
204 } |
223 } else { |
205 } else { |