use the new annotation shortening functions. popcorn-port
authorhamidouk
Tue, 17 Jan 2012 16:04:53 +0100
branchpopcorn-port
changeset 651 c43441822b1b
parent 650 54ad76d6f9fe
child 652 d6e18921fab8
use the new annotation shortening functions.
src/js/widgets/annotationsWidget.js
src/js/widgets/createAnnotationWidget.js
--- a/src/js/widgets/annotationsWidget.js	Tue Jan 17 16:00:42 2012 +0100
+++ b/src/js/widgets/annotationsWidget.js	Tue Jan 17 16:04:53 2012 +0100
@@ -33,10 +33,10 @@
     var fb_link = defaults.fb_link;
     var tw_link = defaults.tw_link;
     var gplus_link = defaults.gplus_link;
-    var url = document.location.href + "#a=" + annotation.id;
-    this.selector.find(".Ldt-fbShare").attr("href", fb_link + IriSP.encodeURI(text) + IriSP.encodeURI(url));
-    this.selector.find(".Ldt-TwShare").attr("href", tw_link + IriSP.encodeURI(text) + IriSP.encodeURI(url));
-    this.selector.find(".Ldt-GplusShare").attr("href", fb_link + IriSP.encodeURI(text) + IriSP.encodeURI(url));
+    var url = document.location.href + "#id=" + annotation.id;
+    this.selector.find(".Ldt-fbShare").attr("href", IriSP.mkFbUrl(url, text));
+    this.selector.find(".Ldt-TwShare").attr("href", IriSP.mkTweetUrl(url, text));
+    this.selector.find(".Ldt-GplusShare").attr("href", IriSP.mkGplusUrl(url, text));
 };
 
 IriSP.AnnotationsWidget.prototype.clearWidget = function() {   
--- a/src/js/widgets/createAnnotationWidget.js	Tue Jan 17 16:00:42 2012 +0100
+++ b/src/js/widgets/createAnnotationWidget.js	Tue Jan 17 16:04:53 2012 +0100
@@ -196,16 +196,17 @@
   this.selector.find(".Ldt-createAnnotation-waitScreen").show();  
 };
 
-IriSP.createAnnotationWidget.prototype.showEndScreen = function() {
+IriSP.createAnnotationWidget.prototype.showEndScreen = function(annotation) {
   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   
   if (this.cinecast_version) {
     this.selector.find(".Ldt-createAnnotation-Title").parent().show();      
   }
 
-  var twStatus = IriSP.mkTweetUrl(document.location.href);
-  var gpStatus = IriSP.mkGplusUrl(document.location.href);
-  var fbStatus = IriSP.mkFbUrl(document.location.href);
+  var url = document.location.href + "id=" + annotation.id;
+  var twStatus = IriSP.mkTweetUrl(url);
+  var gpStatus = IriSP.mkGplusUrl(url);
+  var fbStatus = IriSP.mkFbUrl(url);
   
   this.selector.find(".Ldt-createAnnotation-endScreen-TweetLink").attr("href", twStatus);
   this.selector.find(".Ldt-createAnnotation-endScreen-FbLink").attr("href", fbStatus);
@@ -315,7 +316,7 @@
                       /* set up a basic view */
                       var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions",
                                       "id": json.annotations[0].type}
-                      console.log(tmp_view);
+
                       this._serializer._data["annotation-types"].push(tmp_view);
                     }
                     
@@ -330,9 +331,9 @@
                     
                     // everything is shared so there's no need to propagate the change
                     _this._serializer._data.annotations.push(annotation);
-                    console.log(_this._serializer._data);
+ 
                     _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation);
-                    callback();
+                    callback(annotation);
       }), 
       error: 
               function(jqXHR, textStatus, errorThrown) {