google.load("feeds", "1"); String.prototype.left = function(n) { if (n <= 0) return ""; else if (n > String(this).length) return this; else return String(this).substring(0,n); } function initialize() { var feed = new google.feeds.Feed("http://confluence.webalive.biz/createrssfeed.action?types=blogpost&sort=created&spaces=KB&labelString=marketing,SEO,dev,support,design&rssType=atom&maxResults=5&timeSpan=300&publicFeed=true&title=Blogs"); feed.setNumEntries(5); feed.load(function(result) { if (!result.error) { var container = document.getElementById("feed"); container.style.paddingLeft = "5"; container.style.marginLeft = "5"; for (var i = 0; i < result.feed.entries.length; i++) { var entry = result.feed.entries[i]; var item = document.createElement("li"); var link = document.createElement("a"); var logo = document.createElement("img"); var pubdate = document.createElement("small"); item.style.listStyleType = "none"; item.style.marginBottom = "10px"; pubdate.appendChild(document.createTextNode(entry.publishedDate.left(12))); //pubdate.style.fontSize = "90%"; /* Gen link*/ link.href = entry.link; link.title = entry.title.replace(/\(updated\)/,""); /* strip confluence (updated) tag */ link.title = link.title.left(27) + '...'; /*trim to callums demanding specifications */ link.style.backgroundImageUrl = "http://www.webalive.com.au/uploadedFiles/button-blogcat-" + entry.categories[0] + ".gif"; /* with Logo , if category exists */ //var imageurl = //"http://www.webalive.com.au/uploadedFiles/button-blogcat-" //+ entry.categories[0] + ".gif"; //link.style.background.src = imageurl; if (entry.categories[0]) { /* original */ /*logo.src * ="http://confluence.webalive.biz/download/attachments/3834053/" + * entry.categories[0] + ".png"; */ logo.src ="http://www.webalive.com.au/uploadedFiles/button-blogcat-" + entry.categories[0] + ".gif"; logo.title = "Posted in: " + entry.categories[0]; logo.width = "25"; logo.height = "25"; logo.border = "0"; logo.align ="left"; //logo.style.verticalAlign ="text-top"; logo.style.paddingRight = "5px"; //logo.style.paddingTop = "5px"; //logo.style.marginBottom = "1em"; link.appendChild( logo ); } link.appendChild(pubdate); link.appendChild(document.createElement("br")); link.appendChild(document.createTextNode(link.title)); item.appendChild( link ); //item.appendChild(document.createTextNode(entry.contentSnippet)); container.appendChild(item); } } }); } google.setOnLoadCallback(initialize);