1(function ($) { 2 $('.variations_form').each(function () { 3 $form = $(this) 4 .on('change', '.variations select', function (event) { 5 var $text = $(this).closest('.combobox-wrapper').find('.combobox-text'); 6 $text.text($('option:selected', $(this)).text()); 7 }); 8 }); 9 10 $( document ).on('click', '.shipping-calculator-button', function(e) { 11 e.preventDefault(); 12 $(this).toggleClass('active'); 13 }); 14 15 $('body').on('updated_checkout', function () { 16 $('input.gem-checkbox').checkbox(); 17 $('select.shipping_method').combobox(); 18 try { 19 window.init_checkout_navigation(); 20 } catch (e) {} 21 }); 22 23 $('body').on('updated_shipping_method', function () { 24 $('input.gem-checkbox').checkbox(); 25 $('select.shipping_method').combobox(); 26 }); 27 28 $('.remove_from_wishlist_resp').on('click', function (e) { 29 $(this).closest('.cart-item').find('.wishlist_table .product-remove .remove_from_wishlist').click(); 30 e.preventDefault(); 31 return false; 32 }); 33 34 $(function () { 35 $('.price_slider_amount .button').addClass('gem-button gem-button-style-outline gem-button-size-tiny'); 36 }); 37 38 // Quantity buttons 39 $('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>'); 40 41 $(document).on('click', '.plus, .minus', function () { 42 43 // Get values 44 var $qty = $(this).closest('.quantity').find('.qty'), 45 currentVal = parseFloat($qty.val()), 46 max = parseFloat($qty.attr('max')), 47 min = parseFloat($qty.attr('min')), 48 step = $qty.attr('step'); 49 50 // Format values 51 if (!currentVal || currentVal === '' || currentVal === 'NaN') currentVal = 0; 52 if (max === '' || max === 'NaN') max = ''; 53 if (min === '' || min === 'NaN') min = 0; 54 if (step === 'any' || step === '' || step === undefined || parseFloat(step) === 'NaN') step = 1; 55 56 // Change the value 57 if ($(this).is('.plus')) { 58 59 if (max && (max == currentVal || currentVal > max)) { 60 $qty.val(max); 61 } else { 62 $qty.val(currentVal + parseFloat(step)); 63 } 64 65 } else { 66 67 if (min && (min == currentVal || currentVal < min)) { 68 $qty.val(min); 69 } else if (currentVal > 0) { 70 $qty.val(currentVal - parseFloat(step)); 71 } 72 73 } 74 $qty.trigger('change'); 75 }); 76 77 $(document).on('change input', 'form.woocommerce-cart-form.update-cart-automatically .cart_item :input', function () { 78 var $form = $(this).closest('form'); 79 clearTimeout(window.thegem_cart_update); 80 window.thegem_cart_update = setTimeout(function() { 81 $form.find('.submit-buttons .update-cart button').trigger('click'); 82 }, 600); 83 }); 84 85 $(document).on('click', '.product-bottom a.add_to_cart_button', function () { 86 if ($(this).parents('.extended-products-grid').length) { 87 return 88 } 89 $(this).closest('.product-bottom').find('a, .yith-wcwl-add-to-wishlist').hide(); 90 }); 91 92 $(document).on('click', '.product-bottom a.add_to_wishlist', function () { 93 if ($(this).parents('.extended-products-grid').length) { 94 return 95 } 96 var current_product = $(this).data('product-id'); 97 $('a.add_to_wishlist[data-product-id=' + current_product + ']').each(function () { 98 $(this).closest('.product-bottom').find('a').hide(); 99 $(this).parent().addClass('ajax'); 100 }) 101 }); 102 103 $('body').on('added_to_wishlist', function (t, el_wrap) { 104 $('.yith-wcwl-wishlistaddedbrowse').parents('.yith-wcwl-add-to-wishlist').addClass('icon'); 105 }); 106 107 108 $(document).on('click', '.woocommerce-review-link', function (e) { 109 $('.gem-woocommerce-tabs').find('a[data-vc-accordion][href="#tab-reviews"]').trigger('click'); 110 }); 111 112 $(function () { 113 if (typeof wc_add_to_cart_variation_params !== 'undefined') { 114 $('.variations_form').each(function () { 115 $(this).on('show_variation', function (event, variation) { 116 if (variation.image_id) { 117 var $product_content = $(this).closest('.single-product-content'); 118 var $gallery = $product_content.find('.gem-gallery').eq(0); 119 if ($gallery.length) { 120 var $gallery_item = $gallery.find('.gem-gallery-thumbs-carousel .gem-gallery-item[data-image-id="' + variation.image_id + '"] a'); 121 $gallery_item.closest('.gem-gallery-item').addClass('active'); 122 $gallery_item.trigger('click'); 123 } 124 } 125 }); 126 }); 127 } 128 }); 129 130 $(function () { 131 if (typeof wc_add_to_cart_variation_params !== 'undefined') { 132 $('.variations_form').each(function () { 133 $(this).on('show_variation', function (event, variation) { 134 if (variation.image_id) { 135 var $product_content = $(this).closest('.single-product-content'); 136 var $gallery = $product_content.find('.product-gallery').eq(0); 137 var $mainCarousel = $gallery.find('.product-gallery-slider'); 138 if ($gallery.length) { 139 var $gallery_item = $gallery.find('.product-gallery-slider .product-gallery-slider-item[data-image-id="' + variation.image_id + '"]').parent('.owl-item').index(); 140 $mainCarousel.trigger('to.owl.carousel', [$gallery_item, 300, true]); 141 } 142 } 143 }); 144 }); 145 } 146 }); 147 148 $(document.body).on('updated_wc_div applied_coupon removed_coupon', function () { 149 $('.shop_table.cart').closest('form').eq(0).nextAll('.woocommerce-message').remove(); 150 $('.shop_table.cart').closest('form').eq(0).nextAll('.woocommerce-info').remove(); 151 $('.shop_table.cart').closest('form').eq(0).nextAll('.woocommerce-error').remove(); 152 $('.shop_table.cart').closest('form').eq(1).nextAll('form').remove(); 153 $('input.gem-checkbox').checkbox(); 154 $('select.shipping_method').combobox(); 155 $('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>'); 156 157 if($('body').hasClass('woocommerce-cart-layout-classic')) { 158 $.ajax({
159 type: 'POST', 160 url: thegem_woo_data.ajax_url, 161 data: { 162 action: 'thegem_cart_items_html', 163 }, 164 dataType: 'html', 165 success: function (response) { 166 $('.cart-short-info').replaceWith($(response)); 167 } 168 }); 169 } 170 }); 171 172 $(document.body).on('updated_wc_div updated_shipping_method', function() { 173 $( 'select.country_to_state, input.country_to_state' ).trigger( 'change' ); 174 $( document.body ).trigger( 'country_to_state_changed' ); 175 }); 176 177 $(function () { 178 $('.gem-product-load-more').each(function () { 179 if ($.fn.itemsAnimations !== undefined) { 180 var $products_parent = $(this).siblings('.products'); 181 if (!$products_parent.hasClass('item-animation-move-up')) { 182 $products_parent.addClass('item-animation-move-up'); 183 } 184 $products_parent.itemsAnimations({ 185 itemSelector: '.product' 186 }); 187 } 188 $(this).on('click', 'button', function () { 189 products_load_core_request($(this).closest('.gem-product-load-more')); 190 }); 191 }); 192 193 $('.gem-product-scroll-pagination').each(function () { 194 var $this = $(this), 195 watcher = scrollMonitor.create(this); 196 watcher.enterViewport(function () { 197 products_load_core_request($this); 198 }); 199 200 if ($.fn.itemsAnimations !== undefined) { 201 var $products_parent = $(this).siblings('.products'); 202 if (!$products_parent.hasClass('item-animation-move-up')) { 203 $products_parent.addClass('item-animation-move-up'); 204 } 205 $products_parent.itemsAnimations({ 206 itemSelector: '.product' 207 }); 208 } 209 }); 210 }); 211 212 function products_load_core_request($pagination) { 213 var current = parseInt($pagination.data('pagination-current')), 214 total = parseInt($pagination.data('pagination-total')), 215 base_url = $pagination.data('pagination-base'), 216 is_processing_request = $pagination.data('request-process') || false, 217 next_page = current + 1, 218 next_page_url = base_url.replace('%#%', next_page); 219 220 if (is_processing_request || next_page > total) { 221 return false; 222 } 223 $pagination.data('request-process', true); 224 if ($pagination.hasClass('gem-product-load-more')) { 225 $('.gem-button', $pagination).before('<div class="loading"><div class="preloader-spin"></div></div>'); 226 } 227 if ($pagination.hasClass('gem-product-scroll-pagination')) { 228 $pagination.addClass('active').html('<div class="loading"><div class="preloader-spin"></div></div>'); 229 } 230 231 $.ajax({ 232 url: next_page_url, 233 data: {thegem_products_ajax: 1}, 234 success: function (response) { 235 if ($pagination.hasClass('gem-product-load-more')) { 236 $('.gem-button .loading', $pagination).remove(); 237 } 238 if ($pagination.hasClass('gem-product-scroll-pagination')) { 239 $pagination.removeClass('active').html(''); 240 } 241 242 var $response = $(response), 243 $products = $('.products .product', $response); 244 245 if ($products.length) { 246 var $products_parent = $pagination.siblings('.products'); 247 $products_parent.append($products); 248 if ($.fn.itemsAnimations !== undefined) { 249 var itemsAnimations = $products_parent.itemsAnimations('instance'); 250 if (itemsAnimations) { 251 itemsAnimations.show($products); 252 } 253 } 254 $pagination.data('pagination-current', next_page); 255 if (next_page >= total) { 256 $pagination.hide().remove(); 257 } 258 } 259 if ($pagination.hasClass('gem-product-load-more')) { 260 $('.loading', $pagination).remove(); 261 } 262 if ($pagination.hasClass('gem-product-scroll-pagination')) { 263 $pagination.removeClass('active').html(''); 264 } 265 $pagination.data('request-process', false); 266 } 267 }); 268 } 269 270 $(function () { 271 let getScrollY = (elem) =>{ 272 return window.pageYOffset || document.documentElement.scrollTop; 273 }; 274 275 $(window).scroll(function() { 276 if(getScrollY() > 0) { 277 $('.page__top-shadow').removeClass('visible'); 278 } else { 279 $('.page__top-shadow').addClass('visible'); 280 } 281 }).scroll(); 282 }); 283 284 $.fn.gemWooAttributeSelector = function() { 285 $(this).each(function() { 286 var $selector = $(this); 287 var $form = $selector.closest('form'); 288 var $input = $(':input', $selector); 289 var $options = $('.gem-attribute-options', $selector); 290 var $label = $selector.closest('tr').find('td.label label'); 291 $input.on('change', function() { 292 $('[data-value]', $options).removeClass('selected'); 293 $('[data-value="'+$input.val()+'"]', $options).addClass('selected'); 294 $label.next('.selected-text').remove(); 295 $('<span class="selected-text">'+$('[data-value="'+$input.val()+'"] .text', $options).text()+'</span>').insertAfter($label); 296 }).trigger('change'); 297 $('[data-value]', $options).on('click',function(e) { 298 e.preventDefault(); 299 if(!$(this).hasClass('disabled')) { 300 $input.val($(this).hasClass('selected') ? '' : $(this).data('value')).trigger('change'); 301 } 302 }) 303 $form.on('woocommerce_update_variation_values', function() { 304 $('[data-value]', $options).addClass('disabled'); 305 $('option', $input).each(function() {
306 $('[data-value="'+$(this).attr('value')+'"]', $options).removeClass('disabled'); 307 }); 308 }); 309 }); 310 } 311 312 $(function () { 313 $('.gem-attribute-selector').gemWooAttributeSelector(); 314 }); 315 316 $(function () { 317 $('.product-tabs-skeleton').remove(); 318 $('.product-right-column-skeleton').remove(); 319 }); 320 321 // Woo Germanized Init Custom Elements 322 $(function () { 323 try { 324 $('select#billing_title').select2(); 325 $('select#shipping_title').select2(); 326 $('select#shipping_address_type').select2(); 327 } catch (e) {} 328 }); 329 330 $('body').on('updated_checkout', function () { 331 const wcGzdWrap = $('.wc-gzd-checkbox-placeholder'); 332 const dhlWrap = $('.dhl-preferred-service-content'); 333 334 try { 335 $('input.input-checkbox', wcGzdWrap).checkbox(); 336 $('input[type="radio"]').checkbox(); 337 } catch (e) {} 338 }); 339 340 $( document.body ).on( 'wc_cart_emptied', function() { 341 if($('.thegem-template-cart-empty').length == 0 && $('.woocommerce-empty-cart').length) { 342 $('.woocommerce-empty-cart').closest('.block-content').removeClass('no-top-margin no-bottom-margin'); 343 } 344 }); 345 346})(jQuery); 347 348(function ($, window) { 349 $( document ).ready( function() { 350 if(window.germanized && window.germanized.checkout) { 351 window.germanized.checkout.adjustHeading = function() { 352 var self = window.germanized.checkout; 353 354 if ( self.params.adjust_heading && ! self.checkoutAdjustmentsDisabled() ) { 355 var $form = $( 'form.checkout:visible' ), 356 $heading = $form.find( '#order_review_heading:first' ); 357 if ( $heading ) { 358 $heading.removeClass( 'wc-gzd-heading-moved wc-gzd-maybe-show-heading' ); 359 } 360 361 if ( ! self.params.custom_heading_container ) { 362 var $visible = $form.find( '.shop_table:visible:not(.woocommerce-checkout-payment-total), #payment:visible' ); 363 var $theFirst = $visible.first(); 364 if ( $heading.length > 0 ) { 365 // Move heading after payment block in case both shop table + payment wrap are visible 366 if ( $theFirst.length > 0 && 2 === $visible.length && 'payment' === $theFirst.attr( 'id' ) ) { 367 $heading.addClass( 'wc-gzd-heading-moved' ); 368 $theFirst.after( $heading ); 369 } 370 371 if ( $( '#order_review:visible' ).length > 0 ) { 372 $form.find( '#order_review_heading:first' ).show(); 373 } else { 374 $form.find( '#order_review_heading:first' ).addClass( 'wc-gzd-maybe-show-heading' ); 375 } 376 } 377 } else { 378 var $wrapper = $form.find( this.params.custom_heading_container ); 379 380 if ( $wrapper.length > 0 && $heading.length > 0 ) { 381 $wrapper.prepend( $heading ); 382 383 if ( $wrapper.is( ':visible' ) ) { 384 $form.find( '#order_review_heading:first' ).show(); 385 } else { 386 $form.find( '#order_review_heading:first' ).addClass( 'wc-gzd-maybe-show-heading' ); 387 } 388 } 389 } 390 391 $( document.body ).trigger( 'wc_gzd_updated_checkout_heading' ); 392 } 393 } 394 } 395 }); 396})(jQuery, window);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.