Commits

Wes Alvaro committed 4c07094

Minor. Stable.

Comments (0)

Files changed (2)

     var count = 25;
     var after = location.hash.substr(1);
     var dontFetch = false;
+    var nonImages = {
+      'default': true,
+      'self': true
+    };
     var handleReddit = function(res) {
       console.log(res);
       var items = $('#items');
         var source = data.url;
         var reddit = '//reddit.com' + data.permalink;
         var row = $('<div/>', {'class': 'row-fluid'}).appendTo(items);
-        var a = $('<a/>', {href: source, target: '_new'}).appendTo(row);
+        var a = $('<a/>', {href: source, target: '_blank'}).appendTo(row);
         colTwoSpan = 12;
-        if (!(imgSrc in ['self', 'default'])) {
+        if (!nonImages[imgSrc]) {
           var colOne = $('<div/>', {'class': 'span1'}).appendTo(a);
           $('<img/>', {src: data.thumbnail}).appendTo(colOne);
           colTwoSpan = 11;
         }
         var colTwo = $('<div/>', {text: title, 'class': 'title span' + colTwoSpan}).appendTo(a);
-        $('<a/>', {'class': 'comment', 'href': reddit, 'target': '_new'}).appendTo(colTwo);
+        $('<a/>', {'class': 'comment', 'href': reddit, 'target': 'comments'}).appendTo(colTwo);
         after = data.name;
       });
       location.hash = after;
-      dontFetch = false;
     };
     var fetchReddit = function() {
       if (dontFetch) return;
         dataType: 'jsonp',
         data: {count: count, after: after},
         success: handleReddit,
-        error: function(){
+        complete: function(){
           dontFetch = false;
         }
       })
   reddit.path = pathname + '.json?' + reqUrl.query;
   console.log(reddit.hostname + reddit.path);
   http.get(reddit, function(res) {
-    response.writeHead(200, {'Content-Type': 'text/script'});
+    response.writeHead(200, {'Content-Type': 'text/javascript'});
     res.setEncoding('utf8');
     
     if (callback) response.write(callback + '(');