3217bf1a04d42f53b4b3f952396cb3a8dd077500
[odoo/odoo.git] / addons / website_blog / static / src / js / website_blog.js
1 $(document).ready(function() {
2
3     function page_transist(event) {
4         event.preventDefault();
5         newLocation = $('.js_next')[0].href;
6         var top = $('.cover_footer').offset().top;
7         $('.cover_footer').animate({
8             height: $(window).height()+'px'
9         }, 300);
10         $('html, body').animate({
11             scrollTop: top
12         }, 300, 'swing', function() {
13            window.location.href = newLocation;
14         });
15     }
16     function animate(event) {
17         event.preventDefault();
18         event.stopImmediatePropagation();
19         var target = $(this.hash);
20         $('html, body').stop().animate({
21             'scrollTop': target.offset().top - 32
22         }, 500, 'swing', function () {
23             window.location.hash = 'blog_content';
24         });
25     }
26
27     var content = $("div[enable_chatter_discuss='True']").find('p[data-chatter-id]');
28     if (content) {
29         openerp.jsonRpc("/blog/get_user/", 'call', {}).then(function(data){
30             $('#discussions_wrapper').empty();
31             new openerp.website.blog_discussion({'content' : content, 'public_user':data[0]});
32         });
33     }
34
35     $('.js_fullheight').css('min-height', $(window).height());
36     $(".js_tweet").share({'author_name':$('#blog_author').text()});
37     $('.cover_footer').on('click',page_transist);
38     $('a[href^="#blog_content"]').on('click', animate);
39
40 });