Google's Dynamic Feed Wizard is really good.
http://www.google.com/uds/solutions/wizards/dynamicfeed.html
BUT I found a problem with facebook feeds. The feed displayed fine BUT the links to go to external feed or items were relative links to local site.
e.g. /posted.php?id=199235386657&share_id=155115854527260&comments=1#s155115854527260 instead of:
http://www.facebook.com//posted.php?id=199235386657&share_id=155115854527260&comments=1#s155115854527260
This is where we're using it: http://lhra.info/
See also the changed javascript: (hardcoded for facebook feed as it is at current moment in time = Oct17 2010) http://lhra.info/gfdynamicfeedcontrol_forfacebook.js
Also changed is ability to default title link to not what is returned by RSS feed.
wwwLHRA$ diff -u gfdynamicfeedcontrol.js gfdynamicfeedcontrol_forfacebook.js
--- gfdynamicfeedcontrol.js 2010-10-17 01:23:52.000000000 +0100
+++ gfdynamicfeedcontrol_forfacebook.js 2010-10-17 02:39:08.000000000 +0100
@@ -27,7 +27,7 @@
this.feeds = [];
this.results = [];
-alert("debug feedUrls:"+feedUrls);
+//alert("debug feedUrls:"+feedUrls);
if (typeof feedUrls == 'string') {
this.feeds.push({url:feedUrls});
@@ -45,7 +45,7 @@
o.title = s.replace(//g, '>');
}
}
-alert("debug maybe url:"+o.url);
+//alert("debug maybe url:"+o.url);
this.feeds.push(o);
}
}
@@ -115,7 +115,8 @@
sortByDate : false,
horizontal : false,
stacked : false,
- title : null
+ title : null,
+ titleurl : null
};
if (options) {
@@ -162,7 +163,7 @@
// The feedControl instance for generating entry HTML.
this.feedControl = new google.feeds.FeedControl();
this.feedControl.setLinkTarget(this.options.linkTarget);
-alert("debug this.options.linkTarget:"+this.options.linkTarget);
+//alert("debug this.options.linkTarget:"+this.options.linkTarget);
// The feeds
@@ -174,7 +175,7 @@
feed.setResultFormat(google.feeds.Feed.JSON_FORMAT);
feed.setNumEntries(this.options.numResults);
feed.load(this.bind_(this.feedLoaded_, i));
-alert("debug feed "+i+" :"+feed);
+//alert("debug feed "+i+" :"+feed);
}
};
@@ -217,6 +218,14 @@
if (this.feeds[index].title) {
result.feed.title = this.feeds[index].title;
}
+//alert("debug result:"+result+" tit:"+result.feed.title);
+//alert("debug feed i:"+index+" result:"+result+" tit:"+result.feed.title+" lin:"+result.feed.link);
+ var entries = result.feed.entries;
+ // CHANGE RELATIVE Facebook URL to ABSOLUTE for use in external page
+ for (var i = 0; i < entries.length; i++) {
+ //alert("debug ent i:"+i+" e:"+entries[i]+" tit:"+entries[i].title+" //lin:"+entries[i].link);
+ result.feed.entries[i].link="http://www.facebook.com/"+entries[i].link
+ }
this.results.push(result);
if (!this.started) {
@@ -375,9 +384,14 @@
this.clearNode_(el);
var link = document.createElement('a');
link.target = google.feeds.LINK_TARGET_BLANK;
- link.href = resultFeed.link;
+ // SET The URL the feed title links to (was http://www.facebook.com, we wish to link to facebook/ourgroup)
+ if (this.options.titleurl == null) {
+ this.options.titleurl = resultFeed.link;
+ }
+ link.href = this.options.titleurl;
link.className = 'gfg-collapse-href';
link.innerHTML = resultFeed.title;
+//alert("debug title link:"+link+" link.href:"+link.href);
el.appendChild(link);
}
@@ -408,10 +422,13 @@
var className = 'gfg-listentry ';
className += (i%2)?'gfg-listentry-even':'gfg-listentry-odd';
var listEntry = this.createDiv_(className);
-alert("debug entry create link:"+entries[i].link+" title:"+entries[i].title);
- var link = this.createLink_("http://www.facebook.com/"+entries[i].link,
+//alert("debug entry create link:"+entries[i].link+" title:"+entries[i].title);
+ // adjusting the link URL here (from relative to absolute) worked for list elements but not selected item
+ //entries[i].link="http://www.facebook.com/"+entries[i].link
+ var link = this.createLink_(entries[i].link,
entries[i].title,
this.options.linkTarget);
+
listEntry.appendChild(link);
if (this.options.pauseOnHover) {
listEntry.onmouseover = this.bind_(this.listMouseOver_, resultIndex, i);
Javascript debugger (Venkmann+Firefox) a bit crashy, hence the old alert("") style debugging.
One thing to do to change this from hack to good solution would be detect relative URLs (look for beginning which is not http:// or file:// ...) and do the right thing.
Surprised grepping internet to not find people finding this problem ... ?
No comments:
Post a Comment