changeset 57:182af9ac76fb default tip

Moved a var declaration, formatting/indentation fixes.
author Atul Varma <avarma@mozilla.com>
date Thu, 12 Aug 2010 23:06:46 -0700
parents 35edfd76a3f7
children
files daily-edition.js
diffstat 1 files changed, 39 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/daily-edition.js	Fri Aug 13 06:04:28 2010 +0000
+++ b/daily-edition.js	Thu Aug 12 23:06:46 2010 -0700
@@ -40,48 +40,50 @@
 }
 
 function showContent(json) {
-        if (window.JSON)
-          info = JSON.parse(json);
-        else
-          info = eval("(" + json + ");");
-
-        $("#issue-no").text(info.id + 1);
-        $("#pub-date").text(info.pubDate.join("."));
+  var info;
 
-        info.authors.forEach(
-          function(author) {
-            if (author in info.articles)
-              info.articles[author].forEach(
-                function(article) {
-                  var div = $("#templates .article").clone();
-                  var date = article.pubDate.join(".");
-                  var title = safeHtml(article.title);
-                  div.find(".title .link").html(title);
-                  div.find(".title .link").attr("href", article.url);
-                  div.find(".author").text(author);
+  if (window.JSON)
+    info = JSON.parse(json);
+  else
+    info = eval("(" + json + ");");
+
+  $("#issue-no").text(info.id + 1);
+  $("#pub-date").text(info.pubDate.join("."));
 
-                  var html = [];
-                  article.content.forEach(
-                    function(content) {
-                      if (content.type == "text/html")
-                        html.push(safeHtml(content.value));
-                    });
+  info.authors.forEach(
+    function(author) {
+      if (author in info.articles)
+        info.articles[author].forEach(
+          function(article) {
+            var div = $("#templates .article").clone();
+            var date = article.pubDate.join(".");
+            var title = safeHtml(article.title);
+            div.find(".title .link").html(title);
+            div.find(".title .link").attr("href", article.url);
+            div.find(".author").text(author);
+            
+            var html = [];
+            article.content.forEach(
+              function(content) {
+                if (content.type == "text/html")
+                  html.push(safeHtml(content.value));
+              });
 
-                  if (html.length > 0) {
-                    var content = div.find(".content");
-                    content.html(html[0]);
-                    if (content.get(0).firstChild.nodeType == 3)
-                      // The child isn't wrapped in a containing block
-                      // element, so do that to ensure it has some
-                      // padding from everything around it.
-                      content.html("<p>" + html[0] + "</p>");
-                  }
-                  div.find(".date").text(date);
-                  $("#articles").append(div);
-                });
+            if (html.length > 0) {
+              var content = div.find(".content");
+              content.html(html[0]);
+              if (content.get(0).firstChild.nodeType == 3)
+                // The child isn't wrapped in a containing block
+                // element, so do that to ensure it has some
+                // padding from everything around it.
+                content.html("<p>" + html[0] + "</p>");
+            }
+            div.find(".date").text(date);
+            $("#articles").append(div);
           });
+    });
 
-        $("#container").fadeIn("fast");
+  $("#container").fadeIn("fast");
 }
 
 $(window).ready(
@@ -100,8 +102,6 @@
     req.addEventListener(
       "load",
       function(event) {
-        var info;
-
         if (req.status != 200) {
           showError();
           return;