src/js/widgets/tweetsWidget.js
branchpopcorn-port
changeset 541 f7667a1dde8e
parent 378 110311d59b2f
child 554 de53cbe1b052
--- a/src/js/widgets/tweetsWidget.js	Wed Dec 28 17:05:25 2011 +0100
+++ b/src/js/widgets/tweetsWidget.js	Wed Dec 28 17:06:46 2011 +0100
@@ -4,7 +4,8 @@
   IriSP.Widget.call(this, Popcorn, config, Serializer);
 
   this._displayingTweet = false;
-  this._timeoutId = undefined;  
+  this._timeoutId = undefined; 
+  this._hidden = false;
 };
 
 
@@ -12,6 +13,8 @@
 
 
 IriSP.TweetsWidget.prototype.drawTweet = function(annotation) {
+    if (this._hidden)
+      return;
     
     var title = IriSP.formatTweet(annotation.content.title);
     var img = annotation.content.img.src;
@@ -103,6 +106,8 @@
   this.selector.find(".Ldt-tweetWidgetKeepOpen").click(IriSP.wrap(this, this.keepPanel));
   
   this._Popcorn.listen("IriSP.PolemicTweet.click", IriSP.wrap(this, this.PolemicTweetClickHandler));
+  this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", 
+                        IriSP.wrap(this, this.handleAnnotateSignal));  
 };
 
 IriSP.TweetsWidget.prototype.PolemicTweetClickHandler = function(tweet_id) {  
@@ -121,3 +126,14 @@
   this.displayTweet(annotation);
   return;
 };
+
+/** handle clicks on the annotate button by hiding/showing itself */
+IriSP.TweetsWidget.prototype.handleAnnotateSignal = function() {
+  if (this._hidden == false) {
+    this.selector.hide();
+    this._hidden = true;
+  } else {
+    this.selector.show();
+    this._hidden = false;
+  }
+};
\ No newline at end of file