Results 1 to 9 of 9

Thread: gAjax RSS Feeds Displayer - trigger jQuery function?

  1. #1
    Join Date
    May 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default gAjax RSS Feeds Displayer - trigger jQuery function?

    1) Script Title: gAjax RSS Feeds Displayer

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...sdisplayer.htm

    3) Describe problem:

    Is there anyway to have the gAjax RSS Feeds Displayer script....make a call to a jQuery function ONCE it's done loading feeds?

    I am trying to put this into a jQuery scroller.....the scroller at times is firing before the RSS script is done outputting (I think).

    For now, I'm delaying the jQuery scroller with a set time....but I'd like to have the scroller only fire when the RSS feed script is done.

    Any clues on how to do that?

    -Kevin

  2. #2
    Join Date
    May 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    So do you think it's ok to just put my jQuery calls at the end of the:

    gfeedfetcher.prototype._displayresult=function(feeds){

    function?

    Won't this not load the jQuery until all the feeds are written out?

    -Kevin

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    I've just updated the official version of the script to incorporate the two features you asked for:

    1) Ability to execute your own code when a RSS Displayer has loaded, via the callback function onfeedload()

    2) Script now skips a RSS feed entirely if it's invalid, moving on to the next if there are more than one feed defined for a RSS Displayer.

    Only the .js file of the script has been modified. To take advantage of 1), just use the syntax:

    Code:
    var newsfeed=new gfeedfetcher("example3", "example3class", "_new")
    newsfeed.addFeed("BBC", "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml") //Specify "label" plus URL to RSS feed
    newsfeed.addFeed("MSNBC", "http://www.msnbc.msn.com/id/3032091/device/rss/rss.xml") //Specify "label" plus URL to RSS feed
    newsfeed.addFeed("Yahoo News", "http://rss.news.yahoo.com/rss/topstories") //Specify "label" plus URL to RSS feed
    newsfeed.displayoptions("datetime snippet") //show the specified additional fields
    newsfeed.setentrycontainer("p") //Display each entry as a paragraph
    newsfeed.filterfeed(8, "date") //Show 8 entries, sort by date
    newsfeed.onfeedload=function(){
    	alert('hi')
    }
    newsfeed.init() //Always call this last
    Last edited by ddadmin; 05-24-2012 at 10:40 PM.
    DD Admin

  4. The Following User Says Thank You to ddadmin For This Useful Post:

    kblm (05-24-2012)

  5. #4
    Join Date
    May 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    DD Admin

    Thank you so much! That is AWESOME!

    Going to grab the new code and try it out now.

    -Kevin

  6. #5
    Join Date
    May 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    I've just updated the official version of the script to incorporate the two features you asked for:

    1) Ability to execute your own code when a RSS Displayer has loaded, via the callback function onfeedload()

    2) Script now skips a RSS feed entirely if it's invalid, moving on to the next if there are more than one feed defined for a RSS Displayer.

    Only the .js file of the script has been modified. To take advantage of 1), just use the syntax:

    Code:
    var cssfeed=new gfeedpausescroller("example1", "example1class", 2000, "_new")
    cssfeed.addFeed("CSS Drive", "http://www.cssdrive.com/index.php/news/rss_2.0/") //Specify "label" plus URL to RSS feed
    cssfeed.displayoptions("date") //show the specified additional fields
    cssfeed.setentrycontainer("div") //Wrap each entry with a DIV tag
    cssfeed.filterfeed(10, "date") //Show 10 entries, sort by date
    cssfeed.entries_per_page(1)
    cssfeed.onfeedload=function(){
     alert('all done!')
    }
    cssfeed.init()
    Couple of questions....

    You have a different var:
    var cssfeed=new gfeedpausescroller("example1", "example1class", 2000, "_new")

    And a new option:
    cssfeed.entries_per_page(1)

    I'm guessing these aren't supposed to be in there? When I remove them and set it back to the original gfeedfetcher it works.

    -Kevin

  7. #6
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Hi Kevin:
    Yep, "cssfeed" is just an example, you should replace it with the variable name you used to initialize the script. cssfeed.entries_per_page(1) shouldn't be there, I've removed it.
    DD Admin

  8. #7
    Join Date
    May 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    Hi Kevin:
    Yep, "cssfeed" is just an example, you should replace it with the variable name you used to initialize the script. cssfeed.entries_per_page(1) shouldn't be there, I've removed it.
    Yeah I got that part....I was asking about the gfeedpausescroller and the option: .entries_per_page(1)

    I need to call gfeedfetcher for it to work.

    Are those for a different script?

    -Kevin

  9. #8
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Ah yes I see why you're confused- I used a variant of the RSS Displayer script, the RSS Scroller, in the sample code I posted. The process is the same, but here is an example initialization code for RSS Displayer itself:

    Code:
    var newsfeed=new gfeedfetcher("example3", "example3class", "_new")
    newsfeed.addFeed("BBC", "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml") //Specify "label" plus URL to RSS feed
    newsfeed.addFeed("MSNBC", "http://www.msnbc.msn.com/id/3032091/device/rss/rss.xml") //Specify "label" plus URL to RSS feed
    newsfeed.addFeed("Yahoo News", "http://rss.news.yahoo.com/rss/topstories") //Specify "label" plus URL to RSS feed
    newsfeed.displayoptions("datetime snippet") //show the specified additional fields
    newsfeed.setentrycontainer("p") //Display each entry as a paragraph
    newsfeed.filterfeed(8, "date") //Show 8 entries, sort by date
    newsfeed.onfeedload=function(){
    	alert('hi')
    }
    newsfeed.init() //Always call this last
    DD Admin

  10. #9
    Join Date
    May 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    Ah yes I see why you're confused- I used a variant of the RSS Displayer script, the RSS Scroller, in the sample code I posted. The process is the same, but here is an example initialization code for RSS Displayer itself:
    Thanks so much. Works perfectly!

    -Kevin

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •