web/res/metadataplayer/Tweet.js
changeset 694 e9400c80e1e4
parent 654 a5977736d2b0
child 719 d0d3a9369f84
--- a/web/res/metadataplayer/Tweet.js	Mon Oct 15 14:34:47 2012 +0200
+++ b/web/res/metadataplayer/Tweet.js	Tue Oct 02 14:40:14 2012 +0200
@@ -25,6 +25,7 @@
             "color" : "#05aae6"
         }
     ],
+    annotation_type: "tweet",
     pin_at_start: false
 }
 
@@ -66,7 +67,6 @@
 
 IriSP.Widgets.Tweet.prototype.draw = function() {
     this.renderTemplate();
-    this.bindPopcorn("IriSP.Tweet.show","show");
     this.pinned = this.pin_at_start;
     var _this = this;
     this.$.find(".Ldt-Tweet-Pin").click(function() {
@@ -84,10 +84,14 @@
         _this.hide();
     });
     this.$.hide();
+    this.getWidgetAnnotations().forEach(function(_annotation) {
+        _annotation.on("click", function() {
+            _this.show(_annotation);
+        });
+    });
 }
 
-IriSP.Widgets.Tweet.prototype.show = function(_id) {
-    var _tweet = this.source.getElement(_id);
+IriSP.Widgets.Tweet.prototype.show = function(_tweet) {
     if (typeof _tweet !== "undefined" && typeof _tweet.source !== "undefined") {
         var _entities = [];
         for (var _i = 0; _i < _tweet.source.entities.hashtags.length; _i++) {
@@ -170,7 +174,7 @@
         this.$.find(".Ldt-Tweet-Retweet").attr("href", "https://twitter.com/intent/retweet?tweet_id=" + _tweet.source.id_str);
         this.$.find(".Ldt-Tweet-Reply").attr("href", "https://twitter.com/intent/tweet?in_reply_to=" + _tweet.source.id_str);
         this.$.find(".Ldt-Tweet-Original").attr("href", "https://twitter.com/" + _tweet.source.user.screen_name + "/status/" + _tweet.source.id_str);
-        this.player.popcorn.trigger("IriSP.Annotation.minimize");
+        this.player.trigger("Annotation.minimize");
         this.$.slideDown();
         this.cancelTimeout();
         if (!this.pinned) {
@@ -182,7 +186,7 @@
 }
 
 IriSP.Widgets.Tweet.prototype.hide = function() {
-    this.player.popcorn.trigger("IriSP.Annotation.maximize");
+    this.player.trigger("Annotation.maximize");
     this.$.slideUp();
     this.cancelTimeout();
 }