Bug 7932 [Revised] Twitter share doesn't work with socialnetworks
authorOwen Leonard <oleonard@myacpl.org>
Thu, 1 Nov 2012 15:21:37 +0000 (11:21 -0400)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Tue, 20 Nov 2012 12:36:00 +0000 (07:36 -0500)
The only way I can get this to work consistently is to use
Twitter's own code as documented here:

https://dev.twitter.com/docs/tweet-button

This requires that we use the tweet button generated by Twitter
rather than the smaller image we were using before. Using the
documented options for generating a custom button produced the
same inconsistent behavior this patch attempts to fix.

Because of the change of appearance I moved the Twitter button
to last in line so that similarly-sized buttons were grouped. I
also changed the configuration of the Google+ button to exclude
the count, saving some horizontal space.

Revision removes explicit declaration of share URL. I think when
testing this previously I assumed it was required when in fact
the share URL wasn't working because it was a localhost address.

Localhost addresses are apparently rejected by Twitter. Testers
beware.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Passed-QA-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt

index 1d0523a..fa1d6c9 100644 (file)
@@ -8,6 +8,7 @@
     <script type="text/javascript" src="https://apis.google.com/js/plusone.js">
       {lang: '[% lang %]'}
     </script>
+    <script type="text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
 [% END %]
 [% IF ( OpacStarRatings != 'disable' ) %]<script type="text/javascript" src="/opac-tmpl/prog/en/lib/jquery/plugins/jquery.rating.js"></script>
 <link rel="stylesheet" type="text/css" href="/opac-tmpl/prog/en/css/jquery.rating.css" />[% END %]
@@ -1215,11 +1216,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
     <div id="social_networks">
         <span>Share</span>
         <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
-        <div><a id="twitter" href="http://twitter.com/share" title="Share on Twitter">Twitter</a></div>
         <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
         <div><a id="delicious" href="http://www.delicious.com/save?url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
         <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %] ([% current_url |url %])" title="Share by email">Email</a></div>
-        <div><g:plusone size="small"></g:plusone></div>
+        <div><g:plusone size="small" annotation="none"></g:plusone></div>
+        <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title %]" data-lang="[% lang %]">Tweet</a></div>
     </div>
 [% END %]