Skip to content

Instantly share code, notes, and snippets.

@logeshpaul
Created March 12, 2013 04:34
Show Gist options
  • Save logeshpaul/5140381 to your computer and use it in GitHub Desktop.
Save logeshpaul/5140381 to your computer and use it in GitHub Desktop.
Fetch RSS feeds from any site
.feedEkList{
color: #918d8a;
}
.itemTitle {
width: 300px;
height: 25px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.itemTitle a {
font-size: 14px;
color: #918D8A;
text-decoration:none;
text-transform: none !important;
}
.itemTitle a:hover {
color: #F8AF2C;
text-decoration:underline;
}
.itemContent {
color: #585755;
}
/*
* FeedEk jQuery RSS/ATOM Feed Plugin v1.1.2
* http://jquery-plugins.net/FeedEk/FeedEk.html
* Author : Engin KIZIL
* http://www.enginkizil.com
*/
(function (e) { e.fn.FeedEk = function (t) { var n = { FeedUrl: "http://rss.cnn.com/rss/edition.rss", MaxCount: 5, ShowDesc: true, ShowPubDate: true, CharacterLimit: 0, TitleLinkTarget: "_blank" }; if (t) { e.extend(n, t) } var r = e(this).attr("id"); var i; e("#" + r).empty().append('<div style="padding:3px;"><img src="loader.gif" /></div>'); e.ajax({ url: "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=" + n.MaxCount + "&output=json&q=" + encodeURIComponent(n.FeedUrl) + "&hl=en&callback=?", dataType: "json", success: function (t) { e("#" + r).empty(); var s = ""; e.each(t.responseData.feed.entries, function (e, t) { s += '<li><div class="itemTitle"><a href="' + t.link + '" target="' + n.TitleLinkTarget + '" >' + t.title + "</a></div>"; if (n.ShowPubDate) { i = new Date(t.publishedDate); s += '<div class="itemDate">' + i.toLocaleDateString() + "</div>" } if (n.ShowDesc) { if (n.DescCharacterLimit > 0 && t.content.length > n.DescCharacterLimit) { s += '<div class="itemContent">' + t.content.substr(0, n.DescCharacterLimit) + "...</div>" } else { s += '<div class="itemContent">' + t.content + "</div>" } } }); e("#" + r).append('<ul class="feedEkList">' + s + "</ul>") } }) } })(jQuery)
<html>
<body>
<div id="divRss">
</div>
</body>
jQuery(document).ready(function () {
jQuery('#divRss').FeedEk({
FeedUrl: 'http://corporate.conovercompany.com/feed/',
MaxCount: 3,
ShowPubDate: false,
DescCharacterLimit: 100
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment