From da59078b647e98d0b7c5c69d9f64bc40f00533fd Mon Sep 17 00:00:00 2001 From: maxwell Date: Wed, 30 Jun 2010 17:49:45 -0700 Subject: [PATCH] fixed small js bug so it only adds to the base route (or page 1 on pagination) --- app/views/js/_websocket_js.haml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/views/js/_websocket_js.haml b/app/views/js/_websocket_js.haml index 1fc933a25..bd7818824 100644 --- a/app/views/js/_websocket_js.haml +++ b/app/views/js/_websocket_js.haml @@ -11,13 +11,20 @@ ws.onmessage = function(evt) { var obj = jQuery.parseJSON(evt.data); debug("got a " + obj['class']); - + + + function onPageOne() { + var c = document.location.search.charAt(document.location.search.length-1); + return ((c =='') || (c== '1')) + } + + if (obj['class']=="comments"){ var post_id = obj['post_id'] $('#'+ obj['post_id'] + ' .comment_set li:last' ).before( $(obj['html']).fadeIn("fast", function(){}) ) - }else if((location.href.indexOf(obj['class']) != -1 ) || (location.pathname == '/')) { + }else if(((location.href.indexOf(obj['class']) != -1 ) || (location.pathname == '/')) && onPageOne()) { $("#stream").prepend( $(obj['html']).fadeIn("fast", function(){ $("#stream label:first").inFieldLabels();