var picLoaded = false; var updatePic = function(){ if(!picLoaded){ $.ajax({ type : 'POST', url : 'http://www.illibraio.it/wp-admin/admin-ajax.php', data : { 'action' : 'get_useravatar', 'user' : 0 }, dataType : 'json', success : function(data) { var el; el = $('#uPicMini'); if(!data.default){ el.attr('src', data.src); }else{ el.attr('src', el.data('srcBase') + 'images/default-avatar.png'); }; el = $('#uPic'); if(el.length){ el.attr('src', data.src); var bg = $('.header-user .fog'); bg.css({ backgroundImage: 'url(' + data.src + ')' }); }; picLoaded = true; } }); }; }; /** !FACEBOOK JS WITH SUBSCRIBE EVENT **/ window.fbAsyncInit = function() { FB.init({ appId: '1747740102120644', status: true, cookie: true, xfbml: true, oauth: true }); FB.Event.subscribe('comment.create', comment_create); FB.Event.subscribe('comment.remove', comment_delete); var sharecount_exist = $(document).find('.share-aggregator a'); if(sharecount_exist.length > 0) { FB.Event.subscribe('edge.create', function(response) { $('.share-aggregator a[data-url="'+response+'"]').each(function() { var count = $(this).html(); $(this).html(parseInt(count) + 1); }); }); } }; (function(d) { var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; } js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/it_IT/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document));