Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.jGFeed(
- href,
- function(feeds){
- if(!feeds) {
- container.append('Error fetching feed');
- return false;
- }
- container.hide();
- container.removeClass('loading');
- container.append('<h2>' + feeds.title + '</h2>');
- //process feed entries
- for(var i=0; i<feeds.entries.length; i++){
- var entry = feeds.entries[i];
- //build html string for entry
- var html = '<div class ="ajax-feed-item">';
- html += '<h3><a href="" + entry.link + "">';
- html += entry.title + '</a></h3>';
- html += '<div class="ajax-feed-date">';
- html += entry.publishedDate + '</div>';
- html += '<div class="ajax-feed-author">';
- html += entry.author + '</div>';
- html += '<div class="ajax-feed-content-snippet">';
- html += entry.contentSnippet + '</div>';
- html += '<div id="ajax-feed-content-' +i;
- html += '" class-"ajax-feed-content" ';
- html += 'style="height:0px; overflow:hidden;">';
- html += entry.content + '</div>';
- html += '<div><a class="ajax-feed-readmore" ';
- html += 'href="' + i + '">+</a></div>';
- html += '</div>';
- container.append(html);
- }
- $('a.ajax-feed-readmore').click(function(e){
- e.preventDefault();
- var content_id = $(this).attr('href');
- var div_id = 'ajax-feed-content-' + content_id;
- var content_div = $('#' + div_id);
- var content_txt = content_div.html();
- var snippet_div = content_div.prev();
- var snippet_txt = snippet_div.html();
- content_div.html(snippet_txt);
- snippet_div.html(content_txt);
- if ($(this).html() === '-')
- {
- $(this).html('+');
- }
- else
- {
- $(this).html('-');
- }
- });
- container.show('slow');
- },
- 10
- );//end jGfeed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement