# HG changeset patch # User hamidouk # Date 1322752839 -3600 # Node ID 110311d59b2f9ad90a5a8d87eef98ef099fb6cc0 # Parent 2dc60fa78c41a6cd59195beb685b65561ef04a0e implemented a second button to keep the tweetWidget open. diff -r 2dc60fa78c41 -r 110311d59b2f src/css/LdtPlayer.css --- 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; diff -r 2dc60fa78c41 -r 110311d59b2f src/js/widgets/tweetsWidget.js --- 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)); }; diff -r 2dc60fa78c41 -r 110311d59b2f src/templates/tweetWidget.html --- 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 }}
+ dont minimize automatically minimize window
diff -r 2dc60fa78c41 -r 110311d59b2f unittests/tests/widgets/tweetsWidget.js --- 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 +};