HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux vm8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: afleverb (1000)
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: //var/www/mussarq_bak/wp-content/themes/wpnull24/framework/js/plugins/woocommerce.js
/**
 * UpSolution Element: w-cart
 *
 * @requires $us.canvas
 * @requires $us.nav
 */
jQuery( function( $ ) {
	var $cart = $( '.w-cart' );
	if ( $cart.length == 0 ) {
		return;
	}
	var $quantity = $cart.find( '.w-cart-quantity' );

	var us_accessibility = function() {
		$cart.find( 'a' ).on( 'focus.upsolution', function() {
			$( this ).closest( '.w-cart' ).addClass( 'opened' );
		} );
		$cart.find( 'a' ).on( 'blur.upsolution', function() {
			$( this ).closest( '.w-cart' ).removeClass( 'opened' );
		} );
	};

	us_accessibility();

	var updateCart = function() {
		if ( $cart.hasClass( 'opened' ) ) {
			$cart.removeClass( 'opened' );
		}
		var $mini_cart_amount = $cart.find( '.us_mini_cart_amount' ).first(),
			mini_cart_amount = $mini_cart_amount.text();

		if ( mini_cart_amount !== undefined ) {
			mini_cart_amount = mini_cart_amount + '';
			mini_cart_amount = mini_cart_amount.match( /\d+/g );

			if ( mini_cart_amount > 0 ) {
				$quantity.html( mini_cart_amount );
				$cart.removeClass( 'empty' );
			} else {
				$quantity.html( '0' );
				$cart.addClass( 'empty' );
			}
		} else {
			// fallback in case our action wasn't fired somehow
			var $quantities = $cart.find( '.quantity' ),
				total = 0;
			$quantities.each( function() {
				var quantity,
					text = $( this ).text() + '',
					matches = text.match( /\d+/g );

				if ( matches ) {
					quantity = parseInt( matches[ 0 ], 10 );
					total += quantity;
				}
			} );
			if ( total > 0 ) {
				$quantity.html( total );
				$cart.removeClass( 'empty' );
			} else {
				$quantity.html( '0' );
				$cart.addClass( 'empty' );
			}
		}
	};

	updateCart();

	$( document.body ).bind( 'wc_fragments_loaded', function() {
		updateCart();
		us_accessibility();
	} );

	$( document.body ).bind( 'wc_fragments_refreshed', function() {
		updateCart();
		us_accessibility();
	} );

	var $notification = $cart.find( '.w-cart-notification' ),
		$productName = $notification.find( '.product-name' ),
		$cartLink = $cart.find( '.w-cart-link' ),
		$dropdown = $cart.find( '.w-cart-dropdown' ),
		$quantity = $cart.find( '.w-cart-quantity' ),
		productName = $productName.text(),
		showFn = 'fadeInCSS',
		hideFn = 'fadeOutCSS',
		opened = false;

	$notification.on( 'click', function() {
		$notification[ hideFn ]();
	} );

	jQuery( 'body' ).bind( 'added_to_cart', function( event, fragments, cart_hash, $button ) {
		if ( event === undefined ) {
			return;
		}

		updateCart();

		productName = $button.closest( '.product' ).find( '.woocommerce-loop-product__title' ).text();
		$productName.html( productName );

		$notification.addClass( 'shown' );
		$notification.on( 'mouseenter', function() {
			$notification.removeClass( 'shown' );
		} );

		var newTimerId = setTimeout( function() {
			$notification.removeClass( 'shown' );
			$notification.off( 'mouseenter' );
		}, 3000 );

	} );

	if ( $.isMobile ) {
		var outsideClickEvent = function( e ) {
			if ( jQuery.contains( $cart[ 0 ], e.target ) ) {
				return;
			}
			$cart.removeClass( 'opened' );
			$us.$body.off( 'touchstart', outsideClickEvent );
			opened = false;
		};
		$cartLink.on( 'click', function( e ) {
			if ( ! opened ) {
				e.preventDefault();
				$cart.addClass( 'opened' );
				$us.$body.on( 'touchstart', outsideClickEvent );
			} else {
				$cart.removeClass( 'opened' );
				$us.$body.off( 'touchstart', outsideClickEvent );
			}
			opened = ! opened;
		} );
	}
} );