diff daily-edition.js @ 45:8cb5e556960b

Added an optional querystring param, '?issue=<number>', allowing browser to pass in the issue # to view
author Atul Varma <varmaa@toolness.com>
date Sun, 28 Mar 2010 22:37:49 +0000
parents 6495497409dc
children d79bf2ee77f5
line wrap: on
line diff
--- a/daily-edition.js	Sun Mar 28 22:31:48 2010 +0000
+++ b/daily-edition.js	Sun Mar 28 22:37:49 2010 +0000
@@ -1,7 +1,13 @@
 $(window).ready(
   function() {
     var req = new XMLHttpRequest();
-    req.open('GET', 'daily-edition.json');
+    var jsonFile = 'daily-edition.json';
+
+    var matches = location.search.match(/\?issue=([0-9]+)/);
+    if (matches)
+      jsonFile = 'issue-' + parseInt(matches[1]) + '.json';
+
+    req.open('GET', jsonFile);
     req.overrideMimeType('text/plain');
     req.addEventListener(
       "load",