Skip to content

Commit

Permalink
Homepage|Fixed: Removed use of obsolete Google API
Browse files Browse the repository at this point in the history
The blog feeds are now read as JSON directly from WordPress.

Also removed the Google +1 social button (was causing inordinately
long network requests while the page is open).
  • Loading branch information
skyjake committed Jan 11, 2017
1 parent 8310385 commit cdc6a3f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 24 deletions.
54 changes: 32 additions & 22 deletions web/plugins/z#home/home.php
Expand Up @@ -200,15 +200,14 @@ public function execute($args=NULL)
dataType: 'xml',
maxItems: 5,
clearOnSuccess: true,
useGoogleApi: false,
generateItemHtml: 0
};
if(t) {
e.extend(n, t);
}
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=?',
Expand All @@ -228,7 +227,7 @@ public function execute($args=NULL)
}
});
}
else
else*/
{
e.ajax({
url: n.feedUri,
Expand All @@ -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('<ol style="list-style-type: none;">' + html + '</ol>');
}
});
Expand Down Expand Up @@ -300,10 +312,9 @@ public function execute($args=NULL)
});*/

$('#column2').interpretFeed({
feedUri: 'http://dengine.net/blog/category/news/feed',
feedUri: 'http://dengine.net/blog/category/news/?json=true',
dataType: 'json',
clearOnSuccess: false,
useGoogleApi: true,
maxItems: 2,
generateItemHtml: function (n, t) {
var html = '<div class="block"><article class="newspost content"><header><h1><a href="' + t.link + '" title="&#39;' + t.title + '&#39; (full article in the blog)">' + t.title + '</a></h1>';
Expand All @@ -321,10 +332,9 @@ public function execute($args=NULL)
});

$('#column1').interpretFeed({
feedUri: 'http://dengine.net/blog/category/dev/feed',
feedUri: 'http://dengine.net/blog/category/dev/?json=true',
dataType: 'json',
clearOnSuccess: false,
useGoogleApi: true,
maxItems: 1,
generateItemHtml: function (n, t) {
var html = '<div class="block"><article class="blogpost content"><header><h1><a href="' + t.link + '" title="&#39;' + t.title + '&#39; (full article in the blog)">' + t.title + '</a></h1>';
Expand Down
4 changes: 2 additions & 2 deletions web/plugins/z#home/html/socialbookmarks.html
Expand Up @@ -13,13 +13,13 @@
<div class="fb-like" data-href="http://www.facebook.com/doomsday.engine" data-send="false" data-width="300" data-show-faces="false" data-font="verdana"></div>
</li>
<li><div class="ohloh-button"><script type="text/javascript" src="http://www.ohloh.net/p/7201/widgets/project_users_logo.js"></script></div></li>
<li><div class="google-plusone">
<!-- ><li><div class="google-plusone">
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
{lang: 'en-GB', parsetags: 'explicit'}
</script>
<div class="g-plusone" data-size="medium" data-annotation="inline" data-href="http://dengine.net"></div>
<script type="text/javascript">gapi.plusone.go();</script>
</div></li>
</div></li> -->
<li><div class="sf-button"><a href="http://sourceforge.net/projects/deng" title="Explore the Deng project at SourceForge"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=74815&amp;type=9" width="80" height="15" alt="Get Doomsday Engine at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a></div></li>
</ul>
</div>

0 comments on commit cdc6a3f

Please sign in to comment.