From 1e9664d74c93a9e16f6714e6c99a8ade1ddde5ed Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Mon, 24 Feb 2014 17:44:20 +0530 Subject: [PATCH] [IMP]: code bzr revid: aja@tinyerp.com-20140224121420-fdq7ht4j0syxjqir --- .../static/src/js/website_blog.js | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/addons/website_blog/static/src/js/website_blog.js b/addons/website_blog/static/src/js/website_blog.js index 28f04e132e0..6a8bfa9d28f 100644 --- a/addons/website_blog/static/src/js/website_blog.js +++ b/addons/website_blog/static/src/js/website_blog.js @@ -8,13 +8,15 @@ $(document).ready(function() { discussion = res['Inline Discussion'] share = res['Select to Tweet'] return def.resolve() - }) + }); def.done( function(){ var content = $("#blog_content p"); - if(content.length && discussion) + if(content.length && discussion){ + $('#discussions_wrapper').empty(); new openerp.website.blog_discussion({'content' : content}); + } if (share) $("p").share(); - }) + }); $('.cover_footer').on('click',page_transist); $('a[href^="#blog_content"]').on('click', animate); @@ -39,20 +41,21 @@ $(document).ready(function() { function newpage() { $.ajax({ - url: newLocation, + url: newLocation, }).done(function(data) { - $('main').append($(data).find('main').html()); - $("html").stop().animate({ scrollTop: $("#wrap:last-child").offset().top }, 1000,function(e){ - $("#wrap:first").remove(); - $(document).scrollTop($("#wrap:last-child").offset().top); - //bind again it takes control from now on, until page relaod. - $(document).find('.cover_footer').on('click',page_transist); - $(document).find('a[href^="#blog_content"]').on('click', animate); - var content = $(document).find("#blog_content p"); - if (content && discussion) + $('main').append($(data).find('main').html()); + $("html").stop().animate({ scrollTop: $("#wrap:last-child").offset().top }, 1000,function(e){ + $("#wrap:first").remove(); + $(document).scrollTop($("#wrap:last-child").offset().top); + //bind again it takes control from now on, until page relaod. + $(document).find('.cover_footer').on('click',page_transist); + $(document).find('a[href^="#blog_content"]').on('click', animate); + var content = $(document).find("#blog_content p"); + if (content && discussion){ new openerp.website.blog_discussion({'content' : content}); - if (share) $("p").share(); - }); + } + if (share) $("p").share(); + }); if (newLocation != window.location) { history.pushState(null, null, newLocation); }