Skip to content

Commit

Permalink
Merge pull request MozillaIndia#10 from kaustavdm/blog_feeds
Browse files Browse the repository at this point in the history
Load feed data from local copy of blog feed
  • Loading branch information
debloper committed Sep 25, 2013
2 parents 0734aac + 2618354 commit 959aad2
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
css/styles.css
css/home.css
feeds/*
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ MozillaIndia

This is the source code for the static landing page of MozillaIndia.org. The website is built using the sandstone theme extracted from Mozilla's Bedrock project.

Downloading feed from MozillaIndia Blog
=======================================

Download a copy of MozillaIndia Blog and save the xml to `feeds/feeds.xml`. On
page load, this file is used to load the feeds. Here is a cURL example of doing this:

```
$ curl http://blog.mozillaindia.org/feeds/ --O feeds/feeds.xml
```

The `feeds/feeds.xml` file is ignored by Git and will not be added to the repository.

Contributing
============

Expand Down
31 changes: 16 additions & 15 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h2>Unity in the midst of diversity</h2>
<div id="main-content">
<section id="home-news">
<h3>In the news</h3>
<ul>
<ul id="blog-ul">
<li>
<!--<h4><a href="#">Feed of Blogs comes here</a></h4>-->
<!-- We can just have a feedburner to generate a JS code for pulling latest value from the blogger RSS/ Wordpress RSS and we can display it here. Probably something like the AJAX Google API or feed2js, http://www.google.com/uds/solutions/dynamicfeed/index.html -->
Expand Down Expand Up @@ -115,12 +115,12 @@ <h4>Volunteer with us</h4>
</a></li>
<!--
<li id="about-work"><a href="http://careers.mozilla.org/">
<h4>Work with us</h4>
<p>Apply today and love the Web for&nbsp;a&nbsp;living.</p>
<h4>Work with us</h4>
<p>Apply today and love the Web for&nbsp;a&nbsp;living.</p>
</a></li>
<li id="about-find"><a href="http://www.mozilla.org/about/mozilla-spaces/">
<h4>Find us</h4>
<p>Contact one of our global Mozilla&nbsp;Spaces.</p>
<h4>Find us</h4>
<p>Contact one of our global Mozilla&nbsp;Spaces.</p>
</a></li>
-->
<li id="about-join"><a href="https://sendto.mozilla.org/Join-Moz-Org">
Expand Down Expand Up @@ -175,15 +175,16 @@ <h4>Learn more</h4>
<script src="js/base/nav-main-resp.js"></script>
<script src="js/mozorg-resp-min.js"></script>
<script src="js/tabzilla/tabzilla.js"></script>
<script>
window.scrollback = {
streams: ['mozilla-india'],
theme: 'light',
ticker: true
};
// Don't change below this line ------------------------------------------------
(function(d,h,e){e=d.createElement('script');e.async=1;e.src=h+'/client.min.js';
scrollback.host=h;d.body.appendChild(e);}(document,'http://scrollback.io'));
</script>
<script>
window.scrollback = {
streams: ['mozilla-india'],
theme: 'light',
ticker: true
};
// Don't change below this line ------------------------------------------------
(function(d,h,e){e=d.createElement('script');e.async=1;e.src=h+'/client.min.js';
scrollback.host=h;d.body.appendChild(e);}(document,'http://scrollback.io'));
</script>
<script src="js/mozin/feedreader.js"></script>
</body>
</html>
20 changes: 14 additions & 6 deletions js/mozin/feedreader.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
(function ($) {
$.ajax({
url: "http://blog.mozillaindia.org?feed=rss2",
crossDomain: true,
url: "feeds/feeds.xml",
dataType: 'xml',
type: 'POST',
success: function (data) {
console.log("success: " + data);
success: function (data, status, jqXHR) {
var items = [];
$(data).find("item").each(function (i) {
if (i < 3) {
var item = "<li><h4>";
item += "<a href='" + $(this).find("link").text() + "'>";
item += $(this).find("title").text();
item += "</a></h4></li>";
items.push(item);
}
});
$("#blog-ul").html(items.join(''));
},
error: function (jqXHR, status, e) {
console.log(status);
$("#blog-ul").html("<li><p>No feed has been generated yet.</p></li>");
}
});
})(jQuery);

0 comments on commit 959aad2

Please sign in to comment.