src/js/widgets/polemicWidget.js
branchpopcorn-port
changeset 565 903435828e6c
parent 528 a5894f09825a
child 566 098929cd2d62
equal deleted inserted replaced
564:a560a162f444 565:903435828e6c
   285                   e.time = frames[i].mytweetsID[k].timeframe;
   285                   e.time = frames[i].mytweetsID[k].timeframe;
   286                   e.title = frames[i].mytweetsID[k].title;
   286                   e.title = frames[i].mytweetsID[k].title;
   287                   e.id = frames[i].mytweetsID[k].cinecast_id;
   287                   e.id = frames[i].mytweetsID[k].cinecast_id;
   288 
   288 
   289                   this.svgElements[e.id] = e;
   289                   this.svgElements[e.id] = e;
   290 
       
   291                   /*
       
   292                   e.mouseover(function(element) { return function (event) {
       
   293                         // event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery.                        
       
   294                         self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), event.clientX - 106, event.clientY - 160);
       
   295                         element.displayed = true;
       
   296                   }}(e)).mouseout(function(element) { return function () {                          
       
   297                           self.TooltipWidget.hide.call(self.TooltipWidget);
       
   298                   }}(e)).mousedown(function () {
       
   299                     self._Popcorn.currentTime(this.time/1000);
       
   300                     self._Popcorn.trigger("IriSP.PolemicTweet.click", this.id); 
       
   301                   });
       
   302                   */
       
   303                   
   290                   
   304                   IriSP.jQuery(e.node).mouseenter(function(element) { return function (event) {                        
   291                   IriSP.jQuery(e.node).mouseenter(function(element) { return function (event) {                        
   305                         // event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery.                        
   292                         // event.clientX and event.clientY are to raphael what event.pageX and pageY are to jquery.                        
   306                         self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), event.pageX - 106, event.pageY - 160);
   293                         self.TooltipWidget.show.call(self.TooltipWidget, element.title, element.attr("fill"), event.pageX - 106, event.pageY - 160);
   307                         element.displayed = true;
   294                         element.displayed = true;
   377     this._Popcorn.trigger("IriSP.search.matchFound");
   364     this._Popcorn.trigger("IriSP.search.matchFound");
   378   } else {
   365   } else {
   379     this._Popcorn.trigger("IriSP.search.noMatchFound");
   366     this._Popcorn.trigger("IriSP.search.noMatchFound");
   380   }
   367   }
   381 
   368 
       
   369   
       
   370   // decrease the opacity of the other elements.
       
   371   for (var id in this.svgElements) {
       
   372     var e = this.svgElements[id];
       
   373     e.attr({fill: e.color, opacity: 0.4});
       
   374   }
       
   375   
   382   for (var id in matches) {
   376   for (var id in matches) {
   383     if (this.svgElements.hasOwnProperty(id)) {
   377     if (this.svgElements.hasOwnProperty(id)) {
   384       var e = this.svgElements[id];
   378       var e = this.svgElements[id];
   385       this.svgElements[id].attr({fill: "#fc00ff"});
   379       this.svgElements[id].attr({fill: "#fc00ff", opacity: 1});
   386     }
   380     }
   387   }
   381   }
   388 
   382 
   389   // clean up the blocks that were in the previous search
       
   390   // but who aren't in the current one.
       
   391   for (var id in this.oldSearchMatches) {
       
   392     if (!matches.hasOwnProperty(id)) {
       
   393       var e = this.svgElements[id];
       
   394       e.attr({fill: e.color});
       
   395     }
       
   396   }
       
   397   
       
   398   this.oldSearchMatches = matches;
   383   this.oldSearchMatches = matches;
   399 };
   384 };
   400 
   385 
   401 /** reacts to IriSP.search.cleared messages */
   386 /** reacts to IriSP.search.cleared messages */
   402 IriSP.PolemicWidget.prototype.searchFieldClearedHandler = function() {
   387 IriSP.PolemicWidget.prototype.searchFieldClearedHandler = function() {
   403   // clean up the blocks that were in the previous search
   388   for (var id in this.svgElements) {
   404   // but who aren't in the current one.
   389     var e = this.svgElements[id];
   405   for (var id in this.oldSearchMatches) {
   390     e.attr({fill: e.color, opacity: 1});
   406       var e = this.svgElements[id];
       
   407       e.attr({fill: e.color});
       
   408   }
   391   }
   409  
       
   410 };
   392 };
   411 
   393 
   412 /** reacts to IriSP.search.closed messages by clearing the highlighted elements */
   394 /** reacts to IriSP.search.closed messages by clearing the highlighted elements */
   413 IriSP.PolemicWidget.prototype.searchFieldClosedHandler = function() {
   395 IriSP.PolemicWidget.prototype.searchFieldClosedHandler = function() {
   414   // clean up the blocks that were in the previous search
   396   for (var id in this.svgElements) {
   415   // but who aren't in the current one.
   397     var e = this.svgElements[id];
   416   for (var id in this.oldSearchMatches) {
   398     e.attr({fill: e.color, opacity: 1});
   417       var e = this.svgElements[id];
       
   418       e.attr({fill: e.color});
       
   419   }
   399   }
   420  
   400  
   421 };
   401 };
   422    
   402