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/offCanvasCartWidget.js
/* global xts_settings */
(function($) {
	XTSThemeModule.offCanvasCartWidget = function () {
		var $closeSide = $('.xts-close-side');
		var $widget = $('.xts-cart-widget-side');
		var $body = XTSThemeModule.$body;

		$body.on('click', '.xts-header-cart.xts-opener, .xts-navbar-cart.xts-opener', function (e) {
			if (!isCart() && !isCheckout()) {
				e.preventDefault();
			}

			if ($widget.hasClass('xts-opened')) {
				hideWidget();
			} else {
				showWidget();
			}
		});

		$body.on('click touchstart', '.xts-close-side', function () {
			hideWidget();
		});

		$body.on('click touchstart', '.xts-close-button a', function (e) {
			e.preventDefault();
			hideWidget();
		});

		XTSThemeModule.$document.on('keyup', function (e) {
			if (27 === e.keyCode) {
				hideWidget();
			}
		});

		var showWidget = function () {
			XTSThemeModule.$document.trigger('xtsOffCanvasCartWidgetShown');

			if (isCart() || isCheckout()) {
				return false;
			}

			$widget.addClass('xts-opened');
			$closeSide.addClass('xts-opened');
		};

		var hideWidget = function () {
			$widget.removeClass('xts-opened');
			$closeSide.removeClass('xts-opened');
		};

		var isCart = function () {
			return XTSThemeModule.$body.hasClass('woocommerce-cart');
		};

		var isCheckout = function () {
			return XTSThemeModule.$body.hasClass('woocommerce-checkout');
		};
	};

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