2 |
2 |
3 IriSP.TweetsWidget = function(Popcorn, config, Serializer) { |
3 IriSP.TweetsWidget = function(Popcorn, config, Serializer) { |
4 IriSP.Widget.call(this, Popcorn, config, Serializer); |
4 IriSP.Widget.call(this, Popcorn, config, Serializer); |
5 |
5 |
6 this._displayingTweet = false; |
6 this._displayingTweet = false; |
7 this._timeoutId = undefined; |
7 this._timeoutId = undefined; |
8 }; |
8 }; |
9 |
9 |
10 |
10 |
11 IriSP.TweetsWidget.prototype = new IriSP.Widget(); |
11 IriSP.TweetsWidget.prototype = new IriSP.Widget(); |
12 |
12 |
22 var imageMarkup = Mustache.to_html("<img src='{{src}}' alt='avatar'></img>", |
22 var imageMarkup = Mustache.to_html("<img src='{{src}}' alt='avatar'></img>", |
23 {src : img}); |
23 {src : img}); |
24 |
24 |
25 this.selector.find(".Ldt-tweetContents").text(title); |
25 this.selector.find(".Ldt-tweetContents").text(title); |
26 this.selector.find(".Ldt-tweetAvatar").html(imageMarkup); |
26 this.selector.find(".Ldt-tweetAvatar").html(imageMarkup); |
27 this.selector.show(50); |
27 this.selector.show("blind", 250); |
28 }; |
28 }; |
29 |
29 |
30 IriSP.TweetsWidget.prototype.displayTweet = function(annotation) { |
30 IriSP.TweetsWidget.prototype.displayTweet = function(annotation) { |
31 if (this._displayingTweet === false) { |
31 if (this._displayingTweet === false) { |
32 this._displayingTweet = true; |
32 this._displayingTweet = true; |
41 }; |
41 }; |
42 |
42 |
43 |
43 |
44 IriSP.TweetsWidget.prototype.clearPanel = function() { |
44 IriSP.TweetsWidget.prototype.clearPanel = function() { |
45 this._displayingTweet = false; |
45 this._displayingTweet = false; |
|
46 this._timeoutId = undefined; |
46 this.closePanel(); |
47 this.closePanel(); |
|
48 |
47 }; |
49 }; |
48 |
50 |
49 IriSP.TweetsWidget.prototype.closePanel = function() { |
51 IriSP.TweetsWidget.prototype.closePanel = function() { |
50 if (this._displayingTweet) |
52 if (this._timeoutId != undefined) { |
51 return; |
53 /* we're called from the "close window" link */ |
52 else { |
54 /* cancel the timeout */ |
53 this.selector.hide(50); |
55 window.clearTimeout(this._timeoutId); |
54 } |
56 } |
|
57 |
|
58 this.selector.hide("blind", 400); |
|
59 |
55 }; |
60 }; |
56 |
61 |
57 IriSP.TweetsWidget.prototype.draw = function() { |
62 IriSP.TweetsWidget.prototype.draw = function() { |
58 var _this = this; |
63 var _this = this; |
59 |
64 |
60 var tweetMarkup = Mustache.to_html(IriSP.tweetWidget_template, {"share_template" : IriSP.share_template}); |
65 var tweetMarkup = Mustache.to_html(IriSP.tweetWidget_template, {"share_template" : IriSP.share_template}); |
61 this.selector.append(tweetMarkup); |
66 this.selector.append(tweetMarkup); |
62 this.selector.hide(); |
67 this.selector.hide(); |
|
68 this.selector.find(".Ldt-tweetWidgetMinimize").click(IriSP.wrap(this, this.closePanel)); |
63 |
69 |
64 this._Popcorn.listen("IriSP.PolemicTweet.click", IriSP.wrap(this, this.PolemicTweetClickHandler)); |
70 this._Popcorn.listen("IriSP.PolemicTweet.click", IriSP.wrap(this, this.PolemicTweetClickHandler)); |
65 }; |
71 }; |
66 |
72 |
67 IriSP.TweetsWidget.prototype.PolemicTweetClickHandler = function(tweet_id) { |
73 IriSP.TweetsWidget.prototype.PolemicTweetClickHandler = function(tweet_id) { |