Twitter 推文或转发回调

发布于 2024-09-16 16:33:59 字数 417 浏览 4 评论 0原文

希望您玩得开心。 我正在创建一个网站,当用户在 Twitter 上发布 WordPress 博客条目时,他们就会在网站上获得积分。

所以基本上,如果用户在他的 Twitter 上发布了该条目,那么我们会给他一些积分以供他在网站上使用(而不是金钱)。虽然这件事在 Facebook 上似乎可行,但据我所知,在 Twitter 上却不然。

我愿意通过 Twitter Tweet Button 或 TweetMeme Retweet Facility 尝试这两种方式。然而,我在这两个地方都找不到回调的设施。

我正在 Facebook 中实现类似的功能,并且使用 FBML JS SDK 可以看到隧道尽头的曙光。然而,如果 Twitter 也能实现类似的目标,那就太棒了。

很想听到你们的更多消息,

亲切的问候,

Khuram

Hope you are having a good time.
I am creating a website where when users Tweet a wordpress blog entry then they get points on the websites.

So basically, if a user Tweets that entry on his Twitter then we would give him some points to use on the website (not money). Although this thing is plausible with Facebook but not with Twitter in my knowledge.

I am willing to try to both ways by Twitter Tweet Button or TweetMeme Retweet Facility. However, I could not find a facility for a callback at neither of these.

I am implementing a similar functionality in Facebook and I can see the light at the end of the tunnel with using FBML JS SDK. HOwever, if something similar can be achieved with Twitter then it would be awesome.

Would love to hear more from you guys,

Kind Regards,

Khuram

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

累赘 2024-09-23 16:33:59

他们用意图函数解决了这个问题:

https://dev.twitter.com/pages/intents -事件

twttr.events.bind('tweet', function(event) {
// Do something there
});

或点击

twttr.events.bind('click', function(event) {
var click_type = event.region;
});

They've fixed this with the intents function:

https://dev.twitter.com/pages/intents-events

twttr.events.bind('tweet', function(event) {
// Do something there
});

or for clicking

twttr.events.bind('click', function(event) {
var click_type = event.region;
});
葬シ愛 2024-09-23 16:33:59

使用 Twitter @anywhere api,您可以设置一个 onTweet 函数,该函数在有人发推文时执行某些操作。

这是6-步骤教程,参见编号 4

可以在带有注释类的元素之后调用默认的 tweetBox,并使用以下代码片段。

twttr.anywhere(function(twitter) {
    twitter(".comments").tweetBox();
});

因此,如果您想要自定义标签、内容以及发送推文时的回调,请使用此代码。

twitter(".comments").tweetBox({
    label: 'What do you think about this article?',
    defaultContent: '#nettuts ',
    onTweet: function(plain, html){
        // Actions when tweet is sent
    }
});

using Twitters @anywhere api, you can set an onTweet function that does something when someone tweets.

here is a 6-step tutorial, see number 4

A default tweetBox can be called after the element with the comments class with the following snippet.

twttr.anywhere(function(twitter) {
    twitter(".comments").tweetBox();
});

So if you want a custom label, content, and a callback when the tweet has been sent, use this code.

twitter(".comments").tweetBox({
    label: 'What do you think about this article?',
    defaultContent: '#nettuts ',
    onTweet: function(plain, html){
        // Actions when tweet is sent
    }
});
苍暮颜 2024-09-23 16:33:59

从 JS 代码打开推文意图弹出将发送回调。您需要将您的推文 URL 放入锚标记

HTML:

<a target="_blank" href="https://twitter.com/intent/tweet?text=itismytext&url=http://google.com"> twitter share</a>

JavaScript:

$(document).ready(function(){

    twttr.events.bind('tweet', function(event) {
        console.log(event);
        // OR
        alert(JSON.stringify(event));
    });

});

opening tweet intent pop from JS code will send a callback. You need to put your tweet URL in herf of anchor tag

HTML:

<a target="_blank" href="https://twitter.com/intent/tweet?text=itismytext&url=http://google.com"> twitter share</a>

JavaScript:

$(document).ready(function(){

    twttr.events.bind('tweet', function(event) {
        console.log(event);
        // OR
        alert(JSON.stringify(event));
    });

});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文