Skip to content

Instantly share code, notes, and snippets.

@rkmax
Last active December 26, 2015 00:09
Show Gist options
  • Save rkmax/7061918 to your computer and use it in GitHub Desktop.
Save rkmax/7061918 to your computer and use it in GitHub Desktop.
Procesar ATOM+XML
;(function() {
"use strict";
item = function(entry) {
var
$a = $('<a>', {href: entry.link, text: entry.title}),
//$li = $('<li>').append($a),
tmpl = '<h2>TITLE</h2>IMAGE<p>SNIPET</p>',
image = $(entry.conten).find('img')[0],
content = ''
;
content = tmpl.replace('TITLE', entry.title);
content = content.replace('IMAGE', image);
content = content.replace('SNIPET', entry.contentSnippet);
$a.qtip({
content: {
text: content
}
});
// return $li;
return $('<li>').append($a);
};
list = function(entries) {
var
$ul = $('<ul>')
;
for (var i = entries.length - 1; i >= 0; i--) {
$ul.append( item(entries[i]) );
};
return $ul;
};
initialize = function() {
var feed = new google.feeds.Feed(URL);
feed.load(function(result) {
if (!result.error) {
$('#scrollableFeeds').append(list(result.feed.entries));
}
});
};
google.load('feeds', '1');
google.setOnLoadCallback(initialize);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment