From e80992cc1ec2f3a79b5035b81de6cb3e3e939ecb Mon Sep 17 00:00:00 2001 From: lduarte1991 Date: Fri, 20 Jun 2014 11:44:07 -0400 Subject: [PATCH] Annotation Tool: Fixing Table Share bug (2b) --- common/static/js/vendor/ova/share-annotator.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/common/static/js/vendor/ova/share-annotator.js b/common/static/js/vendor/ova/share-annotator.js index 39912c1cac..864e525df2 100644 --- a/common/static/js/vendor/ova/share-annotator.js +++ b/common/static/js/vendor/ova/share-annotator.js @@ -33,7 +33,7 @@ Annotator.Plugin.Share = (function(_super) { return 'https://www.facebook.com/sharer/sharer.php?s=100&p[url]='+link+'&p[title]='+encodeURIComponent('Open Video Annotation')+'&p[summary]='+noteText; }, 'twitter':function(title,link,noteText){ - return 'https://twitter.com/intent/tweet?original_referer='+link+'&source=tweetbutton&url='+link+ "&via=OpenVideoAnnotation&text=" +encodeURIComponent('I want to share the next Open Video Annotation: '); + return 'https://twitter.com/intent/tweet?original_referer='+link+'&source=tweetbutton&url='+link+ "&via=OpenVideoAnnotation&text=" +encodeURIComponent('I want to share the following Open Video Annotation: '); }, 'google':function(title,link,noteText){ return 'https://plus.google.com/share?url='+link; @@ -135,8 +135,9 @@ Annotator.Plugin.Share = (function(_super) { return false; }); // Share button - $(field).find('.share-button-annotator.share-button').click(function() { + $(field).find('.share-button-annotator.share-button').click(function(event) { event.preventDefault(); // disable normal link function so that it doesn't refresh the page + annotation = share.getAnnotationFromId(event.currentTarget.attributes.annotationid); var _field = this, ovaId = annotation.id, title = method == 1?'Share':'Share without saving'; @@ -471,6 +472,17 @@ Annotator.Plugin.Share = (function(_super) { regex = null; return URL; } + + Share.prototype.getAnnotationFromId = function(ovaId){ + var annotationList = this.annotator.plugins.Store.annotations; + var value = undefined; + $.each(annotationList, function(key, val){ + if(val.id == ovaId.nodeValue){ + value = val; + } + }); + return value; + } Share.prototype.updateViewer = function(field, annotation) { this.annotation = annotation;