HEX
Server: LiteSpeed
System: Linux linux31.centraldnserver.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: salamatk (1501)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open
Upload Files
File: /home/salamatk/takarzan.ir/wp-content/themes/xts-luman/js/scripts/productRecentlyViewed.js
/* global xts_settings */
(function($) {
	XTSThemeModule.productRecentlyViewed = function() {
		$('.xts-products').each( function () {
			var $this = $(this);
			var attr = $this.data('atts');

			if ( 'undefined' === typeof attr || 'undefined' === typeof attr.product_source || 'recently_viewed' !== attr.product_source || 'undefined' === typeof attr.ajax_recently_viewed || '1' !== attr.ajax_recently_viewed ) {
				return;
			}

			$.ajax({
				url     : xts_settings.ajaxurl,
				data    : {
					attr  : attr,
					action: 'xts_get_recently_viewed_products'
				},
				dataType: 'json',
				method  : 'POST',
				success : function(data) {
					if (data.items) {
						$this.replaceWith(data.items);

						XTSThemeModule.$document.trigger('xtsProductLoadMoreReInit');
						XTSThemeModule.$document.trigger('xtsImagesLoaded');
					}
				},
				error   : function() {
					console.log('ajax error');
				},
			});
		})
	};

	$(document).ready(function() {
		XTSThemeModule.productRecentlyViewed();
	});
})(jQuery);