HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/hanode/public_html/wp-content/plugins/sw_core/js/portfolio.js
(function($) {
	"use strict";
	$(document).ready(function(){
		$( '.kingstore-portfolio' ).each(function(){
			var $this 			= $(this);
			var $id 			= this.id;
			var $pf_id 			= ('#' + this.id );
			var $ajax_url 		= ya_portfolio.ajax_url;
			var $ya_style 		= $this.data('style');
			var $categories 	= $this.data('categories');
			var $max_page 		= $this.data('max_page');
			var $attributes 	= $this.data('attributes');
			var $number 		= $this.data('number');
			var $offset 		= $this.data('offset');
			var $orderby 		= $this.data('orderby');
			var $order 			= $this.data('order');
			var $container_id 	= $('#container_'+ $id);
			var $tab_id 		= $('#tab_'+ $id);
			var $container 		= $container_id; //The ID for the list with all the blog posts
			if( $ya_style == 'fitRows' ){
				$container.imagesLoaded().progress( function() {
					$container.isotope({ //Isotope options, 'item' matches the class in the PHP
						layoutMode : 'fitRows'
					});
				});
			}else{
				$container.imagesLoaded().progress( function() {
					$container.isotope({ //Isotope options, 'item' matches the class in the PHP
						layoutMode : 'masonry',
						percentPosition: true,
						masonry: {
						  columnWidth: '.portfolio-item'
						}
					});
				});
			}
		 
			//Add the class selected to the item that is clicked, and remove from the others
			var $optionSets = $tab_id,
			$optionLinks = $optionSets.find('li');
			$optionLinks.click(function(){
				var $this = $(this);
				// don't proceed if already selected
				if ( $this.hasClass('selected') ) {
				  return false;
				}
				var $optionSet = $this.parents($tab_id);
				$optionSets.find('.selected').removeClass('selected');
				$this.addClass('selected');
			 
				//When an item is clicked, sort the items.
				 var selector = $(this).attr('data-portfolio-filter');
				$container.isotope({ filter: selector });
				return false;
			});
			var $page = 1;
			var $btn_loadmore = $($pf_id + ' .btn-loadmore');
			$btn_loadmore.on("click", function(){
				if( $page >= $max_page ){
					return false;
				}
				$(this).addClass('btn-loading');
				jQuery.ajax({
					 type: "POST",
					 url: $ajax_url,
					 data: ({
						action : "sw_portfolio_ajax",
						catid  : $categories,
						numb   : $number,
						orderby: $orderby,
						order : $order,
						page : $page,
						style : $ya_style,
						attributes: $attributes
					}),
					 success: function(data) {
					 	console.log( data );
						var $newItems = $(data);
						if( $newItems.length > 0 ){
							$newItems.imagesLoaded( function(){
								setTimeout(function(){
									$container_id.isotope('reloadItems').isotope("insert",$newItems);
								}, 500);
							});
							$btn_loadmore.removeClass('btn-loading');
							$page = $page + 1;
							if( $newItems.length < $number ){
								$btn_loadmore.addClass( 'btn-loaded' );
							}
							if( $page >= $max_page ){
								$btn_loadmore.addClass( 'btn-loaded' );
							}

							
						 }else{
							$btn_loadmore.removeClass('btn-loading').addClass( 'btn-loaded' );
						 }
					 }
				 });
			});
		});
		$( '.item-popup' ).fancybox({
			helpers : {
				title : {
					type : 'over'
				}
			}
		});
	});
})(jQuery);