jQuery RSS/ATOM feed parser plugin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. function JAtom(xml) {
  2. this._parse(xml);
  3. };
  4. JAtom.prototype = {
  5. _parse: function(xml) {
  6. var channel = jQuery('feed', xml).eq(0);
  7. this.version = '1.0';
  8. this.title = jQuery(channel).find('title:first').text();
  9. this.link = jQuery(channel).find('link:first').attr('href');
  10. this.description = jQuery(channel).find('subtitle:first').text();
  11. this.language = jQuery(channel).attr('xml:lang');
  12. this.updated = jQuery(channel).find('updated:first').text();
  13. this.items = new Array();
  14. var feed = this;
  15. jQuery('entry', xml).each( function() {
  16. var item = new JFeedItem();
  17. item.title = jQuery(this).find('title').eq(0).text();
  18. item.link = jQuery(this).find('link').eq(0).attr('href');
  19. item.description = jQuery(this).find('content').eq(0).text();
  20. item.updated = jQuery(this).find('updated').eq(0).text();
  21. item.id = jQuery(this).find('id').eq(0).text();
  22. feed.items.push(item);
  23. });
  24. }
  25. };