%PDF- %PDF-
Direktori : /home/bitrix/www/bitrix/templates/p4_new/components/p4/p.portfolio.profile/public/ |
Current File : /home/bitrix/www/bitrix/templates/p4_new/components/p4/p.portfolio.profile/public/script.js |
/*BX.ready(function(){ $(".nonactivelink").click(function(e){ e.preventDefault(); }); $("button#btn-portfolio-more").click(function () { var pf_button = $(this); cat = $(this).attr("data-cat"); page = $(this).attr("data-p"); cnt = $(this).attr("data-c"); cnt = cnt*1; var us_type = $("#blueimp_gallery_source").attr("data-type-user"); $.ajax({ url: "/local/components/p4/p.portfolio.profile/ajax_get_portfotos.php", type: "GET", data: {page: page, cat: cat, us_type: us_type}, dataType: "html", success: function(html){ $("#portfolio_albom"+cat).append(html); if((page*8)>=cnt) pf_button.css("display", "none"); else { page = page*1+1; pf_button.attr("data-p", page); } initBlueimp(); } }); }); function initBlueimp() { $('#blueimp_gallery_source a.portfolio-item-link[data-imp="N"]').click(function(e){ console.log('click on photo #'+$(this).attr('data-item-id')); e.preventDefault(); gallery = blueimp.Gallery( document.getElementById('blueimp_gallery_source').getElementsByClassName('portfolio-item-link'), { container: "#blueimp-gallery", stretchImages: $(window).width()<1024?true:false, closeOnEscape: true, startSlideshow: false, closeOnSlideClick: false, carousel: true, enableKeyboardNavigation: true, index: $('a.portfolio-item-link').index(this), onslide: function(index, slide) { $('.blueimp-gallery').scrollTop(0); nodeButtons = this.container.find('.social'); nodeComments = this.container.find('.comments'); photoId = this.list[index].getAttribute('data-item-id'); accountId = $("#blueimp_gallery_source").attr('data-account-id'); if (photoId) { BX.ajax.get( // Подгружаем блок кнопок лайк/коммент '/local/components/p4/p.portfolio.profile/ajax_like.php?ID='+photoId+'&ACCOUNT='+accountId, function (data) { nodeButtons[0].innerHTML = data; // Подгружаем блок комментариев BX.ajax.get( '/local/components/p4/p.portfolio.profile/ajax.php?ID='+photoId+'&ACCOUNT='+accountId, function (data) { nodeComments[0].innerHTML = data; $('#blueimp-comments').click(function(){ if ($('.blueimp-gallery').scrollTop()==0) $('.blueimp-gallery').animate({ scrollTop: $('#reviews-block-inner-3').offset().top }, 500); else $('.blueimp-gallery').animate({ scrollTop: 0 }, 500); }); // Обновляем счетчик $('.blueimp-gallery li#blueimp-comments span').html($('.blueimp-gallery #reviews-block-inner-3').attr('data-comments-count')); $('#forcommentsform3').click(function(){ setTimeout(function(){ $('.blueimp-gallery').animate({ scrollTop: $('form#REPLIER3').offset().top }, 200); },50); }); BX.addCustomEvent("onBeforeForumCommentAJAXPost", function(postform) { if (postform.getAttribute('id')=='REPLIER3') $('#reviews-block-inner-3').css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}, 300); }); // Обновление блока комментариев для первого сообщения и установка значения счетчика BX.addCustomEvent("onAfterForumCommentAJAXPost", function(result, postform) { if ((typeof result != 'undefined') && result.forumID == '3') { if (result.allMessages || BX.reload) { BX.ajax.get( '/local/components/p4/p.portfolio.profile/ajax.php?ID='+photoId+'&ACCOUNT='+accountId, function (data) { nodeComments[0].innerHTML = data; $('.blueimp-gallery li#blueimp-comments span').html(1); $('#reviews-block-inner-3').css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0}, 300); $('.blueimp-gallery').animate({ scrollTop: $('#reviews-block-inner-3').offset().top }, 500); } ); } else { $('.blueimp-gallery li#blueimp-comments span').html(result.messagesCount); $('#reviews-block-inner-3').css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0}, 300); $('.blueimp-gallery').animate({ scrollTop: $('#reviews-block-inner-3').offset().top }, 500); } } }); } ); } ); } } } ); }); $('#blueimp_gallery_source a.portfolio-item-link[data-imp="N"]').each(function(){ $(this).attr('data-imp','Y'); }); } initBlueimp(); if ($('#blueimp_gallery_source').attr('data-show-photo')>0) { setTimeout(function() { $('#blueimp_gallery_source a.portfolio-item-link[data-item-id='+$('#blueimp_gallery_source').attr('data-show-photo')+']:first').trigger("click"); }, 250); } });*/