added a minimize functionality to the tweetwidget. tweet-widget
authorhamidouk
Fri, 18 Nov 2011 16:25:22 +0100
branchtweet-widget
changeset 278 ff20c80c6845
parent 277 ff416475397a
child 280 3da58bd31096
added a minimize functionality to the tweetwidget.
src/css/LdtPlayer.css
src/js/widgets/tweetsWidget.js
src/templates/tweetWidget.html
--- a/src/css/LdtPlayer.css	Fri Nov 18 14:56:38 2011 +0100
+++ b/src/css/LdtPlayer.css	Fri Nov 18 16:25:22 2011 +0100
@@ -251,3 +251,6 @@
     
     }
 
+    .Ldt-tweetWidgetMinimize {
+      float: right;
+    }
\ No newline at end of file
--- a/src/js/widgets/tweetsWidget.js	Fri Nov 18 14:56:38 2011 +0100
+++ b/src/js/widgets/tweetsWidget.js	Fri Nov 18 16:25:22 2011 +0100
@@ -4,7 +4,7 @@
   IriSP.Widget.call(this, Popcorn, config, Serializer);
 
   this._displayingTweet = false;
-  this._timeoutId = undefined;
+  this._timeoutId = undefined;  
 };
 
 
@@ -24,7 +24,7 @@
 
     this.selector.find(".Ldt-tweetContents").text(title);
     this.selector.find(".Ldt-tweetAvatar").html(imageMarkup);
-    this.selector.show(50);
+    this.selector.show("blind", 250); 
 };
 
 IriSP.TweetsWidget.prototype.displayTweet = function(annotation) {
@@ -43,15 +43,20 @@
 
 IriSP.TweetsWidget.prototype.clearPanel = function() {  
     this._displayingTweet = false;
+    this._timeoutId = undefined;
     this.closePanel();
+    
 };
 
 IriSP.TweetsWidget.prototype.closePanel = function() {
-  if (this._displayingTweet)
-    return;
-  else {
-    this.selector.hide(50);
-  }
+    if (this._timeoutId != undefined) {
+      /* we're called from the "close window" link */
+      /* cancel the timeout */
+      window.clearTimeout(this._timeoutId);
+    }
+    
+    this.selector.hide("blind", 400);
+    
 };
 
 IriSP.TweetsWidget.prototype.draw = function() {
@@ -60,6 +65,7 @@
   var tweetMarkup = Mustache.to_html(IriSP.tweetWidget_template, {"share_template" : IriSP.share_template});
   this.selector.append(tweetMarkup);
   this.selector.hide();
+  this.selector.find(".Ldt-tweetWidgetMinimize").click(IriSP.wrap(this, this.closePanel));
   
   this._Popcorn.listen("IriSP.PolemicTweet.click", IriSP.wrap(this, this.PolemicTweetClickHandler));
 };
--- a/src/templates/tweetWidget.html	Fri Nov 18 14:56:38 2011 +0100
+++ b/src/templates/tweetWidget.html	Fri Nov 18 16:25:22 2011 +0100
@@ -1,5 +1,6 @@
 {{! template for the tweet widget }}
 <div class='Ldt-tweetWidget'>
+  <div class='Ldt-tweetWidgetMinimize'>Minimize</div>
   <div class='Ldt-tweetAvatar'>
 
   </div>