diff --git a/web/plugins/z#home/home.php b/web/plugins/z#home/home.php index 73d203eefb..4485ef8e87 100644 --- a/web/plugins/z#home/home.php +++ b/web/plugins/z#home/home.php @@ -200,7 +200,6 @@ public function execute($args=NULL) dataType: 'xml', maxItems: 5, clearOnSuccess: true, - useGoogleApi: false, generateItemHtml: 0 }; if(t) { @@ -208,7 +207,7 @@ public function execute($args=NULL) } var r = e(this).attr('id'); - if(n.useGoogleApi) + /*if(n.useGoogleApi) { e.ajax({ url: 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=' + n.maxItems + '&output=json&q=' + encodeURIComponent(n.feedUri) + '&hl=en&callback=?', @@ -228,7 +227,7 @@ public function execute($args=NULL) } }); } - else + else*/ { e.ajax({ url: n.feedUri, @@ -240,22 +239,35 @@ public function execute($args=NULL) e("#" + r).empty(); } - var xml = $(t); - var html = ""; - xml.find('item').slice(0, n.maxItems).each(function() { - var self = $(this), - item = { title: self.children('title').text(), - link: self.children('link').text(), - author: self.children('author').text(), - pubDate: self.children('pubDate').text(), - atomSummary: self.children('atom\\:summary').text(), - description: self.children('description').text(), - author: self.children('author').text() - } - html += n.generateItemHtml(n, item); - }); - + + if(n.dataType === 'xml') { + var xml = $(t); + xml.find('item').slice(0, n.maxItems).each(function() { + var self = $(this), + item = { title: self.children('title').text(), + link: self.children('link').text(), + author: self.children('author').text(), + pubDate: self.children('pubDate').text(), + atomSummary: self.children('atom\\:summary').text(), + description: self.children('description').text(), + author: self.children('author').text() + } + html += n.generateItemHtml(n, item); + }); + } + else if (n.dataType === 'json') { + for (var i = 0; i < n.maxItems && i < t.posts.length; ++i) { + var post = t.posts[i]; + item = { title: post.title, + link: post.url, + author: post.author.name, + publishedDate: post.date.substring(0, 10), + content: post.content + } + html += n.generateItemHtml(n, item); + } + } e('#' + r).append('