ajfmrf
08-29-2012, 02:53 AM
// Simple Rss/Crawler Interface Script v1.0 (c)2011 John Davenport Scheuer
// as first seen in http://www.dynamicdrive.com/forums/
// username: jscheuer1 - This Notice Must Remain for Legal Use
rsscrawler.loading = 'images/loading.gif';
function rsscrawler(feedurl, divid, crawlerobj){
var bridgepath = './simplepie/simple_bridge.php', // For syndication, use absolute path.
s = document.createElement('script');
this.displaydiv = document.getElementById(divid);
this.displaydiv.style.visibility = 'visible';
this.displaydiv.innerHTML = '<table id="rssloading" style="height: 100%;"><tbody><tr><td valign="middle" style="height: 100%;"><div>Initializing RSS Feed <img src="' + rsscrawler.loading + '" alt="loading" title=""></div></td></tr></tbody></table>';
feedurl = encodeURIComponent(feedurl);
s.type = 'text/javascript';
s.charset = 'utf-8';
s.src = bridgepath + '?feedurl=' + feedurl + '&divid=' + divid + '&scriptcount=' + rsscrawler.scriptcount + '&bustcache=' + new Date().getTime();
document.getElementsByTagName('head')[0].insertBefore(s, document.getElementsByTagName('script')[rsscrawler.scriptcount++]);
this.init(divid, crawlerobj);
}
rsscrawler.scriptcount = 0;
rsscrawler.rsscontent = {};
(function(){
var i = new Image();
i.src = rsscrawler.loading;
})();
rsscrawler.prototype = {
init: function(divid, crawlerobj){
var rcObj = this;
if(typeof rsscrawler.rsscontent[divid] === 'undefined'){
this.counter = this.counter? this.counter + 1 : 1;
if(this.counter < 40){
setTimeout(function(){rcObj.init(divid, crawlerobj);}, 200);
} else {
this.displaydiv.innerHTML = "<div style='color: red;'>There's a problem retrieving the feed.<\/div>";
}
return;
}
var rsscontent = rsscrawler.rsscontent[divid], div = document.createElement('div'), a = document.createElement('a'), s = document.createElement('span'),
table = document.createElement('table'), tbody = document.createElement('tbody'), tr = document.createElement('tr'), td = document.createElement('td'),
defaultcrawler = {
style: {
width: '100%'
},
mouse: 'cursor driven',
moveatleast: 1,
inc: 18,
noAddedSpace: true,
savedirection: true,
neutral: 150
}, i = 0, p, ts, ta, tdiv;
if(rsscontent.constructor !== Array){
this.displaydiv.innerHTML = "<div style='color: red;'>There's a problem retrieving the feed. The simple_bridge.php file says:<br>" + rsscontent + "<\/div>";
this.displaydiv.style.visibility = 'visible';
return;
}
crawlerobj = crawlerobj || {};
if(crawlerobj.reverse){
rsscontent.reverse();
}
crawlerobj.uniqueid = divid;
for(p in defaultcrawler){
if(crawlerobj.hasOwnProperty && !crawlerobj.hasOwnProperty(p) || !crawlerobj.hasOwnProperty && !crawlerobj[p]){
crawlerobj[p] = defaultcrawler[p];
}
}
a.target = crawlerobj.target || '_new';
a.className = 'rsstitle';
s.className = 'rssdescription';
table.className = 'rsstable';
for(i; i < rsscontent.length; ++i){
tr.appendChild(td.cloneNode(false));
tdiv = div.cloneNode(false);
ta = a.cloneNode(false);
ta.href = rsscontent[i].link.replace(/&/g, '&');
ta.innerHTML = unescape(rsscontent[i].title).replace(/’/g, "’");
tdiv.appendChild(ta);
ts = s.cloneNode(false);
ts.className = 'rssdate';
ts.appendChild(document.createTextNode(unescape(rsscontent[i].date) || 'No Date Available'));
tdiv.appendChild(ts);
ts = s.cloneNode(false);
ts.innerHTML = unescape(rsscontent[i].description).replace(/’/g, "’").replace(/\[CDATA\[|…|\.\.\./g, '');
tdiv.appendChild(ts);
tr.lastChild.appendChild(tdiv);
}
tbody.appendChild(tr);
table.appendChild(tbody);
setTimeout(function(){
while(rcObj.displaydiv.lastChild){
rcObj.displaydiv.removeChild(rcObj.displaydiv.lastChild);
}
rcObj.displaydiv.appendChild(table);
if(!crawlerobj.style.height){
crawlerobj.style.height = rcObj.getheight();
}
marqueeInit(crawlerobj);
}, crawlerobj.delay || 0);
},
getheight: (function(){
return window.getComputedStyle? function(){
return document.defaultView.getComputedStyle(this.displaydiv, null).getPropertyValue('height');
} : function(){
return this.displaydiv.currentStyle['height'];
};
})()
};
From John's script at http://www.dynamicdrive.com/forums/attachment.php?attachmentid=4700&d=1345961048 ( http://www.web-user.info/rss/js/simple_crawler.bak.js)
// as first seen in http://www.dynamicdrive.com/forums/
// username: jscheuer1 - This Notice Must Remain for Legal Use
rsscrawler.loading = 'images/loading.gif';
function rsscrawler(feedurl, divid, crawlerobj){
var bridgepath = './simplepie/simple_bridge.php', // For syndication, use absolute path.
s = document.createElement('script');
this.displaydiv = document.getElementById(divid);
this.displaydiv.style.visibility = 'visible';
this.displaydiv.innerHTML = '<table id="rssloading" style="height: 100%;"><tbody><tr><td valign="middle" style="height: 100%;"><div>Initializing RSS Feed <img src="' + rsscrawler.loading + '" alt="loading" title=""></div></td></tr></tbody></table>';
feedurl = encodeURIComponent(feedurl);
s.type = 'text/javascript';
s.charset = 'utf-8';
s.src = bridgepath + '?feedurl=' + feedurl + '&divid=' + divid + '&scriptcount=' + rsscrawler.scriptcount + '&bustcache=' + new Date().getTime();
document.getElementsByTagName('head')[0].insertBefore(s, document.getElementsByTagName('script')[rsscrawler.scriptcount++]);
this.init(divid, crawlerobj);
}
rsscrawler.scriptcount = 0;
rsscrawler.rsscontent = {};
(function(){
var i = new Image();
i.src = rsscrawler.loading;
})();
rsscrawler.prototype = {
init: function(divid, crawlerobj){
var rcObj = this;
if(typeof rsscrawler.rsscontent[divid] === 'undefined'){
this.counter = this.counter? this.counter + 1 : 1;
if(this.counter < 40){
setTimeout(function(){rcObj.init(divid, crawlerobj);}, 200);
} else {
this.displaydiv.innerHTML = "<div style='color: red;'>There's a problem retrieving the feed.<\/div>";
}
return;
}
var rsscontent = rsscrawler.rsscontent[divid], div = document.createElement('div'), a = document.createElement('a'), s = document.createElement('span'),
table = document.createElement('table'), tbody = document.createElement('tbody'), tr = document.createElement('tr'), td = document.createElement('td'),
defaultcrawler = {
style: {
width: '100%'
},
mouse: 'cursor driven',
moveatleast: 1,
inc: 18,
noAddedSpace: true,
savedirection: true,
neutral: 150
}, i = 0, p, ts, ta, tdiv;
if(rsscontent.constructor !== Array){
this.displaydiv.innerHTML = "<div style='color: red;'>There's a problem retrieving the feed. The simple_bridge.php file says:<br>" + rsscontent + "<\/div>";
this.displaydiv.style.visibility = 'visible';
return;
}
crawlerobj = crawlerobj || {};
if(crawlerobj.reverse){
rsscontent.reverse();
}
crawlerobj.uniqueid = divid;
for(p in defaultcrawler){
if(crawlerobj.hasOwnProperty && !crawlerobj.hasOwnProperty(p) || !crawlerobj.hasOwnProperty && !crawlerobj[p]){
crawlerobj[p] = defaultcrawler[p];
}
}
a.target = crawlerobj.target || '_new';
a.className = 'rsstitle';
s.className = 'rssdescription';
table.className = 'rsstable';
for(i; i < rsscontent.length; ++i){
tr.appendChild(td.cloneNode(false));
tdiv = div.cloneNode(false);
ta = a.cloneNode(false);
ta.href = rsscontent[i].link.replace(/&/g, '&');
ta.innerHTML = unescape(rsscontent[i].title).replace(/’/g, "’");
tdiv.appendChild(ta);
ts = s.cloneNode(false);
ts.className = 'rssdate';
ts.appendChild(document.createTextNode(unescape(rsscontent[i].date) || 'No Date Available'));
tdiv.appendChild(ts);
ts = s.cloneNode(false);
ts.innerHTML = unescape(rsscontent[i].description).replace(/’/g, "’").replace(/\[CDATA\[|…|\.\.\./g, '');
tdiv.appendChild(ts);
tr.lastChild.appendChild(tdiv);
}
tbody.appendChild(tr);
table.appendChild(tbody);
setTimeout(function(){
while(rcObj.displaydiv.lastChild){
rcObj.displaydiv.removeChild(rcObj.displaydiv.lastChild);
}
rcObj.displaydiv.appendChild(table);
if(!crawlerobj.style.height){
crawlerobj.style.height = rcObj.getheight();
}
marqueeInit(crawlerobj);
}, crawlerobj.delay || 0);
},
getheight: (function(){
return window.getComputedStyle? function(){
return document.defaultView.getComputedStyle(this.displaydiv, null).getPropertyValue('height');
} : function(){
return this.displaydiv.currentStyle['height'];
};
})()
};
From John's script at http://www.dynamicdrive.com/forums/attachment.php?attachmentid=4700&d=1345961048 ( http://www.web-user.info/rss/js/simple_crawler.bak.js)