# HG changeset patch # User hamidouk # Date 1324028508 -3600 # Node ID 19389e221722645c5f999872b3b88e856bf9bc79 # Parent 154c049e0c06b2b4aa52b995c4371aace306010f the annotationWidget "share" buttons now work correctly. diff -r 154c049e0c06 -r 19389e221722 src/js/site.js.templ --- a/src/js/site.js.templ Thu Dec 15 16:35:48 2011 +0100 +++ b/src/js/site.js.templ Fri Dec 16 10:41:48 2011 +0100 @@ -22,7 +22,12 @@ IriSP.widgetsDefaults = { "LayoutManager" : {spacer_div_height : "0px" }, "PlayerWidget" : {}, - "AnnotationsWidget": {}, + "AnnotationsWidget": { + "share_text" : "I'm watching ", + "fb_link" : "http://www.facebook.com/share.php?u=", + "tw_link" : "http://twitter.com/home?status=", + "gplus_link" : "" + }, "TweetsWidget" : { default_profile_picture : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", tweet_display_period: 10000 // how long do we show a tweet ? diff -r 154c049e0c06 -r 19389e221722 src/js/widgets/annotationsWidget.js --- a/src/js/widgets/annotationsWidget.js Thu Dec 15 16:35:48 2011 +0100 +++ b/src/js/widgets/annotationsWidget.js Fri Dec 16 10:41:48 2011 +0100 @@ -12,7 +12,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; @@ -20,12 +20,23 @@ var begin = +annotation.begin / 1000; var end = +annotation.end / 1000; var duration = +this._serializer.currentMedia().meta["dc:duration"]; - + var title_templ = "{{title}} - ( {{begin}} - {{end}} )"; var endstr = Mustache.to_html(title_templ, {title: title, begin: IriSP.secondsToTime(begin), end: IriSP.secondsToTime(end)}); this.selector.find(".Ldt-SaTitle").text(endstr); this.selector.find(".Ldt-SaDescription").text(description); + + // update sharing buttons + var defaults = IriSP.widgetsDefaults.AnnotationsWidget; + var text = defaults.share_text; + 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)); }; IriSP.AnnotationsWidget.prototype.clearWidget = function() { diff -r 154c049e0c06 -r 19389e221722 src/templates/annotationWidget.html --- a/src/templates/annotationWidget.html Thu Dec 15 16:35:48 2011 +0100 +++ b/src/templates/annotationWidget.html Fri Dec 16 10:41:48 2011 +0100 @@ -5,9 +5,9 @@
- share on facebook - share on twitter - share on google+ + share on facebook + share on twitter + share on google+