pavelk2 / social-feed

JavaScript plugin that shows a user feed from the most popular social networks
http://pavelk2.github.io/social-feed-example/
MIT License
962 stars 304 forks source link

Call to Twitter is Infinite #130

Closed kupoback closed 8 years ago

kupoback commented 8 years ago

When I followed the install instructions I got everything to work, the requests pull the same 3 posts in an infinite loop...Not sure why that is, or what's going on...

Cannot provide a link as it's an internal development site. Otherwise it works great!

Code:

$(document).ready(function(){
    $('.social-feed-container').socialfeed({
        // Twitter
        twitter: {
            accounts: ['@******'],                      //Array: Specify a list of accounts from which to pull tweets  ( Stars to hide )
            limit: 3,                                   //Integer: max number of tweets to load
            consumer_key: '***********',          //String: consumer key. make sure to have your app read-only ( Stars to hide )
            consumer_secret: '**********',//String: consumer secret key. make sure to have your app read-only  ( Stars to hide )
        },
        length:400,                                     //Integer: For posts with text longer than this length, show an ellipsis.
        show_media:true,                                //Boolean: if false, doesn't display any post images
        media_min_width: 300,                           //Integer: Only get posts with images larger than this value
        update_period: 5000,                            //Integer: Number of seconds before social-feed will attempt to load new posts.
        template: "tweet.html",                         //String: Filename used to get the post template.
        template_html:                                  //String: HTML used for each post. This overrides the 'template' filename option
        '<article class="twitter-post"> \
            <h4>{{=it.author_name}}</h4><p>{{=it.text}}  \
                <a href="{{=it.link}}" target="_blank">read more</a> \
                </p> \
        </article>',
        moderation: function(content) {                 //Function: if returns false, template will have class hidden
            return  (content.text) ? content.text.indexOf('fuck') == -1 : true;
        },
        callback: function() {                          //Function: This is a callback function which is evoked when all the posts are collected and displayed
            console.log("All posts collected!");
        }//Integer: For posts with text longer than this length, show an ellipsis.
    });
});
kupoback commented 8 years ago

Fixed issue, was the update_period which was not clearing out the previous displayed posts.