# HG changeset patch # User hamidouk # Date 1325088406 -3600 # Node ID f7667a1dde8ed1a90be71033ca53b33522421365 # Parent b1f3aee23199ebbc4d963a7a686b1cec92cdf055 react to said signal. diff -r b1f3aee23199 -r f7667a1dde8e src/js/widgets/annotationsWidget.js --- a/src/js/widgets/annotationsWidget.js Wed Dec 28 17:05:25 2011 +0100 +++ b/src/js/widgets/annotationsWidget.js Wed Dec 28 17:06:46 2011 +0100 @@ -1,6 +1,7 @@ IriSP.AnnotationsWidget = function(Popcorn, config, Serializer) { IriSP.Widget.call(this, Popcorn, config, Serializer); - + /* flag used when we're creating an annotation */ + this._hidden = false; }; @@ -12,8 +13,7 @@ this.selector.find(".Ldt-SaKeywordText").text(""); }; -IriSP.AnnotationsWidget.prototype.displayAnnotation = function(annotation) { - +IriSP.AnnotationsWidget.prototype.displayAnnotation = function(annotation) { var title = annotation.content.title; var description = annotation.content.description; var keywords = "" // FIXME; @@ -39,9 +39,7 @@ this.selector.find(".Ldt-GplusShare").attr("href", fb_link + IriSP.encodeURI(text) + IriSP.encodeURI(url)); }; -IriSP.AnnotationsWidget.prototype.clearWidget = function() { - - +IriSP.AnnotationsWidget.prototype.clearWidget = function() { /* retract the pane between two annotations */ this.selector.find(".Ldt-SaTitle").text(""); this.selector.find(".Ldt-SaDescription").text(""); @@ -54,7 +52,9 @@ var annotationMarkup = IriSP.templToHTML(IriSP.annotationWidget_template); this.selector.append(annotationMarkup); - + + this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", + IriSP.wrap(this, this.handleAnnotateSignal)); var legal_ids = this._serializer.getNonTweetIds(); var annotations = this._serializer._data.annotations; @@ -85,3 +85,13 @@ } }; + +IriSP.AnnotationsWidget.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 diff -r b1f3aee23199 -r f7667a1dde8e src/js/widgets/tweetsWidget.js --- 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