Committer: pkornilov
LJSUP-8678: Mail sharing should go to http://api.addthis.comU trunk/htdocs/js/journal.js U trunk/htdocs/js/share.js
Modified: trunk/htdocs/js/journal.js =================================================================== --- trunk/htdocs/js/journal.js 2011-04-27 04:01:26 UTC (rev 18979) +++ trunk/htdocs/js/journal.js 2011-04-27 04:29:02 UTC (rev 18980) @@ -142,23 +142,33 @@ jQuery(document).click(function(e) { - // Share in Facebook var a = e.target, - href = a.href; - if (href) { + href = a.href, + args; + if (href && !a.shareClickIgnore) { if (href.indexOf('http://www.facebook.com/sharer.php') === 0) { - a.setAttribute('st_dest', 'facebook.com'); - SHARETHIS_ary.findByUrl(decodeURIComponent(LiveJournal.parseGetArgs(href).u)).chicklet(e); - //else? window.open(href, 'sharer', 'toolbar=0,status=0,width=626,height=436'); + LJShare.entry({url: decodeURIComponent(LiveJournal.parseGetArgs(href).u)}) + .attach(a, "facebook"); + a.shareClickIgnore = true; + jQuery(a).click(); e.preventDefault(); - } else if (href.indexOf(Site.siteroot + '/share/twitter.bml') === 0) { - a.setAttribute('st_dest', 'twitter.com'); - SHARETHIS_ary.findByUrl(decodeURIComponent(LiveJournal.parseGetArgs(href).u)).chicklet(e); - //else? window.open(href, 'sharer', 'toolbar=0,status=0,width=430,height=220'); + } else if (href.indexOf("http://twitter.com/share") === 0) { + args = LiveJournal.parseGetArgs(href); + LJShare.entry({ + url: decodeURIComponent(args.url), + title: decodeURIComponent(args.text) + }).attach(a, "twitter"); + a.shareClickIgnore = true; + jQuery(a).click(); e.preventDefault(); - } else if (href.indexOf(Site.siteroot + '/tools/tellafriend.bml') === 0) { - a.setAttribute('st_page', 'send'); - SHARETHIS_ary.findByUrl(decodeURIComponent(LiveJournal.parseGetArgs(href).u)).popup(e); + } else if (href.indexOf("http://api.addthis.com/oexchange/0.8/forward/email") === 0) { + args = LiveJournal.parseGetArgs(href); + LJShare.entry({ + url: decodeURIComponent(args.url), + title: decodeURIComponent(args.title) + }).attach(a, "email"); + a.shareClickIgnore = true; + jQuery(a).click(); e.preventDefault(); } } Modified: trunk/htdocs/js/share.js =================================================================== --- trunk/htdocs/js/share.js 2011-04-27 04:01:26 UTC (rev 18979) +++ trunk/htdocs/js/share.js 2011-04-27 04:29:02 UTC (rev 18980) @@ -91,7 +91,7 @@ '<div class="b-sharethis-head">{title}</div>' + '<div class="b-sharethis-services">', //here we take values from an object made from service object. Availible vars: name, url, title. - item: '<span class="b-sharethis-{name}"><a href="{url}" data-service={name} >{title}</a></span>', + item: '<span class="b-sharethis-{name}"><a href="{url}" data-service={name}>{title}</a></span>', //here we take values from global_options.ml object end: '</div>' + '</div>' @@ -126,7 +126,7 @@ title: 'Digg', bindLink: 'http://digg.com/submit?url={url}', openInTab: true }, email: { - title: 'E-mail', bindLink: 'http://api.addthis.com/oexchange/0.8/forward/email/offer?username=internal&url={url}', height: 600 + title: 'E-mail', bindLink: 'http://api.addthis.com/oexchange/0.8/forward/email/offer?username=internal&url={url}&title={title}', height: 600 }, tumblr: { title: 'Tumblr', bindLink: 'http://www.tumblr.com/share?v=3&u={url}'