PATH:
home
/
letacommog
/
letaweb
/
scripts
/
libraries
// cherryPortfolioLayoutPlugin plugin (function($){ var methods = { init : function( options ) { var settings = { call: function(){} } return this.each(function(){ if ( options ){ $.extend(settings, options); } var _this = $(this), ajaxGetNewRequest = null, ajaxGetMoreRequest = null, ajaxGetNewRequestSuccess = true, portfolioContainer = $('.portfolio-container', _this), portfolioList = $('.portfolio-list', portfolioContainer), ajaxLoaderContainer = null, column = portfolioContainer.data('column'), postPerPage = portfolioContainer.data('post-per-page'), itemMargin = parseInt( portfolioContainer.data('item-margin') ), loadingMode = portfolioContainer.data('loading-mode'), fixedHeight = portfolioContainer.data('fixed-height'), listLayout = portfolioContainer.data('list-layout'), template = portfolioContainer.data('template'), postsFormat = portfolioContainer.data('posts-format'), isotopeOptions = { itemSelector : '.portfolio-item', resizable: false, masonry: { columnWidth: Math.floor( $('.portfolio-list', portfolioContainer).width() / column ) } }, currentSlug = '', currentPaginationPage = 1, allPageLenght = 0, allPageLenght_temp = 0, ajaxMoreClicked = false, orderSetting = { order: 'DESC', orderby: 'date' } ; _constructor(); function createGrid() { ajaxRequestSuccess = true; $('.portfolio-pagination > ul > li a', _this).off('click'); $('.portfolio-pagination .page-nav .next-page', _this).off('click'); $('.portfolio-pagination .page-nav .prev-page', _this).off('click'); $('.portfolio-ajax-button .load-more-button a', _this).off('click') $('.portfolio-pagination, .portfolio-ajax-button', portfolioContainer ).remove(); beforeItemLength = 0; portfolioList = $('.portfolio-list', portfolioContainer); isotopeOptions = { itemSelector : '.portfolio-item', resizable: false, layoutMode: ( 'masonry-layout' == listLayout ) ? 'masonry' : 'fitRows' , masonry: { columnWidth: Math.floor( $('.portfolio-list', portfolioContainer).width() / widthLayoutChanger() ) } } var elementsList = $('.portfolio-item', portfolioList ) , pagePagination = $('.portfolio-pagination', portfolioList ) , pageMoreButton = $('.portfolio-ajax-button', portfolioList ) , allPostsCount = portfolioList.data('all-posts-count') ; allPageLenght = Math.ceil( parseInt( allPostsCount ) / parseInt( postPerPage ) ); switch( listLayout ){ case 'masonry-layout': case 'grid-layout': $('.inner-wrap', elementsList).css({ "margin": Math.floor( itemMargin * 0.5 ) }); $(elementsList).css({ "width": Math.floor( $('.portfolio-list', portfolioContainer).width() / widthLayoutChanger() ) }); portfolioList.html('').isotope( isotopeOptions ).isotope( 'insert', elementsList ); portfolioContainer.append( pagePagination ); portfolioContainer.append( pageMoreButton ); portfolioList.imagesLoaded( function() { portfolioList.isotope( isotopeOptions ) showPortfolioList( beforeItemLength ); jQuery(window).trigger('resize.portfolio_layout_resize'); }) break; case 'justified-layout': portfolioList.html('').append(elementsList); portfolioContainer.append( pagePagination ); portfolioContainer.append( pageMoreButton ); $(elementsList).each(function( index ){ var $this = $(this) , image_src = $this.data('image-src') , image_width = $this.data('image-width') , image_height = $this.data('image-height') , image_ratio = $this.data('image-ratio') , flex_value = Math.round( image_ratio*100 ) , new_width = Math.round( fixedHeight * image_ratio ) ; if( $('.justified-image', $this)[0] ){ new_height = 'auto'; $('.justified-image', $this).css({ 'width': '100%' , 'height': fixedHeight , 'background-image': 'url(' + image_src + ')' }) }else{ new_height = fixedHeight; $('.inner-wrap', $this).css({ 'background-image': 'url(' + image_src + ')' }) } $this.css({ 'width': new_width + 'px' , 'height': new_height , '-webkit-flex': flex_value + ' 1 ' + new_width + 'px' , '-ms-flex': flex_value + ' 1 ' + new_width + 'px' , 'flex': flex_value + ' 1 ' + new_width + 'px' , margin: Math.ceil(itemMargin*0.5) + 'px' }); }) portfolioList.imagesLoaded( function() { showPortfolioList( beforeItemLength ); }) break; case 'list-layout': portfolioList.html('').append(elementsList); portfolioContainer.append( pagePagination ); portfolioContainer.append( pageMoreButton ); portfolioList.imagesLoaded( function() { showPortfolioList( beforeItemLength ); } ) break; } // ajax_success - trigger // _this.trigger( 'ajax_success' ); // CHERRY_API.cherry_portfolio.magnific_popap_init(); } function _constructor(){ createGrid(); allPageLenght = Math.ceil( parseInt($('.portfolio-list', portfolioContainer).data('all-posts-count'))/parseInt( postPerPage ) ); allPageLenght_temp = allPageLenght; addEventsFunction(); } function addEventsFunction(){ $('.portfolio-filter > .filter a', _this).on('click', function(e){ if( !$(this).parent().hasClass('active') ){ $('.portfolio-filter > .filter li', _this).removeClass('active'); $(this).parent().addClass('active'); if(currentSlug !== $(this).data('slug')){ currentPaginationPage = 1; } currentSlug = $(this).data('slug'); ajaxGetNewContent( currentSlug, currentPaginationPage, orderSetting ); } }); $('.portfolio-filter > .order-filter', _this).on('click', 'li', function(){ var $this = $(this); $this.toggleClass('dropdown-state'); }) $('.portfolio-filter > .order-filter', _this).on('click', '[data-order="order"]', function(){ var $this = $(this) , desc_label = $this.data('desc-label') , asc_label = $this.data('asc-label') ; if( $this.hasClass('dropdown-state') ){ $('.current', $this).html( asc_label ); orderSetting.order = 'ASC'; }else{ $('.current', $this).html( desc_label ); orderSetting.order = 'DESC'; } if( 'more-button' == loadingMode ){ currentPaginationPage = 1; } ajaxGetNewContent( currentSlug, currentPaginationPage, orderSetting ); }) /*$('.portfolio-filter > .order-filter', _this).on('click', '.order-list > li', function(){ var $this = $(this) , $parent = $(this).parents('[data-order="order"]') , $orderbyList = $parent.siblings('[data-orderby="orderby"]') , order = $this.data('order') ; if( $orderbyList.hasClass('dropdown-state') ){ $orderbyList.removeClass('dropdown-state'); } $('.current', $parent).html( $this.html() ); orderSetting.order = order; if( 'more-button' == loadingMode ){ currentPaginationPage = 1; } ajaxGetNewContent( currentSlug, currentPaginationPage, orderSetting ); })*/ $('.portfolio-filter > .order-filter', _this).on('click', '.orderby-list > li', function(){ var $this = $(this) , $parent = $(this).parents('[data-orderby="orderby"]') , $orderList = $parent.siblings('[data-order="order"]') , orderby = $this.data('orderby') ; if( $parent.hasClass('dropdown-state') ){ $parent.removeClass('dropdown-state'); } $('.current', $parent).html( $this.html() ); $('li', $parent).removeClass('active'); $this.addClass('active'); orderSetting.orderby = orderby; if( 'more-button' == loadingMode ){ currentPaginationPage = 1; } ajaxGetNewContent( currentSlug, currentPaginationPage, orderSetting ); }) switch( loadingMode ){ case 'ajax-pagination': $('.portfolio-pagination > ul > li a', _this).on('click', function(e){ ajaxPaginationLinkClickEventFunction( $(this) ); }) $('.portfolio-pagination .page-nav .next-page', _this).on('click', function(e){ ajaxNavigationClickEvent( $(this), 'next' ); }) $('.portfolio-pagination .page-nav .prev-page', _this).on('click', function(e){ ajaxNavigationClickEvent( $(this), 'prev' ); }) break case 'more-button': $('.portfolio-ajax-button .load-more-button a', _this).on('click', function(e){ ajaxMoreButtonClickEventFunction(); }) break } // update columnWidth on window resize jQuery(window).on('resize.portfolio_layout_resize', function(){ mainResizer(); }); } function showPortfolioList( index ){ var counter = 1; $('.portfolio-item', portfolioContainer).each(function(){ if( $(this).index() >= index){ show_item( $(this), 100*parseInt(counter) ); counter++; } }) function show_item( itemList, delay ){ var timeOutInterval = setTimeout(function(){ itemList.removeClass('animate-cycle-show'); }, delay ); } } function hidePortfolioList(){ $('.portfolio-item', portfolioContainer).each( function(){ hide_item( $(this), 50*parseInt($(this).index()+1) ); } ) function hide_item(itemList, delay){ var timeOutInterval = setTimeout(function(){ itemList.addClass('animate-cycle-hide'); }, delay ); } } function mainResizer(){ switch(listLayout){ case 'masonry-layout': case 'grid-layout': var newWidth = Math.floor( $('.portfolio-list', portfolioContainer).width() / widthLayoutChanger() ) ; $('.portfolio-list .portfolio-item', portfolioContainer).css({ "width": newWidth }); $('.portfolio-list', portfolioContainer).isotope({ masonry: { columnWidth: newWidth } }); break; case 'list-layout': break; } jQuery(window).trigger('afterResize.portfolio_layout_resize'); } function widthLayoutChanger(){ var windowWidth = $(window).width() , columnPerView , widthLayout = 'large' ; if ( windowWidth >= 1200 ) { widthLayout = 'large'; } if ( windowWidth <= 1199 && windowWidth >= 768 ) { widthLayout = 'medium'; } if ( windowWidth <= 767 && windowWidth >= 481) { widthLayout = 'small'; } if ( windowWidth <= 480 ) { widthLayout = 'extra-small'; } switch ( widthLayout ) { case 'large': columnPerView = column; break case 'medium': columnPerView = Math.ceil( column / 2 ); break case 'small': columnPerView = Math.ceil( column / 4 ); break case 'extra-small': columnPerView = 1; break } return columnPerView; } }); }, destroy : function( ) { }, update : function( content ) { } }; $.fn.cherryPortfolioLayoutPlugin = function( method ){ if ( methods[method] ) { return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); } else if ( typeof method === 'object' || ! method ) { return methods.init.apply( this, arguments ); } else { $.error( 'Method with name ' + method + ' is not exist for jQuery.cherryPortfolioLayoutPlugin' ); } }//end plugin })(jQuery)
[+]
..
[+]
jQuery-Tags-Input
[-] countdown.js
[edit]
[-] owl.carousel.js
[edit]
[-] base.js
[edit]
[-] jquery.ui.core.js
[edit]
[+]
select2
[-] jquery.matchHeight-min.js
[edit]
[+]
master-slider
[-] jquery.metadata.js
[edit]
[+]
owl-carousel
[-] dataTables.columnFilter.js
[edit]
[-] codemirror.js
[edit]
[+]
jqvmap
[-] css.js
[edit]
[-] jquery.ui.button.js
[edit]
[-] jquery.vticker.min.js
[edit]
[-] jwplayer.js
[edit]
[-] masonry.pkgd.js
[edit]
[-] jquery.smartmenus.min - Copy.js
[edit]
[-] jquery.ui.widget.js
[edit]
[-] jquery.ba-resize.min.js
[edit]
[-] jquery-ui-timepicker.js
[edit]
[-] jquery-migrate.js
[edit]
[-] jquery.nearest.min.js
[edit]
[-] swfobject.js
[edit]
[-] javascript.js
[edit]
[-] jquery.validate.password.js
[edit]
[-] jquery.colorbox.js
[edit]
[-] flexigrid.js
[edit]
[-] jquery.smartmenus.min.js
[edit]
[-] jcarousellite.js
[edit]
[+]
ckeditor_standard
[-] twig.min.js
[edit]
[-] superfish.js
[edit]
[-] bootstrap.min - Copy.js
[edit]
[-] jquery.dataTables.min.js
[edit]
[-] mustache.js
[edit]
[-] spectrum.js
[edit]
[-] jquery.ui.droppable.js
[edit]
[-] jquery.isotope.js
[edit]
[-] jquery.ui.slider.js
[edit]
[-] htmlmixed.js
[edit]
[-] jquery.tinycarousel.min.js
[edit]
[-] jquery.ui.sortable.js
[edit]
[-] jquery.hover.js
[edit]
[-] wow.min.js
[edit]
[-] jquery.fittext.js
[edit]
[+]
jquery.validate
[-] jquery.ui.draggable.js
[edit]
[-] jquery.ui.resizable.js
[edit]
[-] audio.min.js
[edit]
[+]
angular
[+]
less
[-] masonry.pkgd.min.js
[edit]
[+]
plupload
[-] jquery.rd-parallax.js
[edit]
[-] tabs.js
[edit]
[-] responsive.js
[edit]
[-] xml.js
[edit]
[-] expressInstall.swf
[edit]
[-] camera.js
[edit]
[-] pace.min.js
[edit]
[-] typed.js
[edit]
[-] jquery.nivo.slider.js
[edit]
[+]
bootstrap
[-] qtip.js
[edit]
[+]
mediaelement
[-] jquery.ui.mouse.js
[edit]
[+]
slick
[-] countUp.js
[edit]
[-] jquery.prettyPhoto.js
[edit]
[+]
ckeditor_full
[-] jquery.ui.spinner.js
[edit]
[-] portfolio-layout-plugin.js
[edit]
[-] require.js
[edit]
[-] nicEdit.js
[edit]
[-] jquery.json-2.4.min.js
[edit]
[-] jquery.ba-resize.js
[edit]
[-] jquery.mobilemenu.js
[edit]
[+]
nivo_slider
[+]
ui-iconpicker
[-] cloud-zoom.js
[edit]
[-] jquery.ui.datepicker.js
[edit]
[-] jquery.cycle.all.js
[edit]
[-] jquery.validate.js
[edit]
[+]
flot
[+]
jquery-ui
[-] jquery.cleditor.min.js
[edit]
[-] jquery.easing.js
[edit]
[-] jquery.elevateZoom.min.js
[edit]
[-] bootstrap.min.js
[edit]
[-] jquery.bxslider.js
[edit]
[-] mediaelement-and-player.min.js
[edit]
[-] jquery.zoom-min.js
[edit]
[-] jquery.nearest.js
[edit]
[-] jquery.autosize.js
[edit]