Mercurial > planet-ubiquity-redesign
changeset 33:ea5794bfb0ac
Namespaced everything under 'Planet'.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Tue, 03 Mar 2009 10:17:49 -0800 |
parents | aa3802c3fe2a |
children | e51c8e11d202 |
files | about-mozilla.js |
diffstat | 1 files changed, 44 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/about-mozilla.js Tue Mar 03 10:09:25 2009 -0800 +++ b/about-mozilla.js Tue Mar 03 10:17:49 2009 -0800 @@ -2,29 +2,34 @@ // // This is the JavaScript source code for the Planet Ubiquity Redesign. -var BUILDBOT_BASE = "http://ubiquity.mozilla.com/buildbot/"; -var HG_BASE = "https://ubiquity.mozilla.com/hg/ubiquity-firefox/"; +var Planet = { + // The base URL for where Ubiquity buildbot information is located. + BUILDBOT_BASE: "http://ubiquity.mozilla.com/buildbot/", -function getBuildInfo(page) { + // The base URL for where Ubiquity's main HG repository is located. + HG_BASE: "https://ubiquity.mozilla.com/hg/ubiquity-firefox/" +}; + +Planet.getBuildInfo = function getBuildInfo(page) { var builds = []; $("li", page).each( function(i) { var revRegexp = /.*rev=\[([0-9a-f]+)\].*/; builds.push({rev: $(this).text().match(revRegexp)[1], - href: (BUILDBOT_BASE + + href: (Planet.BUILDBOT_BASE + $("a:not(:first)", this).attr("href")), isSuccessful: $(".success", this).length > 0 }); } ); return builds; -} +}; -function mashupBuildbotWithHgData(hgLog, buildbotPage) { - var builds = getBuildInfo(buildbotPage); +Planet.mashupBuildbotWithHgData = function mashup(hgLog, buildbotPage) { + var builds = Planet.getBuildInfo(buildbotPage); builds.forEach( function(build) { - var revUrl = HG_BASE + "rev/" + build.rev; + var revUrl = Planet.HG_BASE + "rev/" + build.rev; var revSelector = ("a[href='" + revUrl + "']"); var link = jQuery(revSelector, hgLog); var className = "build-errors"; @@ -40,27 +45,27 @@ status.wrap('<a title="' + title + '" href="' + build.href + '"></a>'); }); -} +}; -function processHgFeed(feed, content, cb) { - processBlogFeed( +Planet.processHgFeed = function processHgFeed(feed, content, cb) { + Planet.processBlogFeed( feed, content, function() { jQuery.get( ("http://about-mozilla.appspot.com/?url=" + - BUILDBOT_BASE + "one_line_per_build&jsonp=?"), + Planet.BUILDBOT_BASE + "one_line_per_build&jsonp=?"), null, function(result) { - mashupBuildbotWithHgData(content, $(result.data)); + Planet.mashupBuildbotWithHgData(content, $(result.data)); cb(); }, "jsonp" ); }); -} +}; -function processBlogFeed(feed, content, cb) { +Planet.processBlogFeed = function processBlogFeed(feed, content, cb) { jQuery.each( feed.entries, function(i) { @@ -96,35 +101,35 @@ content.append(item); }); cb(); -} +}; -var FEEDS = [ +Planet.FEEDS = [ {name: "Blogs", url: "http://ubiquity.mozilla.com/planet/?feed=rss2", - processFeed: processBlogFeed, + processFeed: Planet.processBlogFeed, entries: 10}, {name: "Bugs", url: ("https://ubiquity.mozilla.com/trac/timeline?ticket=on" + "&milestone=on&wiki=on&max=50&daysback=90&format=rss"), - processFeed: processBlogFeed, + processFeed: Planet.processBlogFeed, entries: 10}, {name: "Code", - url: HG_BASE + "rss-log", - processFeed: processHgFeed, + url: Planet.HG_BASE + "rss-log", + processFeed: Planet.processHgFeed, entries: 15}, {name: "Discussions", url: ("http://groups.google.com/group/ubiquity-firefox/feed/" + "rss_v2_0_msgs.xml"), - processFeed: processBlogFeed, + processFeed: Planet.processBlogFeed, entries: 30}, {name: "Support", url: ("http://getsatisfaction.com/mozilla/products/mozilla_ubiquity.rss?" + "sort=recently_created"), - processFeed: processBlogFeed, + processFeed: Planet.processBlogFeed, entries: 10} ]; -function doneLoadingFeeds() { +Planet.doneLoadingFeeds = function doneLoadingFeeds() { function fixHeights(daysAgo) { var tallestHeight = 0; var elements = $(".days-ago-" + i); @@ -142,9 +147,9 @@ fixHeights(i); var entries = $("#issue .entry"); $(document.body).width(entries.outerWidth() * entries.length); -} +}; -function splitByDate(rawContent, content) { +Planet.splitByDate = function splitByDate(rawContent, content) { var now = new Date(); $(".blog-item", rawContent).each( function(i) { @@ -159,9 +164,9 @@ var div = $(".days-ago-" + daysAgo, content); div.append(this); }); -} +}; -function showFeed(feedInfo, cb) { +Planet.showFeed = function showFeed(feedInfo, cb) { var entry = $('<div class="entry"></div>'); var headline = $('<div class="headline"></div>'); headline.text(feedInfo.name); @@ -183,27 +188,27 @@ result.feed, rawContent, function() { - splitByDate(rawContent, content); + Planet.splitByDate(rawContent, content); entry.append(content); cb(); }); }); -} +}; google.load("feeds", "1"); google.setOnLoadCallback( function() { - var feedsLeftToLoad = FEEDS.length; + var feedsLeftToLoad = Planet.FEEDS.length; jQuery.each( - FEEDS, + Planet.FEEDS, function(i) { - showFeed(this, - function() { - feedsLeftToLoad--; - if (!feedsLeftToLoad) { - doneLoadingFeeds(); - } - }); + Planet.showFeed(this, + function() { + feedsLeftToLoad--; + if (!feedsLeftToLoad) { + Planet.doneLoadingFeeds(); + } + }); } ); });