implemented a second button to keep the tweetWidget open.
--- a/src/css/LdtPlayer.css Thu Dec 01 16:07:24 2011 +0100
+++ b/src/css/LdtPlayer.css Thu Dec 01 16:20:39 2011 +0100
@@ -376,6 +376,14 @@
float: left;
}
+ .Ldt-tweetWidgetKeepOpen {
+ position: relative;
+ float: right;
+ height: 17px;
+ width: 17px;
+ margin-right: 1px;
+ }
+
.Ldt-tweetWidgetMinimize {
position: relative;
float: right;
--- a/src/js/widgets/tweetsWidget.js Thu Dec 01 16:07:24 2011 +0100
+++ b/src/js/widgets/tweetsWidget.js Thu Dec 01 16:20:39 2011 +0100
@@ -76,12 +76,23 @@
/* we're called from the "close window" link */
/* cancel the timeout */
window.clearTimeout(this._timeoutId);
+ this._timeoutId = null;
}
this.selector.hide("blind", 400);
};
+/* cancel the timeout if the user clicks on the keep panel open button */
+IriSP.TweetsWidget.prototype.keepPanel = function() {
+ if (this._timeoutId != undefined) {
+ /* we're called from the "close window" link */
+ /* cancel the timeout */
+ window.clearTimeout(this._timeoutId);
+ this._timeoutId = null;
+ }
+};
+
IriSP.TweetsWidget.prototype.draw = function() {
var _this = this;
@@ -89,6 +100,7 @@
this.selector.append(tweetMarkup);
this.selector.hide();
this.selector.find(".Ldt-tweetWidgetMinimize").click(IriSP.wrap(this, this.closePanel));
+ this.selector.find(".Ldt-tweetWidgetKeepOpen").click(IriSP.wrap(this, this.keepPanel));
this._Popcorn.listen("IriSP.PolemicTweet.click", IriSP.wrap(this, this.PolemicTweetClickHandler));
};
--- a/src/templates/tweetWidget.html Thu Dec 01 16:07:24 2011 +0100
+++ b/src/templates/tweetWidget.html Thu Dec 01 16:20:39 2011 +0100
@@ -1,5 +1,6 @@
{{! template for the tweet widget }}
<div class='Ldt-tweetWidget'>
+ <img src='{{img_dir}}/minimize.png' class='Ldt-tweetWidgetKeepOpen' alt='dont minimize automatically'></img>
<img src='{{img_dir}}/minimize.png' class='Ldt-tweetWidgetMinimize' alt='minimize window'></img>
<div class='Ldt-tweetAvatar'></div>
<img src='{{img_dir}}/profile_arrow.png' class='Ldt-tweetAvatar-profileArrow'></img>
--- a/unittests/tests/widgets/tweetsWidget.js Thu Dec 01 16:07:24 2011 +0100
+++ b/unittests/tests/widgets/tweetsWidget.js Thu Dec 01 16:20:39 2011 +0100
@@ -50,8 +50,12 @@
equal(widget.selector.find(".Ldt-tweetAvatar").children().attr("src"),
IriSP.widgetsDefaults.TweetsWidget.default_profile_picture, "default avatar set correctly");
+ widget.selector.find(".Ldt-tweetWidgetKeepOpen").click();
+ ok(widget._timeoutId === null, "the timeout is cancelled");
widget.selector.find(".Ldt-tweetWidgetMinimize").click();
+ widget.displayTweet(annotation2);
+
ok(!widget.selector.is(":visible"), "the widget is hidden after a click");
});
@@ -75,4 +79,4 @@
}, 100);
*/
});
-};
\ No newline at end of file
+};