Extending Heise SocialSharePrivacy to pass a dynamic title to twitter

Flattr this
Tweet this: Extending Heise SocialSharePrivacy to pass a dynamic title to twitter
Dent this: Extending Heise SocialSharePrivacy to pass a dynamic title to twitter
Datum: 07.12.2011 20:02:56
Yesterday I had a look at Heise SocialSharePrivacy and experimented around with it (probably will integrate it here via a plugin) but one think I was missing was a way to use it on a list of items, while having different titles for the twitter text, not using the current pages title. Currently it only allows for a static title or a function. But the function was worthless in this case, since I wanted to use the title each specific link. An example based on their ones to describe it a bit more.
<div class="anriss">
    <h3><a href="http://www.heise.de">heise</a></h3>
    <p>lorem ipsum</p>
    <div class="social"></div>
</div>

<div class="anriss">
    <h3><a href="http://www.heise.de/security/">heise security</a></h3>
    <p>dolor sit amet</p>
    <div class="social"></div>
</div>

<script>
$(".social").socialSharePrivacy({
    uri : function(context) {
        return $(context).parents(".anriss").find("h3 a").attr("href");
    }
    service : {
        twitter: {
            'tweet_text': function (context) {
                return $(content).parents(".anriss").find("h3 a").text();
            }
        }
    }
});
</script>
All you need to do to get it working is changing line 196 of the jQuery Plugin from
text = text();
to
text = text(context);
Now you have access to the context inside your function. I just mailed it to Heise, let's see what they thing about it.

Trackbacks (0)

Trackbackurl: http://www.robo47.net/trackback/blogentry/214

Es sind keine Trackbacks vorhanden.


Kommentare (0)

Es sind noch keine Kommentare vorhanden.

Die Kommentare zu diesem Beitrag sind gesperrt.

You liked it ? Link it on your homepage or blog: