(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');
});
$('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 (){
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');
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;
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();
});
$(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);
(function($){
var animations={
'move-up': {
timeout: 200
},
bounce: {
timeout: 100
},
'fade-in': {
timeout: 100
},
scale: {
timeout: 100
},
flip: {
timeout: 100
},
'fall-perspective': {
timeout: 100
},
};
var prefixes='Webkit Moz ms Ms O'.split(' ');
var docElemStyle=document.documentElement.style;
function getStyleProperty(propName){
if(!propName){
return;
}
if(typeof docElemStyle[ propName ]==='string'){
return propName;
}
propName=propName.charAt(0).toUpperCase() + propName.slice(1);
var prefixed;
for(var i=0, len=prefixes.length; i < len; i++){
prefixed=prefixes[i] + propName;
if(typeof docElemStyle[ prefixed ]==='string'){
return prefixed;
}}
}
var transitionProperty=getStyleProperty('transition');
var transitionEndEvent={
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'otransitionend',
transition: 'transitionend'
}[ transitionProperty ];
function ItemsAnimations(el, options){
var self=this;
this.el=el;
this.$el=$(el);
this.options={
itemSelector: '',
scrollMonitor: false,
firstItemStatic: false
};
$.extend(this.options, options);
this.$el.data('itemsAnimations', this);
self.initialize();
}
$.fn.itemsAnimations=function(options){
if(typeof options==='string'){
var instance=$(this.get(0)).data('itemsAnimations');
if(!instance){
return false;
}
if(options==='instance'){
return instance;
}}else{
return new ItemsAnimations(this.get(0), options);
}}
ItemsAnimations.prototype={
initialize: function(){
var self=this;
this.queue=[];
this.queue_is_run=false;
this.watchers={};
this.animation=this.getAnimation();
if(!this.animation||($(window).width() < 768&&!this.$el.hasClass('enable-animation-mobile'))){
this.animationName='disabled';
this.animation=this.getAnimationByName('disabled');
}
if(this.options.firstItemStatic){
this.firstStatisItem=$(this.options.itemSelector + ':first', this.$el);
this.firstStatisItem.removeClass('item-animations-not-inited');
}
if(this.animationName=='disabled'){
$(this.options.itemSelector, this.$el).removeClass('item-animations-not-inited');
}},
initTimer: function(){
var self=this;
this.timer=document.createElement('div');
this.timer.className='items-animations-timer-element';
if(this.animation.timeout > 0){
this.timer.setAttribute("style",
"transition-duration: " + this.animation.timeout + "ms; -webkit-transition-duration: " + this.animation.timeout + "ms; -moz-transition-duration: " + this.animation.timeout + "ms; -o-transition-duration: " + this.animation.timeout + "ms;"
);
}
document.body.appendChild(this.timer);
this.timerCallback=function(){};
$(this.timer).bind(transitionEndEvent, function(event){
self.timerCallback();
});
this.timer.className +=' start-timer';
},
startTimer: function(callback){
setTimeout(callback, this.animation.timeout);
},
startTimerOld: function(callback){
this.timerCallback=callback;
if(this.timer.className.indexOf('start-timer')!=-1){
this.timer.className=this.timer.className.replace(' start-timer', '');
}else{
this.timer.className +=' start-timer';
}},
show: function($items, forceUseScrollMonitor){
var self=this;
if(forceUseScrollMonitor===undefined){
forceUseScrollMonitor=false;
}
if(this.animationName=='disabled'){
$(this.options.itemSelector, this.$el).removeClass('item-animations-not-inited');
return false;
}
if($items==undefined){
$items=$(this.options.itemSelector, this.$el);
}
$items.not('.item-animations-inited').each(function(index){
var $this=$(this);
if(self.options.firstItemStatic&&self.firstStatisItem&&self.firstStatisItem.get(0)==this){
$this.addClass('item-animations-inited');
return;
}
$this.addClass('item-animations-inited');
if((self.options.scrollMonitor||forceUseScrollMonitor)&&window.scrollMonitor!==undefined&&this.animationName!='disabled'){
var watcher=scrollMonitor.create(this, -50);
watcher.enterViewport(function(){
var watcher=this;
self.showItem($this, watcher);
});
self.watchers[ watcher.uid ]=watcher;
}else{
self.showItem($this);
}});
$(this.options.itemSelector, this.$el).not('.item-animations-inited').removeClass('item-animations-not-inited');
},
reinitItems: function($items){
$items.removeClass('start-animation item-animations-inited item-animations-loading before-start').addClass('item-animations-not-inited');
this.clear();
},
getAnimationName: function(){
var m=this.$el[0].className.match(/item-animation-(\S+)/);
if(!m){
return '';
}
return m[1];
},
getAnimation: function(){
this.animationName=this.getAnimationName();
return this.getAnimationByName(this.animationName);
},
getAnimationByName: function(name){
if(!name||animations[name]==undefined){
return false;
}
return animations[name];
},
showItem: function($item, watcher){
var self=this;
if($item.hasClass('item-animations-loading')){
return false;
}
$item.addClass('before-start');
function showItemCallback(){
if($item.length==0){
return false;
}
self.animate($item);
if(watcher!=undefined){
self.destroyWatcher(watcher);
}}
$item.addClass('item-animations-loading');
if(this.animation.timeout > 0){
this.queueAdd(showItemCallback, this.animation.timeout);
}else{
showItemCallback();
}},
destroyWatcher: function(watcher){
if(this.watchers[ watcher.uid ]!=undefined){
delete this.watchers[ watcher.uid ];
}
watcher.destroy();
},
animate: function($item, animation){
$item.bind(transitionEndEvent, function(event){
var target=event.target||event.srcElement;
if(target!=$item[0]){
return;
}
$item.unbind(transitionEndEvent);
$item.removeClass('before-start start-animation');
});
$item.removeClass('item-animations-loading item-animations-not-inited').addClass('start-animation');
},
queueAdd: function(callback, timeout){
var self=this;
this.queue.push({
callback: callback,
timeout: timeout
});
if(this.queue.length==1&&!this.queue_is_run){
this.startTimer(function(){
self.queueNext();
});
}},
queueNext: function(){
var self=this;
if(this.queue.length==0){
return false;
}
var next_action=this.queue.shift();
if(next_action==undefined){
return false;
}
this.queue_is_run=true;
next_action.callback();
this.startTimer(function(){
self.queue_is_run=false;
self.queueNext();
});
},
clear: function(){
this.queue=[];
this.queue_is_run=false;
for (var watcher_uid in this.watchers){
if(this.watchers.hasOwnProperty(watcher_uid)){
this.destroyWatcher(this.watchers[watcher_uid]);
}}
this.watchers=[];
}};})(jQuery);
(function (){
'use strict';
var enableLogging_SendEvents=false;
if(typeof UniPixelConsoleState!=='undefined'&&UniPixelConsoleState.logSendEvents===true){
enableLogging_SendEvents=true;
}
function log_Send(message, data){
if(enableLogging_SendEvents&&typeof UniPixelConsoleLogger!=='undefined'){
UniPixelConsoleLogger.log('SEND', message, data);
}}
function getCookie(name){
const match=document.cookie.match(new RegExp('(?:^|;)' + name.replace(/([$?*|{}()[\]\\/+^])/g, '\\$1') + '=([^;]*)'));
return match ? decodeURIComponent(match[1]):null;
}
function parseOneTrust(){
const consent=getCookie('OptanonConsent');
if(!consent) return {};
const parsed={};
const groupsMatch=consent.match(/groups=([^;]+)/);
if(!groupsMatch) return {};
const pairs=groupsMatch[1].split(',');
pairs.forEach(pair=> {
const [group, value]=pair.split(':');
if(group&&value){
if(group==='C0001') parsed.marketing=(value==='1');
if(group==='C0002') parsed.performance=(value==='1');
if(group==='C0003') parsed.functional=(value==='1');
}});
return parsed;
}
function parseSilktide(){
const cookie=getCookie('CookieControl');
if(!cookie) return {};
try {
const json=JSON.parse(cookie);
if(!json||!json.categories) return {};
return {
marketing: !!json.categories.marketing,
performance: !!json.categories.performance,
functional: !!json.categories.functional
};} catch (e){
return {};}}
function parseCookiebot(){
const cookie=getCookie('CookieConsent');
if(!cookie) return {};
try {
const json=JSON.parse(cookie);
return {
necessary: !!json.necessary,
performance: !!(json.statistics||json.preferences),
marketing: !!json.marketing
};} catch (e){
return {};}}
function parseOsano(){
const cookie=getCookie('osano_consentmanager');
if(!cookie) return {};
try {
const json=JSON.parse(cookie);
if(!json||!json.consent) return {};
return {
marketing: !!json.consent.marketing,
performance: !!json.consent.performance,
functional: !!json.consent.functional
};} catch (e){
return {};}}
function parseOrestBida(){
const cookie=getCookie('cc_cookie')||getCookie('cookie_consent');
if(!cookie) return {};
try {
const json=JSON.parse(cookie);
const accepted=json.categories||json.acceptedCategories||[];
return {
necessary: accepted.includes('necessary'),
functional: accepted.includes('functional')||accepted.includes('preferences'),
performance: accepted.includes('performance')||accepted.includes('analytics')||accepted.includes('statistics'),
marketing: accepted.includes('marketing')||accepted.includes('advertising')
};} catch (e){
return {};}}
function unipixel_applyConsentToGtag(){
if(typeof gtag!=='function'){
setTimeout(unipixel_applyConsentToGtag, 100);
return;
}
try {
const match=document.cookie.match(/(?:^|;)unipixel_consent_summary=([^;]*)/);
if(!match) return;
const summary=JSON.parse(decodeURIComponent(match[1]));
gtag('consent', 'update', {
'ad_storage': summary.marketing ? 'granted':'denied',
'analytics_storage': summary.performance ? 'granted':'denied',
'functionality_storage': summary.functional ? 'granted':'denied',
'security_storage': 'granted'
});
console.log('UniPixel → Google consent updated:', summary);
} catch (e){
console.warn('UniPixel → Google consent mapping failed', e);
}}
window.unipixelCreateConsentSummaryFromVendors=function (){
const summary={
necessary: true,
functional: null,
performance: null,
marketing: null
};
Object.assign(summary, parseOneTrust());
Object.assign(summary, parseSilktide());
Object.assign(summary, parseOsano());
Object.assign(summary, parseCookiebot());
Object.assign(summary, parseOrestBida());
document.cookie='unipixel_consent_summary=' +
encodeURIComponent(JSON.stringify(summary)) +
'; path=/; SameSite=Lax';
};
window.addEventListener('load', ()=> {
if(typeof window.UniPixelSettings==='undefined'){
return;
}
if(typeof window.UniPixelSettings.consent_honour==='undefined'){
return;
}
if(window.UniPixelSettings.consent_honour!=1){
return;
}else{
}
if(typeof window.unipixelCreateConsentSummaryFromVendors!=='function'){
return;
}
if(window.UniPixelSettings &&
window.UniPixelSettings.consent_honour==1 &&
window.UniPixelSettings.consent_ui==='unipixel'
){
return;
}
window.unipixelCreateConsentSummaryFromVendors();
unipixel_applyConsentToGtag();
});
window.unipixelCheckConsentForEvent=function (){
try {
if(!window.UniPixelSettings||parseInt(window.UniPixelSettings.consent_honour, 10)!==1){
log_Send('UniPixel | Consent Check | Honour-Consent setting is OFF: allowing event.');
return true;
}
var cookie=document.cookie.match(/(?:^|;)unipixel_consent_summary=([^;]*)/);
if(!cookie){
log_Send('UniPixel | Consent Check | Honour-Consent setting is ON, but no consent cookie found: blocking event.');
return false;
}
var summary=JSON.parse(decodeURIComponent(cookie[1]));
if(!summary.marketing||!summary.performance){
log_Send('UniPixel | Consent Check | Honour-Consent setting is ON and choices say not allowed: blocking event | marketing: ' + summary.marketing + ' | performance: ' + summary.performance);
return false;
}
log_Send('UniPixel | Consent | Honour Consent is ON and choices allow event: allowing event | marketing: ' + summary.marketing + ' | performance: ' + summary.performance);
return true;
} catch (e){
log_Send('UniPixel | Consent | Consent check failed, blocking event by default.', e);
return false;
}};})();