// ------------------------------------------------------------------- // Advanced RSS Ticker (Ajax invocation) core file // Author: Dynamic Drive (https://www.dynamicdrive.com) // ------------------------------------------------------------------- //Relative URL syntax: //var lastrssbridgeurl="/lastrss/bridge.php" //Absolute URL syntax. Uncomment below line if you wish to use an absolute reference: var lastrssbridgeurl="https://"+window.location.hostname+"/_lu/lastrss/bridge.php" ////////////No need to edit beyond here////////////// function createAjaxObj(){ var httprequest=false if (window.XMLHttpRequest){ // if Mozilla, Safari etc httprequest=new XMLHttpRequest() if (httprequest.overrideMimeType) httprequest.overrideMimeType('text/xml') } else if (window.ActiveXObject){ // if IE try { httprequest=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ try{ httprequest=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){} } } return httprequest } // ------------------------------------------------------------------- // Main RSS Ticker Object function // rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, optionallogicswitch) // ------------------------------------------------------------------- function rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, logicswitch){ this.RSS_id=RSS_id //Array key indicating which RSS feed to display this.cachetime=cachetime //Time to cache feed, in minutes. 0=no cache. this.tickerid=divId //ID of ticker div to display information this.delay=delay //Delay between msg change, in miliseconds. this.logicswitch=(typeof logicswitch!="undefined")? logicswitch : "" this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is) this.pointer=0 this.opacitysetting=0.2 //Opacity value when reset. Internal use. this.title=[], this.link=[], this.description=[], this.pubdate=[] //Arrays to hold each component of an RSS item this.ajaxobj=createAjaxObj() document.write('
Initializing ticker...
') if (window.getComputedStyle) //detect if moz-opacity is defined in external CSS for specified class this.mozopacityisdefined=(window.getComputedStyle(document.getElementById(this.tickerid), "").getPropertyValue("-moz-opacity")==1)? 0 : 1 this.getAjaxcontent() } // ------------------------------------------------------------------- // getAjaxcontent()- Makes asynchronous GET request to "bridge.php" with the supplied parameters // ------------------------------------------------------------------- rssticker_ajax.prototype.getAjaxcontent=function(){ if (this.ajaxobj){ var instanceOfTicker=this var parameters="id="+encodeURIComponent(this.RSS_id)+"&cachetime="+this.cachetime+"&bustcache="+new Date().getTime() this.ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()} this.ajaxobj.open('GET', lastrssbridgeurl+"?"+parameters, true) this.ajaxobj.send(null) } } // ------------------------------------------------------------------- // initialize()- Initialize ticker method. // -Gets contents of RSS content and parse it using JavaScript DOM methods // ------------------------------------------------------------------- rssticker_ajax.prototype.initialize=function(){ if (this.ajaxobj.readyState == 4){ //if request of file completed if (this.ajaxobj.status==200){ //if request was successful var xmldata=this.ajaxobj.responseXML if(xmldata.getElementsByTagName("item").length==0){ //if no elements found in returned content document.getElementById(this.tickerid).innerHTML="Error fetching remote RSS feed!
"+this.ajaxobj.responseText return } var instanceOfTicker=this this.feeditems=xmldata.getElementsByTagName("item") //Cycle through RSS XML object and store each peice of an item inside a corresponding array for (var i=0; i'+this.title[this.pointer]+'' var description='
'+this.description[this.pointer]+'
' var feeddate='
'+this.pubdate[this.pointer]+'
' if (this.logicswitch.indexOf("description")==-1) description="" if (this.logicswitch.indexOf("date")==-1) feeddate="" var tickercontent=linktitle+feeddate+description //STRING FOR FEED CONTENTS this.fadetransition("reset") //FADE EFFECT- RESET OPACITY tickerDiv.innerHTML=tickercontent this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100) //FADE EFFECT- PLAY IT this.pointer=(this.pointer=1) clearInterval(this[timerid]) }