用脚本显示最新的推文而不显示@replies

时间:2012-07-08 15:31:22

标签: php javascript jquery plugins twitter

我正在使用http://tweet.seaofclouds.com/中的脚本来显示网站上的最新推文,代码示例7显示了我如何使用它来显示推文而不显示@replies,我试过这个但它不起作用。当我这样做时,它不显示任何东西。

另外,如何重新排序,以便tweet_time在推文后显示?

谢谢!

运行良好的代码,只显示最新的推文:

<script type='text/javascript'>
jQuery(function($){
    $(".tweet").tweet({
        username: "fearofmobs",
        join_text: "auto",
        count: 1,
        auto_join_text_default: "", 
        auto_join_text_ed: "we",
        auto_join_text_ing: "we were",
        auto_join_text_reply: "we replied to",
        auto_join_text_url: "we were checking out",
        loading_text: "loading tweets..."
    });
});

我想要使用的代码应该省略@replies,但不显示任何内容:

<script type='text/javascript'>
jQuery(function($){
    $("#filter").tweet({
      count: 1,
      fetch: 20,
      filter: function(t){ return ! /^@\w+/.test(t.tweet_raw_text); },
      username: "fearofmobs"
    });
  });

1 个答案:

答案 0 :(得分:0)

This jsFiddle looks like what you want -- did I get it right?

jQuery(function($){
  $(".tweet").tweet({
    username: "fearofmobs",
    join_text: "auto",
    count: 20,
    auto_join_text_default: "",
    auto_join_text_ed: "we",
    auto_join_text_ing: "we were",
    auto_join_text_reply: "we replied to",
    auto_join_text_url: "we were checking out",
    loading_text: "loading tweets...",
    fetch: 20,
    filter: function(t){ return ! /^@\w+/.test(t.tweet_raw_text); }
  });
});