function gfeedrssticker(divid, divClass, delay, linktarget){ this.tickerid=divid; this.delay=parseInt(delay); this.mouseoverBol=0; this.itemsperpage=1; this.messagepointer=0; gfeedfetcher.call(this, divid, divClass, linktarget); this.itemcontainer="<div>"; this.tickerdiv=document.getElementById(divid); }
gfeedrssticker.prototype=new gfeedfetcher;
gfeedrssticker.prototype.constructor=gfeedrssticker;
gfeedrssticker.prototype._displayresult=null;
gfeedrssticker.prototype.entries_per_page=function(num){ this.itemsperpage=num};
gfeedrssticker.prototype._signaldownloadcomplete=function(){ this.feedsfetched+=1; if (this.feedsfetched==this.feedurls.length) this._initscroller(this.feeds); }
gfeedrssticker.prototype._initscroller=function(feeds){ var scrollerinstance=this; gfeedfetcher._sortarray(feeds, this.sortstring); this.itemsperpage=(this.itemsperpage>=feeds.length)? 1 : this.itemsperpage; var feedslice=feeds.slice(this.messagepointer, this.itemsperpage); this.tickerdiv.innerHTML=formatrssmessage(feedslice, this.showoptions, this.itemcontainer, this.linktarget); this.tickerdiv.onmouseover=function(){scrollerinstance.mouseoverBol=1}; this.tickerdiv.onmouseout=function(){scrollerinstance.mouseoverBol=0}; this.messagepointer=this.itemsperpage; if (window.attachEvent) window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null}); setTimeout(function(){scrollerinstance._rotatemessage()}, this.delay); }
function formatrssmessage(feedslice, showoptions, itemcontainer, linktarget){ var rssoutput=(itemcontainer=="<li>")? "<ul>\n" : ""; for (var i=0; i<feedslice.length; i++){ var itemtitle="<a href=\"" + feedslice[i].link + "\" target=\"" + linktarget + "\" class=\"titlefield\">" + feedslice[i].title + "</a>"; var itemlabel=/label/i.test(showoptions)? '<span class="labelfield">['+feedslice[i].ddlabel+']</span>' : " "; var itemdate=gfeedfetcher._formatdate(feedslice[i].publishedDate, showoptions); var itemdescription=/description/i.test(showoptions)? "<br />"+feedslice[i].content : /snippet/i.test(showoptions)? "<br />"+feedslice[i].contentSnippet  : ""; rssoutput+=itemcontainer + itemtitle + " " + itemlabel + " " + itemdate + "\n" + itemdescription + itemcontainer.replace("<", "</") + "\n\n"; } rssoutput+=(itemcontainer=="<li>")? "</ul>\n" : ""; return rssoutput; }
gfeedrssticker.prototype._rotatemessage=function(){ var scrollerinstance=this; if (this.mouseoverBol==1) setTimeout(function(){scrollerinstance._rotatemessage()}, 100); else { var feedslice=this.feeds.slice(this.messagepointer, this.messagepointer+this.itemsperpage); this.tickerdiv.innerHTML=formatrssmessage(feedslice, this.showoptions, this.itemcontainer, this.linktarget); this.messagepointer=(this.messagepointer+this.itemsperpage > this.feeds.length-1)? 0 : this.messagepointer+this.itemsperpage; setTimeout(function(){scrollerinstance._rotatemessage()}, this.delay); } }