From 00cb15d3c85cc251eecafac62d1f3d88aca7104b Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Fri, 16 Aug 2013 17:04:08 -0400 Subject: [PATCH] check if there is follow element --- public/src/forum/topic.js | 10 ++++++---- src/webserver.js | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index fe3dd042fa..f1451b5912 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -195,12 +195,14 @@ }); } }); + socket.emit('api:topic.followCheck', tid); - followEl[0].addEventListener('click', function() { - socket.emit('api:topic.follow', tid); - }, false); + if(followEl[0]) { + followEl[0].addEventListener('click', function() { + socket.emit('api:topic.follow', tid); + }, false); + } - // Infinite scrolling of posts $(window).off('scroll').on('scroll', function() { var bottom = (document.body.offsetHeight - $(window).height()) * 0.9; diff --git a/src/webserver.js b/src/webserver.js index 6d8d47afea..66ca04fbf5 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -230,6 +230,9 @@ var express = require('express'), var posts = topicData.posts.push(topicData.main_posts[0]), lastMod = 0, timestamp; + + console.log(topicData.main_posts); + for(var x=0,numPosts=topicData.posts.length;x lastMod) lastMod = timestamp;