Advanced Search

Results 1 to 2 of 2

Thread: gAjax RSS Feeds Displayer v2.0

  1. #1
    Join Date
    Jun 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default gAjax RSS Feeds Displayer v2.0

    1) gAjax RSS Feeds Displayer v2.0

    2) http://www.dynamicdrive.com/dynamici...sdisplayer.htm

    3) I'm trying to create a feature that would allow a user to load multiple rss feeds using a set of check boxes. I can get it so that when a checkbox is clicked it loads up the selected rss feed, but I can't figure out how to clear it when it's unchcked. Any thoughts or help on this?

    Code:
    function validate1(){
      var yahoo = document.getElementById('yahoo');
      if (yahoo.checked){
        example3.addFeed("Yahoo", "http://dir.yahoo.com/rss/dir/getrss.php?arts");
    	example3.init()
      } else {
      //clear rss feed
    
      }
    }         
    
    function validate2(){
      var msnbc = document.getElementById('msnbc');
      if (msnbc.checked){
        example3.addFeed("MSNBC", "http://feeds.nbcnews.com/feeds/topstories");
    	example3.init();
      } else {
      //clear rss feed
    
      }

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,672
    Thanks
    43
    Thanked 3,125 Times in 3,091 Posts
    Blog Entries
    12

    Default

    You can use this function (using a text only editor like NotePad, add it to the end of the gfeedfetcher.js file):

    Code:
    function removefeed(feed, removelabel){
    	var labels = feed.feedlabels, i = -1, keptfeeds = {};
    	while (++i < labels.length){
    		if(labels[i] !== removelabel){
    			keptfeeds[labels[i]] = feed.feedurls[i];
    		}
    	}
    	feed.feedcontainer.innerHTML = '';
    	feed.feeds = {};
    	feed.feedlabels = [];
    	feed.feedurls = [];
    	for(var f in keptfeeds){
    		feed.addFeed(f, keptfeeds[f]);
    	}
    	feed.feedlabels.length && feed.init();
    }
    For example:

    Code:
    function validate1(){
      var yahoo = document.getElementById('yahoo');
      if (yahoo.checked){
        example3.addFeed("Yahoo", "http://dir.yahoo.com/rss/dir/getrss.php?arts");
    	example3.init()
      } else {
      removefeed(example3, 'Yahoo'); //clear rss feed
    
      }
    }
    Just be aware that, if example3 has no other feeds, it will be empty after removing it's only feed.
    Last edited by jscheuer1; 06-27-2013 at 12:30 AM. Reason: minor code improvement
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. gAjax RSS Feeds Displayer - Edit Feeds Shown
    By dsol828 in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 08-01-2012, 07:11 PM
  2. gAjax RSS Feeds Displayer - ignore broken feeds?
    By kblm in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 05-24-2012, 10:18 PM
  3. Replies: 0
    Last Post: 09-05-2011, 09:18 AM
  4. gAjax RSS Feeds Displayer - can't display multiple feeds
    By nsbrown in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 06-06-2008, 08:40 AM
  5. gAjax RSS Feeds Displayer: Feeds with no publishedDate
    By mfreeman in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 03-30-2008, 07:56 AM

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
  •