diff about-mozilla.js @ 1:4dd50afc32c8

Successfully getting headlines and body of each article.
author Atul Varma <varmaa@toolness.com>
date Sat, 28 Feb 2009 13:02:50 -0800
parents 58d9c5ef124e
children 2be94bbd7f04
line wrap: on
line diff
--- a/about-mozilla.js	Sat Feb 28 12:24:58 2009 -0800
+++ b/about-mozilla.js	Sat Feb 28 13:02:50 2009 -0800
@@ -1,5 +1,19 @@
+function onIssueLoaded() {
+  $("a[name]").each(
+    function(i) {
+      var headline = $(this).next().text();
+      var body = $("<div></div>");
+      for (var node = $(this).parent().next();
+           node.length && !node.find("a[name]").length;
+           node = node.next(":not(.postmetadata)"))
+        body.append(node.clone());
+    }
+  );
+}
+
 $(window).ready(
   function() {
-    $(document.body).load("issue-2009-02-24.html .post",
-                          null);
+    $(document.body).load("issue-2009-02-24.html .entry",
+                          null,
+                          onIssueLoaded);
   });