Mercurial > planet-ubiquity-redesign
changeset 13:7fbe0acf0805
Changed to planet ubiquity.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Mon, 02 Mar 2009 15:44:29 -0800 |
parents | e8ec89b2c895 |
children | 88b0602c79a1 |
files | about-mozilla.css about-mozilla.html about-mozilla.js |
diffstat | 3 files changed, 49 insertions(+), 67 deletions(-) [+] |
line wrap: on
line diff
--- a/about-mozilla.css Mon Mar 02 10:24:52 2009 -0800 +++ b/about-mozilla.css Mon Mar 02 15:44:29 2009 -0800 @@ -52,12 +52,20 @@ padding-right: 6pt; } -#raw-issue { - display: none; -} - a { color: black; text-decoration: none; border-bottom: 1px dotted gray; } + +.blog-item { + padding-top: 6pt; + padding-bottom: 6pt; + color: gray; +} + +.blog-item a { + border: none; + font-style: italic; + color: black; +}
--- a/about-mozilla.html Mon Mar 02 10:24:52 2009 -0800 +++ b/about-mozilla.html Mon Mar 02 15:44:29 2009 -0800 @@ -5,17 +5,13 @@ <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="all" href="about-mozilla.css" /> - <title>about:mozilla</title> + <title>planet ubiquity</title> </head> <body> <div id="issue"> - <div id="header">about:mozilla - <div id="subheader">for the week of <span class="date"></span></div> - </div> + <div id="header">planet ubiquity</div> <div id="body"></div> </div> -<div id="raw-issue"> -</div> </body> <script src="jquery.js"></script> <script src="querystring.js"></script>
--- a/about-mozilla.js Mon Mar 02 10:24:52 2009 -0800 +++ b/about-mozilla.js Mon Mar 02 15:44:29 2009 -0800 @@ -1,66 +1,44 @@ -var ATOM_URL = "https://developer.mozilla.org/devnews/index.php/feed/atom/"; - -var MONTHS = ["January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December"]; +var FEEDS = [ + {name: "Blogs", + url: "http://ubiquity.mozilla.com/planet/?feed=rss2", + processFeed: function processBlogFeed(feed) { + var content = $('<div class="content"></div>'); + jQuery.each( + feed.entries, + function(i) { + var item = $('<div class="blog-item">' + + '<span class="title"></span> by ' + + '<span class="author"></span></div>'); + $('.title', item).text(this.title); + $('.title', item).wrap('<a href="' + this.link + '"></a>'); + $('.author', item).text(this.author); + content.append(item); + }); + return content; + }} +]; -function onIssueLoaded() { - $("#raw-issue a[name]").each( - function(i) { - var headline = $(this).next().text(); - var content = $('<div class="content"></div>'); - for (var node = $(this).parent().next(); - node.length && !node.find("a[name]").length; - node = node.next(":not(.postmetadata)")) - content.append(node.clone()); +function showFeed(feedInfo) { + var entry = $('<div class="entry"></div>'); + var headline = $('<div class="headline"></div>'); + headline.text(feedInfo.name); + entry.append(headline); + $("#body").append(entry); - var entry = $('<div class="entry"></div>'); - entry.append($('<div class="headline"></div>').text(headline)); + var feed = new google.feeds.Feed(feedInfo.url); + feed.setNumEntries(10); + feed.load( + function(result) { + var content = feedInfo.processFeed(result.feed); + content.hide(); entry.append(content); - $("#body").append(entry); - } - ); - - $("#issue").fadeIn(); - - var tallestHeight = 0; - var entries = $("#issue .entry"); - entries.each( - function(i) { - var height = $(this).height(); - if (height > tallestHeight) - tallestHeight = height; - } - ); - entries.height(tallestHeight); - $(document.body).width(entries.outerWidth() * entries.length); + content.slideDown(); + }); } google.load("feeds", "1"); google.setOnLoadCallback( function() { - var feed = new google.feeds.Feed(ATOM_URL); - feed.load( - function(result) { - var qs = new Querystring(); - var issue = qs.get("issue", "0"); - var entry = result.feed.entries[issue]; - $("#raw-issue").html(entry.content); - var pubDate = new Date(entry.publishedDate); - var dateStr = (MONTHS[pubDate.getMonth()] + " " + - pubDate.getDate() + ", " + - pubDate.getFullYear()); - $(".date").text(dateStr); - - onIssueLoaded(); - }); + jQuery.each(FEEDS, function(i) { showFeed(this); }); + $("#issue").fadeIn(); });