diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 98e9f0914e..aa63a1d3fa 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -29,9 +29,10 @@ var ajaxify = {}; // leave room and join global app.enter_room('global'); - var url = url.replace(/\/$/, ""); + var hash = window.location.hash; + if(url.indexOf(RELATIVE_PATH.slice(1)) !== -1) { url = url.slice(RELATIVE_PATH.length); } @@ -67,7 +68,12 @@ var ajaxify = {}; } app.process_page(); - jQuery('#content, #footer').stop(true, true).fadeIn(200); + + jQuery('#content, #footer').stop(true, true).fadeIn(200, function() { + console.log('done loading'); + app.scrollToPost(hash.substr(1)); + }); + }, url, template); return true; diff --git a/public/src/app.js b/public/src/app.js index d5e65818a7..91df13efa2 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -295,6 +295,74 @@ var socket, } } + app.addCommasToNumbers = function() { + $('.formatted-number').each(function(index, element) { + $(element).html(app.addCommas($(element).html())); + }); + } + + app.createNewPosts = function(data) { + data.posts[0].display_moderator_tools = 'none'; + var html = templates.prepare(templates['topic'].blocks['posts']).parse(data), + uniqueid = new Date().getTime(), + tempContainer = jQuery('
') + .appendTo("#post-container") + .hide() + .append(html) + .fadeIn('slow'); + + for(var x=0,numPosts=data.posts.length;x