Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

Shitload of features and fixes #23

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0b5045a
adding activitystreams module
max-mapper Apr 23, 2011
6097bbe
updating jquery from 1.1 (lol) to 1.5
max-mapper Apr 23, 2011
343dbe4
capture georss points
max-mapper Apr 23, 2011
324aa0d
wrapping in jquery closure
max-mapper Apr 23, 2011
1266011
also grab georss from rss, not just atom
max-mapper Apr 24, 2011
d00a839
links dont have hrefs
max-mapper Apr 24, 2011
5d8bf24
- added JFeedItem property "author"
jakoch Nov 30, 2011
dacb07e
Added "content" property to JAtom.
ricvelozo Jun 10, 2012
c06c4de
Added "content" property to JRss.
ricvelozo Jun 10, 2012
4e60d00
Indentation fix.
ricvelozo Jun 10, 2012
b690252
Added "content" property to JFeedItem.
ricvelozo Jun 10, 2012
8412700
Adding enclosure tag (RSS 2.0 specification)
rmarquois Nov 12, 2012
4d232fb
Adding enclosure tag (RSS 2.0 specification) see https://github.com/r…
jakoch Jan 18, 2013
1f13949
added "Support to full text feeds" see https://github.com/jfhovinne/j…
jakoch Jan 18, 2013
7cae4c8
added "jQuery conflict fix" https://github.com/jfhovinne/jFeed/pull/11
jakoch Jan 18, 2013
e0eb7d2
Updated to support jquery 1.9.1.
nissimk May 20, 2013
2fef0c2
Create proxy.ashx
mcristelo May 31, 2013
4f92303
Update README.mediawiki
ricvelozo Jun 7, 2013
c586200
Update README.mediawiki
ricvelozo Jun 7, 2013
61d0520
Updated builds.
ricvelozo Jun 7, 2013
1aa4f68
Updated builds.
ricvelozo Jun 7, 2013
2e5e4a8
jatom.js: fix 'link' population
simonsj Jun 19, 2013
9fca8c6
jatom.js: fix 'link' population
simonsj Jun 24, 2013
753ca58
Merge branch 'master' of github.com:simonsj/jFeed
makc Aug 14, 2013
d555cce
Pull request #1 (#14 in original repo)
makc Aug 14, 2013
fc24769
Merge branch 'patch-1' of github.com:mcristelo/jFeed
makc Aug 14, 2013
132696b
Merging fucked-up 'author' pull request #12 by @jakoch
makc Aug 14, 2013
3ac54ad
var t = jQuery(this);
makc Aug 14, 2013
7560c11
hope this is correct
makc Aug 14, 2013
9033dd9
let's take georss from @maxogden's fork
makc Aug 14, 2013
9d52e0a
let's take georss from @maxogden's fork
makc Aug 14, 2013
bd8043e
getting rid of jQuery.browser
makc Aug 14, 2013
a9f09b8
getting rid of jQuery.browser
makc Aug 14, 2013
7a4ec8f
another jQuery 1.9 fix
makc Aug 14, 2013
2111fdb
jquery 1.10.2
makc Aug 14, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ Dual licensed under the MIT (MIT-license.txt) and GPL (GPL-license.txt) licenses
* <code>feed.description</code>
* <code>feed.language</code>
* <code>feed.updated</code>
* <code>feed.items:</code> an array of JFeedItem
* <code>feed.items</code>: an array of JFeedItem

== JFeedItem properties ==

* <code>item.title</code>
* <code>item.link</code>
* <code>item.description</code>
* <code>item.content</code>: full text
* <code>item.updated</code>
* <code>item.id</code>
* <code>item.author</code>

Please see the provided examples for more information.

Expand Down
106 changes: 74 additions & 32 deletions build/dist/jquery.jfeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jQuery.getFeed = function(options) {
}, options);

if (options.url) {

if (jQuery.isFunction(options.failure) && jQuery.type(options.error)==='null') {
// Handle legacy failure option
options.error = function(xhr, msg, e){
Expand All @@ -32,12 +32,12 @@ jQuery.getFeed = function(options) {
}
}

return $.ajax({
return jQuery.ajax({
type: 'GET',
url: options.url,
data: options.data,
cache: options.cache,
dataType: (jQuery.browser.msie) ? "text" : "xml",
dataType: (document.all) ? "text" : "xml",
success: function(xml) {
var feed = new JFeed(xml);
if (jQuery.isFunction(options.success)) options.success(feed);
Expand All @@ -62,7 +62,7 @@ JFeed.prototype = {
description: '',
parse: function(xml) {

if (jQuery.browser.msie) {
if (document.all) {
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.loadXML(xml);
xml = xmlDoc;
Expand Down Expand Up @@ -90,18 +90,21 @@ JFeedItem.prototype = {
title: '',
link: '',
description: '',
content: '',
updated: '',
id: ''
id: '',
author: '',
coordinates: ''
};

function JAtom(xml) {
this._parse(xml);
};

JAtom.prototype = {

_parse: function(xml) {

var channel = jQuery('feed', xml).eq(0);

this.version = '1.0';
Expand All @@ -110,21 +113,44 @@ JAtom.prototype = {
this.description = jQuery(channel).find('subtitle:first').text();
this.language = jQuery(channel).attr('xml:lang');
this.updated = jQuery(channel).find('updated:first').text();

this.items = new Array();

var feed = this;

jQuery('entry', xml).each( function() {

var item = new JFeedItem();

item.title = jQuery(this).find('title').eq(0).text();
item.link = jQuery(this).find('link').eq(0).attr('href');
item.description = jQuery(this).find('content').eq(0).text();
item.updated = jQuery(this).find('updated').eq(0).text();
item.id = jQuery(this).find('id').eq(0).text();


var t = jQuery(this);

item.title = t.find('title').eq(0).text();

/*
* RFC 4287 - 4.2.7.2: take first encountered 'link' node
* to be of the 'alternate' type.
*/
t.find('link').each(function() {
var rel = $(this).attr('rel');
if ((rel == 'alternate') || !rel) {
item.link = $(this).attr('href');
return false;
}
return true;
});

item.description = t.find('content').eq(0).text();
item.updated = t.find('updated').eq(0).text();
item.id = t.find('id').eq(0).text();
item.author = t.find('author name').eq(0).text();

var point = t.find('georss\\:point').eq(0).text();
if (!point) point = t.find('point').eq(0).text();
if (point.length > 0) {
point = point.split(" ");
item.coordinates = [point[1], point[0]];
}

feed.items.push(item);
});
}
Expand All @@ -135,34 +161,50 @@ function JRss(xml) {
};

JRss.prototype = {

_parse: function(xml) {

if(jQuery('rss', xml).length == 0) this.version = '1.0';
else this.version = jQuery('rss', xml).eq(0).attr('version');

var channel = jQuery('channel', xml).eq(0);

this.title = jQuery(channel).find('title:first').text();
this.link = jQuery(channel).find('link:first').text();
this.description = jQuery(channel).find('description:first').text();
this.language = jQuery(channel).find('language:first').text();
this.updated = jQuery(channel).find('lastBuildDate:first').text();

this.items = new Array();

var feed = this;

jQuery('item', xml).each( function() {

var item = new JFeedItem();

item.title = jQuery(this).find('title').eq(0).text();
item.link = jQuery(this).find('link').eq(0).text();
item.description = jQuery(this).find('description').eq(0).text();
item.updated = jQuery(this).find('pubDate').eq(0).text();
item.id = jQuery(this).find('guid').eq(0).text();


var t = jQuery(this);

item.title = t.find('title').eq(0).text();
item.link = t.find('link').eq(0).text();
item.description = t.find('description').eq(0).text();

item.content = t.find('content\\:encoded').eq(0).text();
if (!item.content) item.content = t.find('encoded').eq(0).text();
item.author = t.find('dc\\:creator').eq(0).text();
if (!item.author) item.author = t.find('creator').eq(0).text();

item.updated = t.find('pubDate').eq(0).text();
item.id = t.find('guid').eq(0).text();
item.enclosure = t.find('enclosure').attr('url');

var point = t.find('georss\\:point').eq(0).text();
if (!point) point = t.find('point').eq(0).text();
if (point.length > 0) {
point = point.split(" ");
item.coordinates = [point[1], point[0]];
}

feed.items.push(item);
});
}
Expand Down
2 changes: 1 addition & 1 deletion build/dist/jquery.jfeed.pack.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions jquery/jquery.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions proxy.ashx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<%@ WebHandler Language="VB" Class="proxy" %>

Imports System
Imports System.Web
Imports System.Net
Imports System.IO

Public Class proxy : Implements IHttpHandler

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim myHttpWebRequest As HttpWebRequest = WebRequest.Create(context.Request.QueryString("url"))
Dim resp = myHttpWebRequest.GetResponse().GetResponseStream
Dim sr As StreamReader = New StreamReader(resp)
context.Response.ContentType = "application/xml"
context.Response.Write(sr.ReadToEnd)
context.Response.Flush()
context.Response.End
End Sub

Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property

End Class
49 changes: 36 additions & 13 deletions src/jatom.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ function JAtom(xml) {
};

JAtom.prototype = {

_parse: function(xml) {

var channel = jQuery('feed', xml).eq(0);

this.version = '1.0';
Expand All @@ -14,21 +14,44 @@ JAtom.prototype = {
this.description = jQuery(channel).find('subtitle:first').text();
this.language = jQuery(channel).attr('xml:lang');
this.updated = jQuery(channel).find('updated:first').text();

this.items = new Array();

var feed = this;

jQuery('entry', xml).each( function() {

var item = new JFeedItem();

item.title = jQuery(this).find('title').eq(0).text();
item.link = jQuery(this).find('link').eq(0).attr('href');
item.description = jQuery(this).find('content').eq(0).text();
item.updated = jQuery(this).find('updated').eq(0).text();
item.id = jQuery(this).find('id').eq(0).text();


var t = jQuery(this);

item.title = t.find('title').eq(0).text();

/*
* RFC 4287 - 4.2.7.2: take first encountered 'link' node
* to be of the 'alternate' type.
*/
t.find('link').each(function() {
var rel = $(this).attr('rel');
if ((rel == 'alternate') || !rel) {
item.link = $(this).attr('href');
return false;
}
return true;
});

item.description = t.find('content').eq(0).text();
item.updated = t.find('updated').eq(0).text();
item.id = t.find('id').eq(0).text();
item.author = t.find('author name').eq(0).text();

var point = t.find('georss\\:point').eq(0).text();
if (!point) point = t.find('point').eq(0).text();
if (point.length > 0) {
point = point.split(" ");
item.coordinates = [point[1], point[0]];
}

feed.items.push(item);
});
}
Expand Down
Loading