[Koha-patches] [PATCH] Bug 7932 - twitter share doesn't work with socialnetworks

Owen Leonard oleonard at myacpl.org
Wed May 16 21:43:48 CEST 2012


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.

This fix will have to be manually merged with the social
networks followup for Bug 7500 (image sprites) if and when that
patch is approved.
---
 koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
index cc59fb2..090c473 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
@@ -8,6 +8,7 @@
     <script type="text/javascript" src="https://apis.google.com/js/plusone.js">
       {lang: '[% lang %]'}
     </script>
+    <script>!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 %]
 <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" />
@@ -1208,12 +1209,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 [% IF ( SocialNetworks ) %]
     <div class="social_networks">
         <span>Share</span>
-        <a href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook"><img alt="Share on Facebook" src="/opac-tmpl/prog/images/socnet/facebook16.png" /></a>
-        <a href="http://twitter.com/share" title="Share on Twitter"><img alt="Share on Twitter" src="/opac-tmpl/prog/images/socnet/twitter16.png" /></a>
+        <a href="https://www.facebook.com/sharer.php?u=[% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook"><img alt="Share on Facebook" src="/opac-tmpl/prog/images/socnet/facebook16.png" /></a>
         <a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn"><img alt="Share on LinkedIn" src="/opac-tmpl/prog/images/socnet/linkedin16.png" /></a>
-        <a href="http://www.delicious.com/save?url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious"><img alt="Share on Delicious" src="/opac-tmpl/prog/images/socnet/delicious16.gif" /></a>
-        <g:plusone size="small"></g:plusone>
-        <a href="mailto:ADRESSE?subject=TO READ : [% title %]>&amp;body=[% title %]> [% current_url |url %]" title="Share by email"><img alt="Share by email" src="/opac-tmpl/prog/images/socnet/mailto16.png" /></a>
+        <a href="http://www.delicious.com/save?url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious"><img alt="Share on Delicious" src="/opac-tmpl/prog/images/socnet/delicious16.gif" /></a>        <a href="mailto:ADRESSE?subject=TO READ : [% title %]>&amp;body=[% title %]> [% current_url |url %]" title="Share by email"><img alt="Share by email" src="/opac-tmpl/prog/images/socnet/mailto16.png" /></a>
+        <g:plusone size="small" annotation="none"></g:plusone>
+    <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title %]" data-url="https://[% current_url %]" data-lang="[% en %]">Tweet</a>
     </div>
 [% END %]
 
-- 
1.7.9.5



More information about the Koha-patches mailing list