I assume you mean the user is adding to the already shown RSS feeds his/her own feed, instead of replacing the original with the new ones. In general, yes, this should be possible. Firstly, inside gajaxticker.js, add to two instances of the lines below with the code in red:
Code:
this.rtimer=setTimeout(function(){scrollerinstance._rotatemessage()}, this.delay)
Again, there are two of them. Then, you're ready to allow the user to dynamically add a feed into the ticker. Here's a quick demo with a button that when clicked on, adds the "Slashdot" feed as part of the ticker's rotation, on demand. Code in red is new:
Code:
<script type="text/javascript">
var cssfeed=new gfeedrssticker("example1", "example1class", 1000, "_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(2, "date") //Show 10 entries, sort by date
cssfeed.entries_per_page(1)
cssfeed.init()
function adduserFeed(instance, label, url){
instance[label+'count']=(typeof instance[label+'count']=="undefined")? 1 : instance[label+'count']+1
if (instance[label+'count']==1){
if (instance.rtimer)
clearTimeout(instance.rtimer)
instance.addFeed(label, url)
instance.init()
}
}
</script>
<button onClick="adduserFeed(cssfeed, 'Slashdot', 'http://rss.slashdot.org/Slashdot/slashdot')">Add Slashdot</button>
Basically all the new function does is call addFeed() and init() of the original script again, doing some clean up work before hand that could mess things up if not done.
Bookmarks